From: Jan-Benedict G. <jb...@us...> - 2005-12-14 18:07:06
|
Update of /cvsroot/linux-vax/toolchain/patches In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9993 Modified Files: glibc-000000-experimental.patch Log Message: - Some more cut'n'pasting... Index: glibc-000000-experimental.patch =================================================================== RCS file: /cvsroot/linux-vax/toolchain/patches/glibc-000000-experimental.patch,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- glibc-000000-experimental.patch 12 Dec 2005 21:55:00 -0000 1.1 +++ glibc-000000-experimental.patch 14 Dec 2005 18:06:53 -0000 1.2 @@ -179,6 +179,197 @@ +# define FNONBLOCK O_NONBLOCK +# define FNDELAY O_NDELAY +#endif /* Use BSD. */ +diff -Nurp glibc-clean/sysdeps/unix/sysv/linux/vax/sysdep.h glibc/sysdeps/unix/sysv/linux/vax/sysdep.h +--- glibc-clean/sysdeps/unix/sysv/linux/vax/sysdep.h 1970-01-01 01:00:00.000000000 +0100 ++++ glibc/sysdeps/unix/sysv/linux/vax/sysdep.h 2005-12-14 18:26:24.000000000 +0100 +@@ -0,0 +1,187 @@ ++/* Copyright (C) 1991, 1992, 1995, 1997 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 Library General Public License as ++ published by the Free Software Foundation; either version 2 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 ++ Library General Public License for more details. ++ ++ You should have received a copy of the GNU Library General Public ++ License along with the GNU C Library; see the file COPYING.LIB. If not, ++ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, ++ Boston, MA 02111-1307, USA. */ ++ ++#include "config.h" ++#include <sysdeps/vax/sysdep.h> ++#include <sysdeps/unix/sysdep.h> ++ ++#undef SYS_ify ++#define SYS_ify(syscall_name) (__NR_##syscall_name) ++ ++#undef L ++#define L(name) .L##name ++ ++/* ++ * These defines allow to access the return/error values of a syscall ++ */ ++#undef INTERNAL_SYSCALL_DECL ++#define INTERNAL_SYSCALL_DECL(err) do { } while (0) ++ ++#undef INTERNAL_SYSCALL_ERRNO ++#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) ++ ++#undef INTERNAL_SYSCALL_ERROR_P ++#define INTERNAL_SYSCALL_ERROR_P(val, err) ((unsigned int) (val) >= -4095U) ++ ++ ++ ++#ifdef __ASSEMBLER__ ++ ++/* For Linux we can use the system call table in the header file ++ /usr/include/asm/unistd.h ++ of the kernel. But these symbols do not follow the SYS_* syntax ++ so we have to redefine the `SYS_ify' macro here. */ ++#undef SYS_ify ++#define SYS_ify(syscall_name) __NR_##syscall_name ++ ++/* ELF-like local names start with `.L'. */ ++#undef L ++#define L(name) .L##name ++ ++#define MOVE(x,y) movl x, y ++ ++#define SYSCALL_ERROR_LABEL syscall_error ++ ++#undef PSEUDO ++#define PSEUDO(name, syscall_name, args) \ ++ ENTRY(name, 0x0ffc) \ ++ DO_CALL(args, syscall_name) \ ++ cmpl $-4095, %r0; \ ++ bgtru no_error; \ ++ jmp SYSCALL_ERROR_LABEL; \ ++no_error: \ ++L(pseudo_end): ++ ++#undef PSEUDO_END ++#define PSEUDO_END(name) \ ++ SYSCALL_ERROR_HANDLER \ ++ END(name) ++ ++#define SYSCALL_ERROR_HANDLER ++ ++#define DOARGS_0 pushl $0; ++#define DOARGS_1 pushl $1; ++#define DOARGS_2 pushl $2; ++#define DOARGS_3 pushl $3; ++#define DOARGS_4 pushl $4; ++#define DOARGS_5 pushl $5; ++#define DOARGS_6 pushl $6; ++ ++#define LOAD_ARGS_0 ++#define LOAD_ARGS_1 pushl 0x04(%ap); LOAD_ARGS_0 ++#define LOAD_ARGS_2 pushl 0x08(%ap); LOAD_ARGS_1 ++#define LOAD_ARGS_3 pushl 0x0c(%ap); LOAD_ARGS_2 ++#define LOAD_ARGS_4 pushl 0x10(%ap); LOAD_ARGS_3 ++#define LOAD_ARGS_5 pushl 0x14(%ap); LOAD_ARGS_4 ++#define LOAD_ARGS_6 pushl 0x18(%ap); LOAD_ARGS_5 ++ ++#define DO_CALL(args, syscall_name) \ ++ push_ap_is_missing \ ++ LOAD_ARGS_##args \ ++ DOARGS_##args \ ++ movl %sp, %ap; \ ++ chmk $SYS_ify(syscall_name); \ ++ clear_stack \ ++ pop_ap ++ ++#else /* !defined(__ASSEMBLER__) */ ++ ++#define PREPARE_FOR_SYSCALL() \ ++ __asm__ __volatile__ ("pushl %ap") ++ ++#define LOAD_ARGS_0() ++#define LOAD_ARGS_1(arg1) \ ++ __asm__ __volatile__ ("pushl %0": : "r" ((arg1))); \ ++ LOAD_ARGS_0 () ++#define LOAD_ARGS_2(arg1, arg2) \ ++ __asm__ __volatile__ ("pushl %0": : "r" ((arg2))); \ ++ LOAD_ARGS_1 ((arg1)) ++#define LOAD_ARGS_3(arg1, arg2, arg3) \ ++ __asm__ __volatile__ ("pushl %0": : "r" ((arg3))); \ ++ LOAD_ARGS_2 ((arg1), (arg2)) ++#define LOAD_ARGS_4(arg1, arg2, arg3, arg4) \ ++ __asm__ __volatile__ ("pushl %0": : "r" ((arg4))); \ ++ LOAD_ARGS_3 ((arg1), (arg2), (arg3)) ++#define LOAD_ARGS_5(arg1, arg2, arg3, arg4, arg5) \ ++ __asm__ __volatile__ ("pushl %0": : "r" ((arg5))); \ ++ LOAD_ARGS_4 ((arg1), (arg2), (arg3), (arg4)) ++#define LOAD_ARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \ ++ __asm__ __volatile__ ("pushl %0": : "r" ((arg6))); \ ++ LOAD_ARGS_5 ((arg1), (arg2), (arg3), (arg4), (arg5)) ++ ++#define DO_ARGS_0 " pushl $0 \n" ++#define DO_ARGS_1 " pushl $1 \n" ++#define DO_ARGS_2 " pushl $2 \n" ++#define DO_ARGS_3 " pushl $3 \n" ++#define DO_ARGS_4 " pushl $4 \n" ++#define DO_ARGS_5 " pushl $5 \n" ++#define DO_ARGS_6 " pushl $6 \n" ++ ++#define UNDO_ARGS_0 " addl2 $4, %%sp \n" ++#define UNDO_ARGS_1 " addl2 $8, %%sp \n" ++#define UNDO_ARGS_2 " addl2 $12, %%sp \n" ++#define UNDO_ARGS_3 " addl2 $16, %%sp \n" ++#define UNDO_ARGS_4 " addl2 $20, %%sp \n" ++#define UNDO_ARGS_5 " addl2 $24, %%sp \n" ++#define UNDO_ARGS_6 " addl2 $28, %%sp \n" ++ ++#warning "Don't clobber 'memory', but the proper registers" ++ ++ ++/* Define a macro which expands inline into the wrapper code for a system ++ call. */ ++#undef INLINE_SYSCALL ++#define INLINE_SYSCALL(name, nr, args...) \ ++ ( \ ++ { \ ++ unsigned int resultvar = INTERNAL_SYSCALL (name, /**/, nr, args); \ ++ if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, /**/), 0)) \ ++ { \ ++ __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, /**/)); \ ++ resultvar = 0xffffffff; \ ++ } \ ++ (int) resultvar; \ ++ } \ ++ ) ++ ++#undef INTERNAL_SYSCALL ++#define INTERNAL_SYSCALL(name, err, nr, args...) \ ++ ( \ ++ { \ ++ unsigned long resultvar; \ ++ register long _sc_0 __asm__("r0") = SYS_ify (name); \ ++ \ ++ PREPARE_FOR_SYSCALL (); \ ++ LOAD_ARGS_##nr (args); \ ++ asm volatile ( \ ++ DO_ARGS_##nr \ ++ " movl %%sp, %%ap \n" \ ++ " chmk %0 \n" \ ++ UNDO_ARGS_##nr \ ++ " movl (%%sp)+, %%ap \n" \ ++ : "=r" (_sc_0) \ ++ : "0" (_sc_0) \ ++ : "memory"); \ ++ \ ++ resultvar = _sc_0; \ ++ \ ++ (int) resultvar; \ ++ } \ ++ ) ++ ++#endif diff -Nurp glibc-clean/sysdeps/vax/bits/endian.h glibc/sysdeps/vax/bits/endian.h --- glibc-clean/sysdeps/vax/bits/endian.h 1970-01-01 01:00:00.000000000 +0100 +++ glibc/sysdeps/vax/bits/endian.h 2005-12-12 19:50:57.000000000 +0100 @@ -192,8 +383,8 @@ +#define __BYTE_ORDER __LITTLE_ENDIAN diff -Nurp glibc-clean/sysdeps/vax/bits/link.h glibc/sysdeps/vax/bits/link.h --- glibc-clean/sysdeps/vax/bits/link.h 1970-01-01 01:00:00.000000000 +0100 -+++ glibc/sysdeps/vax/bits/link.h 2005-12-12 21:08:29.000000000 +0100 -@@ -0,0 +1,56 @@ ++++ glibc/sysdeps/vax/bits/link.h 2005-12-13 20:26:05.000000000 +0100 +@@ -0,0 +1,62 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + @@ -220,18 +411,24 @@ +/* Registers for entry into PLT on VAX. */ +typedef struct La_vax_regs +{ ++#warning "struct La_vax_regs is empty" ++#if 0 + uint32_t lr_a0; + uint32_t lr_a1; + uint32_t lr_sp; ++#endif +} La_vax_regs; + +/* Return values for calls from PLT on VAX. */ +typedef struct La_vax_retval +{ ++#warning "struct La_vax_regs is empty" ++#if 0 + uint32_t lrv_d0; + uint32_t lrv_d1; + uint32_t lrv_a0; + long double lrv_fp0; ++#endif +} La_vax_retval; + +__BEGIN_DECLS @@ -252,74 +449,95 @@ + diff -Nurp glibc-clean/sysdeps/vax/dl-machine.h glibc/sysdeps/vax/dl-machine.h --- glibc-clean/sysdeps/vax/dl-machine.h 1970-01-01 01:00:00.000000000 +0100 -+++ glibc/sysdeps/vax/dl-machine.h 2005-12-12 22:42:00.000000000 +0100 -@@ -0,0 +1,293 @@ -+/* Machine-dependent ELF dynamic relocation inline functions. m68k version. -+ Copyright (C) 1996-2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. ++++ glibc/sysdeps/vax/dl-machine.h 2005-12-13 20:05:26.000000000 +0100 +@@ -0,0 +1,358 @@ ++/* Machine-dependent ELF dynamic relocation inline functions. VAX version. ++ Copyright (C) 1996,1997,1998,1999,2000,2001 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. ++ modify it under the terms of the GNU Library General Public License as ++ published by the Free Software Foundation; either version 2 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. ++ Library 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, write to the Free -+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -+ 02111-1307 USA. */ ++ You should have received a copy of the GNU Library General Public ++ License along with the GNU C Library; see the file COPYING.LIB. If ++ not, write to the Free Software Foundation, Inc., ++ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef dl_machine_h +#define dl_machine_h + -+#define ELF_MACHINE_NAME "vax" ++#define ELF_MACHINE_NAME "VAX" + +#include <sys/param.h> + ++#if 0 ++#ifdef __PIC__ ++# define CALL_FN(x) \ ++ "move.d $pc,$r9\n\t" \ ++ "add.d " #x " - .,$r9\n\t" \ ++ "jsr $r9" ++#else /* !__PIC__ */ ++# define CALL_FN(x) "jsr " #x ++#endif /* __PIC__ */ ++#endif /* 0 */ ++ ++#define CALL_FN(x) +/* Return nonzero iff ELF header is compatible with the running host. */ ++ +static inline int +elf_machine_matches_host (const Elf32_Ehdr *ehdr) +{ + return ehdr->e_machine == EM_VAX; +} + -+ +/* Return the link-time address of _DYNAMIC. Conveniently, this is the + first element of the GOT. This must be inlined in a function which + uses global data. */ ++ +static inline Elf32_Addr +elf_machine_dynamic (void) +{ -+#error "Not yet implemented -- this is from m68k" -+ register Elf32_Addr *got asm ("%a5"); ++ /* Don't just set this to an asm variable "r0" since that's not logical ++ (like, the variable is uninitialized and the register is fixed) and ++ may make GCC trip over itself doing register allocation. Yes, I'm ++ paranoid. Why do you ask? */ ++ Elf32_Addr *got; ++ ++ __asm__("\tmoval _GLOBAL_OFFSET_TABLE_, %0\n\t":"=r"(got)); + return *got; ++ +} + ++/* Return the run-time load address of the shared object. */ + -+/* Return the run-time load address of the shared object. */ +static inline Elf32_Addr +elf_machine_load_address (void) +{ -+#error "Not yet implemented -- this is from m68k" -+ Elf32_Addr addr; -+ asm ("lea _dl_start(%%pc), %0\n\t" -+ "sub.l _dl_start@GOT.w(%%a5), %0" -+ : "=a" (addr)); -+ return addr; -+} ++ unsigned long addr, link_addr; ++ unsigned long *got; + ++ /* subtract got dynamic from real dynamic to get load_address */ ++ __asm__("\tmoval _GLOBAL_OFFSET_TABLE_, %0\n\t":"=r"(got)); ++ link_addr = *got; ++ ++ __asm__("\tmoval _DYNAMIC, %0\n\t":"=r"(addr)); ++ ++ return addr-link_addr; ++} + +/* Set up the loaded object described by L so its unrelocated PLT + entries will jump to the on-demand fixup code in dl-runtime.c. */ + -+static inline int __attribute__ ((always_inline)) ++static inline int +elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) +{ -+#error "Not yet implemented -- this is from m68k" + Elf32_Addr *got; + extern void _dl_runtime_resolve (Elf32_Word); + extern void _dl_runtime_profile (Elf32_Word); @@ -340,16 +558,15 @@ + to intercept the calls to collect information. In this case we + don't store the address in the GOT so that all future calls also + end in this function. */ -+ if (profile) ++ if (__builtin_expect (profile, 0)) + { + got[2] = (Elf32_Addr) &_dl_runtime_profile; + -+ if (GLRO(dl_profile) != NULL -+ && _dl_name_match_p (GLRO(dl_profile), l)) ++ if (_dl_name_match_p (_dl_profile, l)) + { + /* This is the object we are looking for. Say that we really + want profiling and the timers are started. */ -+ GL(dl_profile_map) = l; ++ _dl_profile_map = l; + } + } + else @@ -361,9 +578,48 @@ + return lazy; +} + -+#define ELF_MACHINE_RUNTIME_FIXUP_ARGS long int save_a0, long int save_a1 ++/* This code is used in dl-runtime.c to call the `fixup' function ++ and then redirect to the address it returns. ++ ++ We get here with the offset into the relocation table pushed on stack, ++ and the link map in MOF. */ ++#define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name) \ ++asm( ".text\n\ ++ .globl " #tramp_name "\n\t \ ++ .type " #tramp_name ", @function\n\t \ ++" #tramp_name ": \n\t \ ++ pushr $0x3ffc\n\ ++ movl 48(%sp), %r0\n\ ++ movl 52(%sp), %r1\n\ ++ pushl (%r1) ++ pushl %r0 ++ calls $2, " #fixup_name "\n\ ++ movl %r0, 52(%sp)\n\ ++ bicw3 6(%fp), (%r0), %r1\n\ ++ popr $0x3ffc\n\ ++ bneq 4f\n\ ++ addl2 $4, %sp\n\ ++ addl2 $2, (%sp)\n\ ++ rsb\n\ ++4: addl2 $8, %sp\n\ ++ callg (%ap), (%r0)\n\ ++ ret\n\ ++ .size " #tramp_name ", . - " #tramp_name "\n\ ++ .previous\n\ ++"); + + ++#ifndef PROF ++#define ELF_MACHINE_RUNTIME_TRAMPOLINE \ ++ TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup) \ ++ TRAMPOLINE_TEMPLATE (_dl_runtime_profile, profile_fixup); ++#else ++#define ELF_MACHINE_RUNTIME_TRAMPOLINE \ ++ TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup) \ ++ asm( ".globl _dl_runtime_profile\n" \ ++ ".set _dl_runtime_profile, _dl_runtime_resolve"); ++#endif ++ +/* Mask identifying addresses reserved for the user program, + where the dynamic linker should not map anything. */ +#define ELF_MACHINE_USER_ADDRESS_MASK 0x80000000UL @@ -373,62 +629,64 @@ + its return value is the user program's entry point. */ + +#define RTLD_START asm ("\ -+ .text\n\ -+ .globl _start\n\ -+ .type _start,@function\n\ ++ .text\n\ ++ .globl _start\n\ +_start:\n\ -+ move.l %sp, -(%sp)\n\ -+ jbsr _dl_start\n\ -+ addq.l #4, %sp\n\ -+ /* FALLTHRU */\n\ -+\n\ -+ .globl _dl_start_user\n\ -+ .type _dl_start_user,@function\n\ ++ .word 0x0101\n\ ++ pushl %sp\n\ ++ calls $1,_dl_start\n\ ++ .globl _dl_start_user\n\ ++ .type _dl_start_user,@function +_dl_start_user:\n\ -+ | Save the user entry point address in %a4.\n\ -+ move.l %d0, %a4\n\ -+ | See if we were run as a command with the executable file\n\ -+ | name as an extra leading argument.\n\ -+ move.l _dl_skip_args(%pc), %d0\n\ -+ | Pop the original argument count\n\ -+ move.l (%sp)+, %d1\n\ -+ | Subtract _dl_skip_args from it.\n\ -+ sub.l %d0, %d1\n\ -+ | Adjust the stack pointer to skip _dl_skip_args words.\n\ -+ lea (%sp, %d0*4), %sp\n\ -+ | Push back the modified argument count.\n\ -+ move.l %d1, -(%sp)\n\ -+ # Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env)\n\ -+ pea 8(%sp, %d1*4)\n\ -+ pea 8(%sp)\n\ -+ move.l %d1, -(%sp)\n\ -+ move.l _rtld_local(%pc), -(%sp)\n\ -+ jbsr _dl_init_internal@PLTPC\n\ -+ addq.l #8, %sp\n\ -+ addq.l #8, %sp\n\ -+ | Pass our finalizer function to the user in %a1.\n\ -+ lea _dl_fini(%pc), %a1\n\ -+ | Initialize %fp with the stack pointer.\n\ -+ move.l %sp, %fp\n\ -+ | Jump to the user's entry point.\n\ -+ jmp (%a4)\n\ -+ .size _dl_start_user, . - _dl_start_user\n\ -+ .previous"); ++ # save the user entry point address in r6.\n\ ++ movl %r0, %r6\n\ ++ # store the highest stack address \n\ ++ moval __libc_stack_end, %r0\n\ ++ movl %sp, (%r0)\n\ ++ # see if we were run as a command with the executable file\n\ ++ moval _dl_skip_args, %r0\n\ ++ movl (%r0), %r0\n\ ++ # pop the original argument count\n\ ++ movl (%sp)+, %r1\n\ ++ ashl $2, %r0, %r2\n\ ++ addl2 %r2, %sp\n\ ++ subl2 %r0, %r1 ++ pushl %r1\n\ ++ pushal _dl_loaded\n\ ++ calls $4, _dl_init\n\ ++ moval _dl_fini, %r0\n\ ++ jmp (%r6)\n\ ++ .size _dl_start_user, . - _dl_start_user\n \ ++ .previous"); + -+/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so -+ PLT entries should not be allowed to define the value. -+ ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one -+ of the main executable's symbols, as for a COPY reloc. */ -+#define elf_machine_type_class(type) \ -+ ((((type) == R_68K_JMP_SLOT) * ELF_RTYPE_CLASS_PLT) \ -+ | (((type) == R_68K_COPY) * ELF_RTYPE_CLASS_COPY)) ++/* Nonzero iff TYPE describes a relocation that should ++ skip the executable when looking up the symbol value. */ ++#define elf_machine_lookup_noexec_p(type) ((type) == R_VAX_COPY) ++ ++/* Nonzero iff TYPE describes relocation of a PLT entry, so ++ PLT entries should not be allowed to define the value. */ ++#define elf_machine_lookup_noplt_p(type) ((type) == R_VAX_JMP_SLOT) + +/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */ -+#define ELF_MACHINE_JMP_SLOT R_68K_JMP_SLOT ++#define ELF_MACHINE_JMP_SLOT R_VAX_JMP_SLOT + -+/* The m68k never uses Elf32_Rel relocations. */ ++/* CRIS never uses Elf32_Rel relocations. */ +#define ELF_MACHINE_NO_REL 1 + ++/* We define an initialization functions. This is called very early in ++ _dl_sysdep_start. */ ++#define DL_PLATFORM_INIT dl_platform_init () ++ ++extern const char *_dl_platform; ++ ++static inline void __attribute__ ((unused)) ++dl_platform_init (void) ++{ ++ if (_dl_platform != NULL && *_dl_platform == '\0') ++ /* Avoid an empty string which would disturb us. */ ++ _dl_platform = NULL; ++} ++ +static inline Elf32_Addr +elf_machine_fixup_plt (struct link_map *map, lookup_t t, + const Elf32_Rela *reloc, @@ -437,118 +695,206 @@ + return *reloc_addr = value; +} + -+/* Return the final value of a plt relocation. On the m68k the JMP_SLOT -+ relocation ignores the addend. */ ++/* Return the final value of a plt relocation. */ +static inline Elf32_Addr +elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc, + Elf32_Addr value) +{ -+ return value; ++ return value + reloc->r_addend; +} + -+/* Names of the architecture-specific auditing callback functions. */ -+#define ARCH_LA_PLTENTER vax_gnu_pltenter -+#define ARCH_LA_PLTEXIT vax_gnu_pltexit -+ +#endif /* !dl_machine_h */ + -+#ifdef RESOLVE_MAP ++#ifdef RESOLVE + +/* Perform the relocation specified by RELOC and SYM (which is fully resolved). + MAP is the object containing the reloc. */ + -+auto inline void __attribute__ ((unused, always_inline)) ++static inline void +elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, + const Elf32_Sym *sym, const struct r_found_version *version, -+ void *const reloc_addr_arg) ++ Elf32_Addr *const reloc_addr) +{ -+ Elf32_Addr *const reloc_addr = reloc_addr_arg; -+ const unsigned int r_type = ELF32_R_TYPE (reloc->r_info); ++#ifndef RTLD_BOOTSTRAP ++ /* This is defined in rtld.c, but nowhere in the static libc.a; make the ++ reference weak so static programs can still link. This declaration ++ cannot be done when compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP) ++ because rtld.c contains the common defn for _dl_rtld_map, which is ++ incompatible with a weak decl in the same file. */ ++ weak_extern (_dl_rtld_map); ++#endif + -+ if (__builtin_expect (r_type == R_68K_RELATIVE, 0)) -+ *reloc_addr = map->l_addr + reloc->r_addend; ++ if (ELF32_R_TYPE (reloc->r_info) == R_VAX_RELATIVE) ++ { ++#ifndef RTLD_BOOTSTRAP ++ if (map != &_dl_rtld_map) /* Already done in rtld itself. */ ++#endif ++ *reloc_addr = map->l_addr + reloc->r_addend; ++ } + else + { ++#ifndef RTLD_BOOTSTRAP + const Elf32_Sym *const refsym = sym; -+ struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); -+ Elf32_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value; ++#endif ++ Elf32_Addr value; ++ if (sym->st_shndx != SHN_UNDEF && ++ ELF32_ST_BIND (sym->st_info) == STB_LOCAL) ++ value = map->l_addr; ++ else ++ { ++ value = RESOLVE (&sym, version, ELF32_R_TYPE (reloc->r_info)); ++ if (sym) ++ value += sym->st_value; ++ } ++ value += reloc->r_addend; /* Assume copy relocs have zero addend. */ + -+ switch (r_type) ++ switch (ELF32_R_TYPE (reloc->r_info)) + { -+ case R_68K_COPY: ++#ifndef RTLD_BOOTSTRAP ++ case R_VAX_COPY: + if (sym == NULL) + /* This can happen in trace mode if an object could not be + found. */ + break; + if (sym->st_size > refsym->st_size -+ || (sym->st_size < refsym->st_size && GLRO(dl_verbose))) ++ || (_dl_verbose && sym->st_size < refsym->st_size)) + { ++ extern char **_dl_argv; + const char *strtab; + + strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]); -+ _dl_error_printf ("\ -+%s: Symbol `%s' has different size in shared object, consider re-linking\n", -+ rtld_progname ?: "<program name unknown>", ++ _dl_error_printf ("%s: Symbol `%s' has different size in shared object, consider re-linking\n", ++ _dl_argv[0] ?: "<program name unknown>", + strtab + refsym->st_name); + } -+ memcpy (reloc_addr_arg, (void *) value, -+ MIN (sym->st_size, refsym->st_size)); ++ memcpy (reloc_addr, (void *) value, MIN (sym->st_size, ++ refsym->st_size)); + break; -+ case R_68K_GLOB_DAT: -+ case R_68K_JMP_SLOT: ++ ++ case R_VAX_32: ++#endif ++ case R_VAX_GLOB_DAT: ++ case R_VAX_JMP_SLOT: + *reloc_addr = value; + break; -+ case R_68K_8: -+ *(char *) reloc_addr = value + reloc->r_addend; -+ break; -+ case R_68K_16: -+ *(short *) reloc_addr = value + reloc->r_addend; -+ break; -+ case R_68K_32: -+ *reloc_addr = value + reloc->r_addend; -+ break; -+ case R_68K_PC8: -+ *(char *) reloc_addr -+ = value + reloc->r_addend - (Elf32_Addr) reloc_addr; -+ break; -+ case R_68K_PC16: -+ *(short *) reloc_addr -+ = value + reloc->r_addend - (Elf32_Addr) reloc_addr; ++#ifndef RTLD_BOOTSTRAP ++ case R_VAX_8: ++ *(char *) reloc_addr = value; + break; -+ case R_68K_PC32: -+ *reloc_addr = value + reloc->r_addend - (Elf32_Addr) reloc_addr; ++ case R_VAX_16: ++ *(short *) reloc_addr = value; + break; -+ case R_68K_NONE: /* Alright, Wilbur. */ ++#endif ++ case R_VAX_NONE: + break; ++#if !defined RTLD_BOOTSTRAP || defined _NDEBUG + default: -+ _dl_reloc_bad_type (map, r_type, 0); ++ _dl_reloc_bad_type (map, ELFW(R_TYPE) (reloc->r_info), 0); + break; ++#endif + } + } +} + -+auto inline void __attribute__ ((unused, always_inline)) -+elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc, -+ void *const reloc_addr_arg) -+{ -+ Elf32_Addr *const reloc_addr = reloc_addr_arg; -+ *reloc_addr = l_addr + reloc->r_addend; -+} -+ -+auto inline void __attribute__ ((unused, always_inline)) ++static inline void +elf_machine_lazy_rel (struct link_map *map, + Elf32_Addr l_addr, const Elf32_Rela *reloc) +{ + Elf32_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset); -+ if (ELF32_R_TYPE (reloc->r_info) == R_68K_JMP_SLOT) ++ if (__builtin_expect (ELF32_R_TYPE (reloc->r_info), R_VAX_JMP_SLOT) ++ == R_VAX_JMP_SLOT) + *reloc_addr += l_addr; + else + _dl_reloc_bad_type (map, ELF32_R_TYPE (reloc->r_info), 1); +} + -+#endif /* RESOLVE_MAP */ ++#endif /* RESOLVE */ diff -Nurp glibc-clean/sysdeps/vax/Implies glibc/sysdeps/vax/Implies --- glibc-clean/sysdeps/vax/Implies 1970-01-01 01:00:00.000000000 +0100 +++ glibc/sysdeps/vax/Implies 2005-12-12 19:49:25.000000000 +0100 @@ -0,0 +1 @@ +wordsize-32 +diff -Nurp glibc-clean/sysdeps/vax/sysdep.h glibc/sysdeps/vax/sysdep.h +--- glibc-clean/sysdeps/vax/sysdep.h 1970-01-01 01:00:00.000000000 +0100 ++++ glibc/sysdeps/vax/sysdep.h 2005-12-13 22:55:29.000000000 +0100 +@@ -0,0 +1,80 @@ ++/* Assembler macros for VAX. ++ Copyright (C) 1997, 1998 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 Library General Public License as ++ published by the Free Software Foundation; either version 2 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 ++ Library General Public License for more details. ++ ++ You should have received a copy of the GNU Library General Public ++ License along with the GNU C Library; see the file COPYING.LIB. If not, ++ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, ++ Boston, MA 02111-1307, USA. */ ++ ++#include <sysdeps/generic/sysdep.h> ++ ++#ifdef __ASSEMBLER__ ++ ++/* Syntactic details of assembler. */ ++ ++#ifdef HAVE_ELF ++ ++#define ALIGNARG(log2) log2 ++/* For ELF we need the `.type' directive to make shared libs work right. */ ++#define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg; ++#define ASM_SIZE_DIRECTIVE(name) .size name,.-name ++ ++/* In ELF C symbols are asm symbols. */ ++#if 0 ++#undef NO_UNDERSCORES ++#define NO_UNDERSCORES ++#endif ++ ++#define PLTJMP(_x) _x##(PLT) ++ ++#else ++ ++#define ALIGNARG(log2) log2 ++#define ASM_TYPE_DIRECTIVE(name,type) /* Nothing is specified. */ ++#define ASM_SIZE_DIRECTIVE(name) /* Nothing is specified. */ ++ ++#define PLTJMP(_x) _x ++ ++#endif ++ ++/* Define an entry point visible from C. */ ++#define ENTRY(name,regs) \ ++ ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \ ++ ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),function) \ ++ .align ALIGNARG(4); \ ++ C_LABEL(name) \ ++ .word regs; \ ++ CALL_MCOUNT ++ ++#undef END ++#define END(name) \ ++ ASM_SIZE_DIRECTIVE(name) ++ ++/* If compiled for profiling, call `mcount' at the start of each function. */ ++#ifdef PROF ++/* FIXME -maybe*/ ++#define CALL_MCOUNT .data; 1:; .long 0; .text; moval 1b,%r0; jsb mcount; ++#else ++#define CALL_MCOUNT /* Do nothing. */ ++#endif ++ ++#ifdef NO_UNDERSCORES ++/* Since C identifiers are not normally prefixed with an underscore ++ on this system, the asm identifier `syscall_error' intrudes on the ++ C name space. Make sure we use an innocuous name. */ ++#define syscall_error __syscall_error ++#define mcount _mcount ++#endif ++ ++#endif /* __ASSEMBLER__ */ |