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.
This commit is contained in:
Carlos O'Donell 2015-02-05 21:33:03 -05:00
parent 34c5604814
commit 3f823f488a
14 changed files with 151 additions and 1212 deletions

View File

@ -1,3 +1,23 @@
2015-02-05 Carlos O'Donell <carlos@systemhalted.org>
* sysdeps/hppa/Makefile (CFLAGS-dl-fptr.c): Add -Wno-error.
* sysdeps/hppa/bits/setjmp.h: Union is named __jmp_buf_internal_tag.
* sysdeps/hppa/dl-irel.h: Remove #warning.
* sysdeps/hppa/entry.h: Provide prototype for
__canonicalize_funcptr_for_compare and cast argument.
* sysdeps/hppa/fpu/fegetexcept.c (fegetexcept): Add semicolon.
* sysdeps/hppa/fpu/ftestexcept.c (fetestexcept): Likewise.
* sysdeps/hppa/sotruss-lib.c: New file.
* sysdeps/unix/sysv/linux/hppa/bits/atomic.h
(atomic_compare_and_exchange_val_acq): Use __typeof__.
(atomic_compare_and_exchange_bool_acq): Likewise.
* sysdeps/unix/sysv/linux/hppa/mmap.c: Use weak alias.
* sysdeps/unix/sysv/linux/hppa/pthread.h: Include pthread.h.
* sysdeps/unix/sysv/linux/hppa/syscall.S: Delete file.
* sysdeps/unix/sysv/linux/hppa/sysdep.c: Move syscall from here...
* sysdeps/unix/sysv/linux/hppa/syscall.c: ... to here.
2015-02-05 Chung-Lin Tang <cltang@codesourcery.com>
* sysdeps/nios2/machine-gmon.h (NIOS2_MCOUNT_CALL): Correct name of

View File

@ -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

View File

@ -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;

View File

@ -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))

View File

@ -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);

View File

@ -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"

View File

@ -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"

View File

@ -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
<http://www.gnu.org/licenses/>. */
#define HAVE_ARCH_PLTENTER
#define HAVE_ARCH_PLTEXIT
#include <elf/sotruss-lib.c>
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;
}

View File

@ -67,7 +67,7 @@ typedef uintmax_t uatomic_max_t;
# define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \
({ \
volatile int lws_errno; \
volatile int lws_ret; \
__typeof__ (*mem) lws_ret; \
asm volatile( \
"0: \n\t" \
"copy %2, %%r26 \n\t" \
@ -96,10 +96,10 @@ typedef uintmax_t uatomic_max_t;
# define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
({ \
int ret; \
__typeof__ (*mem) ret; \
ret = atomic_compare_and_exchange_val_acq(mem, newval, oldval); \
/* Return 1 if it was already acquired. */ \
(ret != (int)oldval); \
(ret != oldval); \
})
#else
# error __ASSUME_LWS_CAS is required to build glibc.

View File

@ -46,4 +46,4 @@ __mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
}
strong_alias (__mmap, mmap)
weak_alias (__mmap, mmap)

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +0,0 @@
/* Copyright (C) 1995-2015 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
<http://www.gnu.org/licenses/>. */
/* HPPA implements syscall() in 'C'; see sysdep.c. */

View File

@ -0,0 +1,64 @@
/* Copyright (C) 1997-2015 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
<http://www.gnu.org/licenses/>. */
#include <stdarg.h>
#include <sysdep.h>
#include <errno.h>
/* HPPA implements syscall() in 'C'; the assembler version would
typically be in syscall.S. Also note that we have INLINE_SYSCALL,
INTERNAL_SYSCALL, and all the generated pure assembly syscall wrappers.
How often the function is used is unknown. */
long int
syscall (long int __sysno, ...)
{
/* FIXME: Keep this matching INLINE_SYSCALL for hppa */
va_list args;
long int arg0, arg1, arg2, arg3, arg4, arg5;
long int __sys_res;
/* Load varargs */
va_start (args, __sysno);
arg0 = va_arg (args, long int);
arg1 = va_arg (args, long int);
arg2 = va_arg (args, long int);
arg3 = va_arg (args, long int);
arg4 = va_arg (args, long int);
arg5 = va_arg (args, long int);
va_end (args);
{
register unsigned long int __res asm("r28");
PIC_REG_DEF
LOAD_ARGS_6 (arg0, arg1, arg2, arg3, arg4, arg5)
asm volatile (SAVE_ASM_PIC
" ble 0x100(%%sr2, %%r0) \n"
" copy %1, %%r20 \n"
LOAD_ASM_PIC
: "=r" (__res)
: "r" (__sysno) PIC_REG_USE ASM_ARGS_6
: "memory", CALL_CLOB_REGS CLOB_ARGS_6);
__sys_res = __res;
}
if ((unsigned long int) __sys_res >= (unsigned long int) -4095)
{
__set_errno (-__sys_res);
__sys_res = -1;
}
return __sys_res;
}

View File

@ -19,9 +19,6 @@
#include <sysdep.h>
#include <errno.h>
extern int __syscall_error(int err_no);
extern long int syscall (long int __sysno, ...) __THROW;
/* This routine is jumped to by all the syscall handlers, to stash
an error number into errno. */
int
@ -30,48 +27,3 @@ __syscall_error (int err_no)
__set_errno (err_no);
return -1;
}
/* HPPA implements syscall() in 'C'; the assembler version would
typically be in syscall.S. Also note that we have INLINE_SYSCALL,
INTERNAL_SYSCALL, and all the generated pure assembly syscall wrappers.
How often the function is used is unknown. */
long int
syscall (long int __sysno, ...)
{
/* FIXME: Keep this matching INLINE_SYSCALL for hppa */
va_list args;
long int arg0, arg1, arg2, arg3, arg4, arg5;
long int __sys_res;
/* Load varargs */
va_start (args, __sysno);
arg0 = va_arg (args, long int);
arg1 = va_arg (args, long int);
arg2 = va_arg (args, long int);
arg3 = va_arg (args, long int);
arg4 = va_arg (args, long int);
arg5 = va_arg (args, long int);
va_end (args);
{
register unsigned long int __res asm("r28");
PIC_REG_DEF
LOAD_ARGS_6 (arg0, arg1, arg2, arg3, arg4, arg5)
asm volatile (SAVE_ASM_PIC
" ble 0x100(%%sr2, %%r0) \n"
" copy %1, %%r20 \n"
LOAD_ASM_PIC
: "=r" (__res)
: "r" (__sysno) PIC_REG_USE ASM_ARGS_6
: "memory", CALL_CLOB_REGS CLOB_ARGS_6);
__sys_res = __res;
}
if ((unsigned long int) __sys_res >= (unsigned long int) -4095)
{
__set_errno (-__sys_res);
__sys_res = -1;
}
return __sys_res;
}