1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

Updated from ../gpl2lgpl.sed

This commit is contained in:
Roland McGrath
1996-07-17 18:00:33 +00:00
parent 184b7b466a
commit 96e1bff251
4 changed files with 122 additions and 119 deletions

View File

@ -57,6 +57,15 @@ rm -f crti.s-new crtn.s-new\n\
mv crtcommon.tmp crti.s-new\n\ mv crtcommon.tmp crti.s-new\n\
cp crti.s-new crtn.s-new"); cp crti.s-new crtn.s-new");
/* Extract a `.end' if one is produced by the compiler. */
asm ("fgrep .end >/dev/null 2>&1 <<\\EOF.end && need_end=yes");
void
useless_function (void)
{
return;
}
asm ("\nEOF.end\n");
/* Append the .init prologue to crti.s-new. */ /* Append the .init prologue to crti.s-new. */
asm ("cat >> crti.s-new <<\\EOF.crti.init"); asm ("cat >> crti.s-new <<\\EOF.crti.init");
@ -77,8 +86,9 @@ _init (void)
/* End the here document containing the .init prologue code. /* End the here document containing the .init prologue code.
Then fetch the .section directive just written and append that Then fetch the .section directive just written and append that
to crtn.s-new, followed by the function epilogue. */ to crtn.s-new, followed by the function epilogue. */
asm (".end _init\n\ asm ("\n\
EOF.crti.init\n\ EOF.crti.init\n\
test -n \"$need_end\" && echo .end _init >> crti.s-new\n\
fgrep .init crti.s-new >>crtn.s-new\n\ fgrep .init crti.s-new >>crtn.s-new\n\
fgrep -v .end >> crtn.s-new <<\\EOF.crtn.init"); fgrep -v .end >> crtn.s-new <<\\EOF.crtn.init");
} }
@ -96,8 +106,8 @@ _fini (void)
/* End the here document containing the .fini prologue code. /* End the here document containing the .fini prologue code.
Then fetch the .section directive just written and append that Then fetch the .section directive just written and append that
to crtn.s-new, followed by the function epilogue. */ to crtn.s-new, followed by the function epilogue. */
asm (".end _fini\n\ asm ("\nEOF.crti.fini\n\
EOF.crti.fini\n\ test -n \"$need_end\" && echo .end _fini >> crti.s-new\n\
cat > /dev/null <<\\EOF.fini.skip"); cat > /dev/null <<\\EOF.fini.skip");
{ {

View File

@ -23,14 +23,6 @@ Cambridge, MA 02139, USA. */
# include <config.h> # include <config.h>
#endif #endif
#if defined _LIBC || defined HAVE_ARGZ_H
# include <argz.h>
#endif
#include <ctype.h>
#if defined STDC_HEADERS || defined _LIBC
# include <stdlib.h>
#endif
#if defined HAVE_STRING_H || defined _LIBC #if defined HAVE_STRING_H || defined _LIBC
# ifndef _GNU_SOURCE # ifndef _GNU_SOURCE
@ -46,6 +38,15 @@ Cambridge, MA 02139, USA. */
# endif # endif
#endif #endif
#if defined _LIBC || defined HAVE_ARGZ_H
# include <argz.h>
#endif
#include <ctype.h>
#if defined STDC_HEADERS || defined _LIBC
# include <stdlib.h>
#endif
#include "loadinfo.h" #include "loadinfo.h"
/* On some strange systems still no definition of NULL is found. Sigh! */ /* On some strange systems still no definition of NULL is found. Sigh! */

View File

@ -17,12 +17,12 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#ifndef dl_machine_h
#define dl_machine_h
#define ELF_MACHINE_NAME "m68k" #define ELF_MACHINE_NAME "m68k"
#include <assert.h> #include <assert.h>
#include <string.h>
#include <link.h>
/* Return nonzero iff E_MACHINE is compatible with the running host. */ /* Return nonzero iff E_MACHINE is compatible with the running host. */
static inline int static inline int
@ -68,109 +68,6 @@ elf_machine_load_address (void)
((dynamic_info)[DT_RELA]->d_un.d_ptr += sizeof (Elf32_Rela), \ ((dynamic_info)[DT_RELA]->d_un.d_ptr += sizeof (Elf32_Rela), \
(dynamic_info)[DT_RELASZ]->d_un.d_val -= sizeof (Elf32_Rela)) (dynamic_info)[DT_RELASZ]->d_un.d_val -= sizeof (Elf32_Rela))
/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
MAP is the object containing the reloc. */
static inline void
elf_machine_rela (struct link_map *map,
const Elf32_Rela *reloc, const Elf32_Sym *sym,
Elf32_Addr (*resolve) (const Elf32_Sym **ref,
Elf32_Addr reloc_addr,
int noplt))
{
Elf32_Addr *const reloc_addr = (void *) (map->l_addr + reloc->r_offset);
Elf32_Addr loadbase;
#ifdef RTLD_BOOTSTRAP
#define RESOLVE(noplt) map->l_addr
#else
#define RESOLVE(noplt) (*resolve) (&sym, (Elf32_Addr) reloc_addr, noplt)
#endif
switch (ELF32_R_TYPE (reloc->r_info))
{
case R_68K_COPY:
loadbase = RESOLVE (0);
memcpy (reloc_addr, (void *) (loadbase + sym->st_value), sym->st_size);
break;
case R_68K_GLOB_DAT:
loadbase = RESOLVE (0);
*reloc_addr = sym ? (loadbase + sym->st_value) : 0;
break;
case R_68K_JMP_SLOT:
loadbase = RESOLVE (1);
*reloc_addr = sym ? (loadbase + sym->st_value) : 0;
break;
case R_68K_8:
loadbase = RESOLVE (0);
*(char *) reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
+ reloc->r_addend);
break;
case R_68K_16:
loadbase = RESOLVE (0);
*(short *) reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
+ reloc->r_addend);
break;
case R_68K_32:
loadbase = RESOLVE (0);
*reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
+ reloc->r_addend);
break;
case R_68K_RELATIVE:
*reloc_addr = map->l_addr + reloc->r_addend;
break;
case R_68K_PC8:
loadbase = RESOLVE (0);
*(char *) reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
+ reloc->r_addend
- (Elf32_Addr) reloc_addr);
break;
case R_68K_PC16:
loadbase = RESOLVE (0);
*(short *) reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
+ reloc->r_addend
- (Elf32_Addr) reloc_addr);
break;
case R_68K_PC32:
loadbase = RESOLVE (0);
*reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
+ reloc->r_addend
- (Elf32_Addr) reloc_addr);
break;
case R_68K_NONE: /* Alright, Wilbur. */
break;
default:
assert (! "unexpected dynamic reloc type");
break;
}
#undef RESOLVE
}
static inline void
elf_machine_lazy_rel (struct link_map *map, const Elf32_Rela *reloc)
{
Elf32_Addr *const reloc_addr = (void *) (map->l_addr + reloc->r_offset);
switch (ELF32_R_TYPE (reloc->r_info))
{
case R_68K_NONE:
break;
case R_68K_JMP_SLOT:
*reloc_addr += map->l_addr;
break;
default:
assert (! "unexpected PLT reloc type");
break;
}
}
/* Nonzero iff TYPE describes relocation of a PLT entry, so
PLT entries should not be allowed to define the value. */
#define elf_machine_pltrel_p(type) ((type) == R_68K_JMP_SLOT)
/* The m68k never uses Elf32_Rel relocations. */
#define ELF_MACHINE_NO_REL 1
/* Set up the loaded object described by L so its unrelocated PLT /* 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. */ entries will jump to the on-demand fixup code in dl-runtime.c. */
@ -283,3 +180,98 @@ _dl_start_user:
move.l %sp, %fp move.l %sp, %fp
| Jump to the user's entry point. | Jump to the user's entry point.
jmp (%a4)"); jmp (%a4)");
/* Nonzero iff TYPE describes relocation of a PLT entry, so
PLT entries should not be allowed to define the value. */
#define elf_machine_pltrel_p(type) ((type) == R_68K_JMP_SLOT)
/* The m68k never uses Elf32_Rel relocations. */
#define ELF_MACHINE_NO_REL 1
#endif /* !dl_machine_h */
#ifdef RESOLVE
/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
MAP is the object containing the reloc. */
static inline void
elf_machine_rela (struct link_map *map,
const Elf32_Rela *reloc, const Elf32_Sym *sym)
{
Elf32_Addr *const reloc_addr = (void *) (map->l_addr + reloc->r_offset);
Elf32_Addr loadbase;
switch (ELF32_R_TYPE (reloc->r_info))
{
case R_68K_COPY:
loadbase = RESOLVE (&sym, (Elf32_Addr) reloc_addr, 0);
memcpy (reloc_addr, (void *) (loadbase + sym->st_value), sym->st_size);
break;
case R_68K_GLOB_DAT:
loadbase = RESOLVE (&sym, (Elf32_Addr) reloc_addr, 0);
*reloc_addr = sym ? (loadbase + sym->st_value) : 0;
break;
case R_68K_JMP_SLOT:
loadbase = RESOLVE (&sym, (Elf32_Addr) reloc_addr, 1);
*reloc_addr = sym ? (loadbase + sym->st_value) : 0;
break;
case R_68K_8:
loadbase = RESOLVE (&sym, (Elf32_Addr) reloc_addr, 0);
*(char *) reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
+ reloc->r_addend);
break;
case R_68K_16:
loadbase = RESOLVE (&sym, (Elf32_Addr) reloc_addr, 0);
*(short *) reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
+ reloc->r_addend);
break;
case R_68K_32:
loadbase = RESOLVE (&sym, (Elf32_Addr) reloc_addr, 0);
*reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
+ reloc->r_addend);
break;
case R_68K_RELATIVE:
*reloc_addr = map->l_addr + reloc->r_addend;
break;
case R_68K_PC8:
loadbase = RESOLVE (&sym, (Elf32_Addr) reloc_addr, 0);
*(char *) reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
+ reloc->r_addend - (Elf32_Addr) reloc_addr);
break;
case R_68K_PC16:
loadbase = RESOLVE (&sym, (Elf32_Addr) reloc_addr, 0);
*(short *) reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
+ reloc->r_addend - (Elf32_Addr) reloc_addr);
break;
case R_68K_PC32:
loadbase = RESOLVE (&sym, (Elf32_Addr) reloc_addr, 0);
*reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
+ reloc->r_addend - (Elf32_Addr) reloc_addr);
break;
case R_68K_NONE: /* Alright, Wilbur. */
break;
default:
assert (! "unexpected dynamic reloc type");
break;
}
#undef RESOLVE
}
static inline void
elf_machine_lazy_rel (struct link_map *map, const Elf32_Rela *reloc)
{
Elf32_Addr *const reloc_addr = (void *) (map->l_addr + reloc->r_offset);
switch (ELF32_R_TYPE (reloc->r_info))
{
case R_68K_JMP_SLOT:
*reloc_addr += map->l_addr;
break;
default:
assert (! "unexpected PLT reloc type");
break;
}
}
#endif /* RESOLVE */

View File

@ -2,7 +2,7 @@
accept - accept 3 accept accept - accept 3 accept
bind - bind 3 bind bind - bind 3 bind
__connect - connect 3 connect connect connect - connect 3 __connect connect
gethostid - gethostid 0 gethostid gethostid - gethostid 0 gethostid
gethostname - gethostname 2 __gethostname gethostname gethostname - gethostname 2 __gethostname gethostname
getpeername - getpeername 3 getpeername getpeername - getpeername 3 getpeername
@ -12,7 +12,7 @@ listen - listen 2 listen
recv - recv 4 recv recv - recv 4 recv
recvfrom - recvfrom 6 recvfrom recvfrom - recvfrom 6 recvfrom
recvmsg - recvmsg 3 recvmsg recvmsg - recvmsg 3 recvmsg
__send - send 4 send send send - send 4 __send send
sendmsg - sendmsg 3 sendmsg sendmsg - sendmsg 3 sendmsg
sendto - sendto 6 sendto sendto - sendto 6 sendto
sethostid - sethostid 1 sethostid sethostid - sethostid 1 sethostid