From 3f823f488a4db8d048892af1a7ee992aab770e5a Mon Sep 17 00:00:00 2001 From: Carlos O'Donell Date: Thu, 5 Feb 2015 21:33:03 -0500 Subject: hppa: Remove warnings and fix conformance errors. (1) Fix warnings. This is a bulk update to fix all the warnings that were causing build failures with -Werror on hppa. The most egregious problems are in dl-fptr.c which needs to be entirely rewritten, thus I've used -Wno-error for that. (2) Fix conformance errors. The sysdep.c file had __syscall_error and syscall in one file which caused conformance issues by including syscall when __syscall_error was linked to. The fix is obviously to split the file and use syscall.c to implement syscall. --- sysdeps/hppa/Makefile | 2 ++ sysdeps/hppa/bits/setjmp.h | 4 ++-- sysdeps/hppa/dl-irel.h | 3 +-- sysdeps/hppa/entry.h | 5 ++++- sysdeps/hppa/fpu/fegetexcept.c | 2 +- sysdeps/hppa/fpu/ftestexcept.c | 2 +- sysdeps/hppa/sotruss-lib.c | 51 ++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 62 insertions(+), 7 deletions(-) create mode 100644 sysdeps/hppa/sotruss-lib.c (limited to 'sysdeps/hppa') diff --git a/sysdeps/hppa/Makefile b/sysdeps/hppa/Makefile index 9e24349..078f90a 100644 --- a/sysdeps/hppa/Makefile +++ b/sysdeps/hppa/Makefile @@ -24,6 +24,8 @@ LDFLAGS-c_pic.os += -Wl,--unique=.text* ifeq ($(subdir),elf) CFLAGS-rtld.c += -mdisable-fpregs sysdep-dl-routines += dl-symaddr dl-fptr +# dl-fptr.c needs a complete rewrite to fix ISO C aliasing violations. +CFLAGS-dl-fptr.c = -Wno-error sysdep_routines += $(sysdep-dl-routines) sysdep-rtld-routines += $(sysdep-dl-routines) endif diff --git a/sysdeps/hppa/bits/setjmp.h b/sysdeps/hppa/bits/setjmp.h index 7d85586..3c04c0b 100644 --- a/sysdeps/hppa/bits/setjmp.h +++ b/sysdeps/hppa/bits/setjmp.h @@ -38,9 +38,9 @@ * 10 x 64-bit fprs in this order: - fr12-fr21 (callee saves) Note: We have 8 bytes of free space for future uses. */ -typedef union +typedef union __jmp_buf_internal_tag { - struct __jmp_buf_internal_tag + struct { int __r3; int __pad0; diff --git a/sysdeps/hppa/dl-irel.h b/sysdeps/hppa/dl-irel.h index fc7bd0f..eb98d50 100644 --- a/sysdeps/hppa/dl-irel.h +++ b/sysdeps/hppa/dl-irel.h @@ -27,8 +27,7 @@ #define ELF_MACHINE_IREL 1 -/* Implement enough to get the build going again. */ -#warning "NEED STT_GNU_IFUNC IMPLEMENTATION" +/* There is no IFUNC implementation yet. Add stubs to allow builds. */ static inline struct fdesc __attribute ((always_inline)) diff --git a/sysdeps/hppa/entry.h b/sysdeps/hppa/entry.h index b024db2..5ea5b47 100644 --- a/sysdeps/hppa/entry.h +++ b/sysdeps/hppa/entry.h @@ -2,9 +2,12 @@ extern void _start (void); #endif +/* Lives in libgcc.so and canonicalizes function pointers for comparison. */ +extern unsigned int __canonicalize_funcptr_for_compare (unsigned int fptr); + /* The function's entry point is stored in the first word of the function descriptor (plabel) of _start(). */ -#define ENTRY_POINT __canonicalize_funcptr_for_compare(_start) +#define ENTRY_POINT __canonicalize_funcptr_for_compare((unsigned int)_start) /* We have to provide a special declaration. */ #define ENTRY_POINT_DECL(class) class void _start (void); diff --git a/sysdeps/hppa/fpu/fegetexcept.c b/sysdeps/hppa/fpu/fegetexcept.c index 1a82886..8198cc5 100644 --- a/sysdeps/hppa/fpu/fegetexcept.c +++ b/sysdeps/hppa/fpu/fegetexcept.c @@ -22,7 +22,7 @@ int fegetexcept (void) { - union { unsigned long long l; unsigned int sw[2] } s; + union { unsigned long long l; unsigned int sw[2]; } s; /* Get the current status word. */ __asm__ ("fstd %%fr0,0(%1) \n\t" diff --git a/sysdeps/hppa/fpu/ftestexcept.c b/sysdeps/hppa/fpu/ftestexcept.c index ed0476e..091ebfb 100644 --- a/sysdeps/hppa/fpu/ftestexcept.c +++ b/sysdeps/hppa/fpu/ftestexcept.c @@ -22,7 +22,7 @@ int fetestexcept (int excepts) { - union { unsigned long long l; unsigned int sw[2] } s; + union { unsigned long long l; unsigned int sw[2]; } s; /* Get the current status word. */ __asm__ ("fstd %%fr0,0(%1) \n\t" diff --git a/sysdeps/hppa/sotruss-lib.c b/sysdeps/hppa/sotruss-lib.c new file mode 100644 index 0000000..4e7a88f --- /dev/null +++ b/sysdeps/hppa/sotruss-lib.c @@ -0,0 +1,51 @@ +/* Override generic sotruss-lib.c to define actual functions for HP-PARISC. + Copyright (C) 2012-2014 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#define HAVE_ARCH_PLTENTER +#define HAVE_ARCH_PLTEXIT + +#include + +ElfW(Addr) +la_hppa_gnu_pltenter (ElfW(Sym) *sym __attribute__ ((unused)), + unsigned int ndx __attribute__ ((unused)), + uintptr_t *refcook, uintptr_t *defcook, + La_hppa_regs *regs, unsigned int *flags, + const char *symname, long int *framesizep) +{ + print_enter (refcook, defcook, symname, + regs->lr_reg[0], regs->lr_reg[1], regs->lr_reg[2], + *flags); + + /* No need to copy anything, we will not need the parameters in any case. */ + *framesizep = 0; + + return sym->st_value; +} + +unsigned int +la_hppa_gnu_pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook, + uintptr_t *defcook, + const struct La_hppa_regs *inregs, + struct La_hppa_retval *outregs, const char *symname) +{ + print_exit (refcook, defcook, symname, outregs->lrv_r28); + + return 0; +} -- cgit v1.1