mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-21 20:40:05 +00:00
* sysdeps/powerpc/powerpc64/dl-machine.h (elf_machine_fixup_plt):
Don't use weak_extern for dl_rtld_map. Instead check only if [SHARED]. (elf_machine_rela): Clean up. * sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_rela): Clean up. PowerPC TLS support contributed by Paul Mackerras <paulus@samba.org>. * sysdeps/powerpc/powerpc32/elf/configure.in: New file. * sysdeps/powerpc/powerpc32/elf/configure: New generated file. * elf/tls-macros.h [__powerpc__ && !__powerpc64__] (TLS_LE, TLS_IE, TLS_LD, TLS_GD): Define them. * sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_rela): Support new relocs for TLS. * sysdeps/powerpc/dl-tls.h (TLS_TP_OFFSET, TLS_DTV_OFFSET): Move these macros out of [SHARED]. (TLS_TPREL_VALUE, TLS_DTPREL_VALUE): New macros. * elf/elf.h: Define R_PPC_* relocs for TLS support. Clean up R_PPC64_* macro definition comments.
This commit is contained in:
parent
3093b1c70c
commit
bb0ddc2f1e
23
ChangeLog
23
ChangeLog
@ -1,4 +1,25 @@
|
||||
2003-03-01 Roland McGrath <roland@redhat.com>
|
||||
2003-03-02 Roland McGrath <roland@redhat.com>
|
||||
|
||||
* sysdeps/powerpc/powerpc64/dl-machine.h (elf_machine_fixup_plt):
|
||||
Don't use weak_extern for dl_rtld_map. Instead check only if [SHARED].
|
||||
(elf_machine_rela): Clean up.
|
||||
|
||||
* sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_rela): Clean up.
|
||||
|
||||
PowerPC TLS support contributed by Paul Mackerras <paulus@samba.org>.
|
||||
* sysdeps/powerpc/powerpc32/elf/configure.in: New file.
|
||||
* sysdeps/powerpc/powerpc32/elf/configure: New generated file.
|
||||
* elf/tls-macros.h [__powerpc__ && !__powerpc64__]
|
||||
(TLS_LE, TLS_IE, TLS_LD, TLS_GD): Define them.
|
||||
* sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_rela): Support
|
||||
new relocs for TLS.
|
||||
|
||||
* sysdeps/powerpc/dl-tls.h (TLS_TP_OFFSET, TLS_DTV_OFFSET): Move these
|
||||
macros out of [SHARED].
|
||||
(TLS_TPREL_VALUE, TLS_DTPREL_VALUE): New macros.
|
||||
|
||||
* elf/elf.h: Define R_PPC_* relocs for TLS support.
|
||||
Clean up R_PPC64_* macro definition comments.
|
||||
|
||||
* configure.in: In "running configure fragment for" message,
|
||||
omit $srcdir from the name if we prepended it.
|
||||
|
266
elf/elf.h
266
elf/elf.h
@ -1,5 +1,5 @@
|
||||
/* This file defines standard ELF types, structures, and macros.
|
||||
Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-1999,2000,2001,2002,2003 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
|
||||
@ -1881,122 +1881,39 @@ typedef Elf32_Addr Elf32_Conflict;
|
||||
#define R_PPC_SECTOFF_LO 34
|
||||
#define R_PPC_SECTOFF_HI 35
|
||||
#define R_PPC_SECTOFF_HA 36
|
||||
|
||||
/* PowerPC relocations defined for the TLS access ABI. */
|
||||
#define R_PPC_TLS 67 /* none (sym+add)@tls */
|
||||
#define R_PPC_DTPMOD32 68 /* word32 (sym+add)@dtpmod */
|
||||
#define R_PPC_TPREL16 69 /* half16* (sym+add)@tprel */
|
||||
#define R_PPC_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */
|
||||
#define R_PPC_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */
|
||||
#define R_PPC_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */
|
||||
#define R_PPC_TPREL32 73 /* word32 (sym+add)@tprel */
|
||||
#define R_PPC_DTPREL16 74 /* half16* (sym+add)@dtprel */
|
||||
#define R_PPC_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */
|
||||
#define R_PPC_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */
|
||||
#define R_PPC_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */
|
||||
#define R_PPC_DTPREL32 78 /* word32 (sym+add)@dtprel */
|
||||
#define R_PPC_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */
|
||||
#define R_PPC_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */
|
||||
#define R_PPC_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */
|
||||
#define R_PPC_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */
|
||||
#define R_PPC_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */
|
||||
#define R_PPC_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */
|
||||
#define R_PPC_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */
|
||||
#define R_PPC_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */
|
||||
#define R_PPC_GOT_TPREL16 87 /* half16* (sym+add)@got@tprel */
|
||||
#define R_PPC_GOT_TPREL16_LO 88 /* half16 (sym+add)@got@tprel@l */
|
||||
#define R_PPC_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */
|
||||
#define R_PPC_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */
|
||||
#define R_PPC_GOT_DTPREL16 91 /* half16* (sym+add)@got@dtprel */
|
||||
#define R_PPC_GOT_DTPREL16_LO 92 /* half16* (sym+add)@got@dtprel@l */
|
||||
#define R_PPC_GOT_DTPREL16_HI 93 /* half16* (sym+add)@got@dtprel@h */
|
||||
#define R_PPC_GOT_DTPREL16_HA 94 /* half16* (sym+add)@got@dtprel@ha */
|
||||
|
||||
/* Keep this the last entry. */
|
||||
#define R_PPC_NUM 37
|
||||
|
||||
/* PowerPC64 relocations defined by the ABIs */
|
||||
#define R_PPC64_NONE R_PPC_NONE
|
||||
#define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address. */
|
||||
#define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned. */
|
||||
#define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address. */
|
||||
#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of abs. address. */
|
||||
#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of abs. address. */
|
||||
#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */
|
||||
#define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned. */
|
||||
#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN
|
||||
#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN
|
||||
#define R_PPC64_REL24 R_PPC_REL24 /* PC relative 26 bit, word aligned. */
|
||||
#define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit. */
|
||||
#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN
|
||||
#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN
|
||||
#define R_PPC64_GOT16 R_PPC_GOT16
|
||||
#define R_PPC64_GOT16_LO R_PPC_GOT16_LO
|
||||
#define R_PPC64_GOT16_HI R_PPC_GOT16_HI
|
||||
#define R_PPC64_GOT16_HA R_PPC_GOT16_HA
|
||||
|
||||
#define R_PPC64_COPY R_PPC_COPY
|
||||
#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT
|
||||
#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT
|
||||
#define R_PPC64_RELATIVE R_PPC_RELATIVE
|
||||
|
||||
#define R_PPC64_UADDR32 R_PPC_UADDR32
|
||||
#define R_PPC64_UADDR16 R_PPC_UADDR16
|
||||
#define R_PPC64_REL32 R_PPC_REL32
|
||||
#define R_PPC64_PLT32 R_PPC_PLT32
|
||||
#define R_PPC64_PLTREL32 R_PPC_PLTREL32
|
||||
#define R_PPC64_PLT16_LO R_PPC_PLT16_LO
|
||||
#define R_PPC64_PLT16_HI R_PPC_PLT16_HI
|
||||
#define R_PPC64_PLT16_HA R_PPC_PLT16_HA
|
||||
|
||||
#define R_PPC64_SECTOFF R_PPC_SECTOFF
|
||||
#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO
|
||||
#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI
|
||||
#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA
|
||||
#define R_PPC64_ADDR30 37 /* word30 (S + A - P) >> 2. */
|
||||
#define R_PPC64_ADDR64 38 /* doubleword64 S + A. */
|
||||
#define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A). */
|
||||
#define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A). */
|
||||
#define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A). */
|
||||
#define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A). */
|
||||
#define R_PPC64_UADDR64 43 /* doubleword64 S + A. */
|
||||
#define R_PPC64_REL64 44 /* doubleword64 S + A - P. */
|
||||
#define R_PPC64_PLT64 45 /* doubleword64 L + A. */
|
||||
#define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P. */
|
||||
#define R_PPC64_TOC16 47 /* half16* S + A - .TOC. */
|
||||
#define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.). */
|
||||
#define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.). */
|
||||
#define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.). */
|
||||
#define R_PPC64_TOC 51 /* doubleword64 .TOC. */
|
||||
#define R_PPC64_PLTGOT16 52 /* half16* M + A. */
|
||||
#define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A). */
|
||||
#define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A). */
|
||||
#define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A). */
|
||||
|
||||
#define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) >> 2. */
|
||||
#define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) >> 2. */
|
||||
#define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) >> 2. */
|
||||
#define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) >> 2. */
|
||||
#define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) >> 2. */
|
||||
#define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) >> 2. */
|
||||
#define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) >> 2. */
|
||||
#define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) >> 2. */
|
||||
#define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) >> 2. */
|
||||
#define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) >> 2. */
|
||||
#define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) >> 2. */
|
||||
|
||||
/* PowerPC64 relocations defined for the TLS access ABI. */
|
||||
#define R_PPC64_TLS 67 /* none (sym+add)@tls. */
|
||||
#define R_PPC64_DTPMOD64 68 /* doubleword64 (sym+add)@dtpmod. */
|
||||
#define R_PPC64_TPREL16 69 /* half16* (sym+add)@tprel. */
|
||||
#define R_PPC64_TPREL16_LO 60 /* half16 (sym+add)@tprel@l. */
|
||||
#define R_PPC64_TPREL16_HI 71 /* half16 (sym+add)@tprel@h. */
|
||||
#define R_PPC64_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha. */
|
||||
#define R_PPC64_TPREL64 73 /* doubleword64 (sym+add)@tprel. */
|
||||
#define R_PPC64_DTPREL16 74 /* half16* (sym+add)@dtprel. */
|
||||
#define R_PPC64_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l. */
|
||||
#define R_PPC64_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h. */
|
||||
#define R_PPC64_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha. */
|
||||
#define R_PPC64_DTPREL64 78 /* doubleword64 (sym+add)@dtprel. */
|
||||
#define R_PPC64_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd. */
|
||||
#define R_PPC64_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l. */
|
||||
#define R_PPC64_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h. */
|
||||
#define R_PPC64_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha. */
|
||||
#define R_PPC64_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld. */
|
||||
#define R_PPC64_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l. */
|
||||
#define R_PPC64_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h. */
|
||||
#define R_PPC64_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha. */
|
||||
#define R_PPC64_GOT_TPREL16_DS 87 /* half16ds* (sym+add)@got@tprel. */
|
||||
#define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l. */
|
||||
#define R_PPC64_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h. */
|
||||
#define R_PPC64_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha. */
|
||||
#define R_PPC64_GOT_DTPREL16_DS 91 /* half16ds* (sym+add)@got@dtprel. */
|
||||
#define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l. */
|
||||
#define R_PPC64_GOT_DTPREL16_HI 93 /* half16 (sym+add)@got@dtprel@h. */
|
||||
#define R_PPC64_GOT_DTPREL16_HA 94 /* half16 (sym+add)@got@dtprel@ha. */
|
||||
#define R_PPC64_TPREL16_DS 95 /* half16ds* (sym+add)@tprel. */
|
||||
#define R_PPC64_TPREL16_LO_DS 96 /* half16ds (sym+add)@tprel@l. */
|
||||
#define R_PPC64_TPREL16_HIGHER 97 /* half16 (sym+add)@tprel@higher. */
|
||||
#define R_PPC64_TPREL16_HIGHERA 98 /* half16 (sym+add)@tprel@highera. */
|
||||
#define R_PPC64_TPREL16_HIGHEST 99 /* half16 (sym+add)@tprel@highest. */
|
||||
#define R_PPC64_TPREL16_HIGHESTA 100 /* half16 (sym+add)@tprel@highesta. */
|
||||
#define R_PPC64_DTPREL16_DS 101 /* half16ds* (sym+add)@dtprel. */
|
||||
#define R_PPC64_DTPREL16_LO_DS 102 /* half16ds (sym+add)@dtprel@l. */
|
||||
#define R_PPC64_DTPREL16_HIGHER 103 /* half16 (sym+add)@dtprel@higher. */
|
||||
#define R_PPC64_DTPREL16_HIGHERA 104 /* half16 (sym+add)@dtprel@highera. */
|
||||
#define R_PPC64_DTPREL16_HIGHEST 105 /* half16 (sym+add)@dtprel@highest. */
|
||||
#define R_PPC64_DTPREL16_HIGHESTA 106 /* half16 (sym+add)@dtprel@highesta. */
|
||||
/* Keep this the last entry. */
|
||||
#define R_PPC64_NUM 107
|
||||
#define R_PPC_NUM 95
|
||||
|
||||
/* The remaining relocs are from the Embedded ELF ABI, and are not
|
||||
in the SVR4 ELF ABI. */
|
||||
@ -2029,10 +1946,127 @@ typedef Elf32_Addr Elf32_Conflict;
|
||||
that may still be in object files. */
|
||||
#define R_PPC_TOC16 255
|
||||
|
||||
|
||||
/* PowerPC64 relocations defined by the ABIs */
|
||||
#define R_PPC64_NONE R_PPC_NONE
|
||||
#define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address */
|
||||
#define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned */
|
||||
#define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address */
|
||||
#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of address */
|
||||
#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of address. */
|
||||
#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */
|
||||
#define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned */
|
||||
#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN
|
||||
#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN
|
||||
#define R_PPC64_REL24 R_PPC_REL24 /* PC-rel. 26 bit, word aligned */
|
||||
#define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit */
|
||||
#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN
|
||||
#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN
|
||||
#define R_PPC64_GOT16 R_PPC_GOT16
|
||||
#define R_PPC64_GOT16_LO R_PPC_GOT16_LO
|
||||
#define R_PPC64_GOT16_HI R_PPC_GOT16_HI
|
||||
#define R_PPC64_GOT16_HA R_PPC_GOT16_HA
|
||||
|
||||
#define R_PPC64_COPY R_PPC_COPY
|
||||
#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT
|
||||
#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT
|
||||
#define R_PPC64_RELATIVE R_PPC_RELATIVE
|
||||
|
||||
#define R_PPC64_UADDR32 R_PPC_UADDR32
|
||||
#define R_PPC64_UADDR16 R_PPC_UADDR16
|
||||
#define R_PPC64_REL32 R_PPC_REL32
|
||||
#define R_PPC64_PLT32 R_PPC_PLT32
|
||||
#define R_PPC64_PLTREL32 R_PPC_PLTREL32
|
||||
#define R_PPC64_PLT16_LO R_PPC_PLT16_LO
|
||||
#define R_PPC64_PLT16_HI R_PPC_PLT16_HI
|
||||
#define R_PPC64_PLT16_HA R_PPC_PLT16_HA
|
||||
|
||||
#define R_PPC64_SECTOFF R_PPC_SECTOFF
|
||||
#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO
|
||||
#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI
|
||||
#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA
|
||||
#define R_PPC64_ADDR30 37 /* word30 (S + A - P) >> 2 */
|
||||
#define R_PPC64_ADDR64 38 /* doubleword64 S + A */
|
||||
#define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A) */
|
||||
#define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A) */
|
||||
#define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A) */
|
||||
#define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A) */
|
||||
#define R_PPC64_UADDR64 43 /* doubleword64 S + A */
|
||||
#define R_PPC64_REL64 44 /* doubleword64 S + A - P */
|
||||
#define R_PPC64_PLT64 45 /* doubleword64 L + A */
|
||||
#define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P */
|
||||
#define R_PPC64_TOC16 47 /* half16* S + A - .TOC */
|
||||
#define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.) */
|
||||
#define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.) */
|
||||
#define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.) */
|
||||
#define R_PPC64_TOC 51 /* doubleword64 .TOC */
|
||||
#define R_PPC64_PLTGOT16 52 /* half16* M + A */
|
||||
#define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A) */
|
||||
#define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A) */
|
||||
#define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A) */
|
||||
|
||||
#define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) >> 2 */
|
||||
#define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) >> 2 */
|
||||
#define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) >> 2 */
|
||||
#define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) >> 2 */
|
||||
#define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) >> 2 */
|
||||
#define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) >> 2 */
|
||||
#define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) >> 2 */
|
||||
#define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) >> 2 */
|
||||
#define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) >> 2 */
|
||||
#define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) >> 2 */
|
||||
#define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) >> 2 */
|
||||
|
||||
/* PowerPC64 relocations defined for the TLS access ABI. */
|
||||
#define R_PPC64_TLS 67 /* none (sym+add)@tls */
|
||||
#define R_PPC64_DTPMOD64 68 /* doubleword64 (sym+add)@dtpmod */
|
||||
#define R_PPC64_TPREL16 69 /* half16* (sym+add)@tprel */
|
||||
#define R_PPC64_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */
|
||||
#define R_PPC64_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */
|
||||
#define R_PPC64_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */
|
||||
#define R_PPC64_TPREL64 73 /* doubleword64 (sym+add)@tprel */
|
||||
#define R_PPC64_DTPREL16 74 /* half16* (sym+add)@dtprel */
|
||||
#define R_PPC64_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */
|
||||
#define R_PPC64_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */
|
||||
#define R_PPC64_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */
|
||||
#define R_PPC64_DTPREL64 78 /* doubleword64 (sym+add)@dtprel */
|
||||
#define R_PPC64_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */
|
||||
#define R_PPC64_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */
|
||||
#define R_PPC64_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */
|
||||
#define R_PPC64_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */
|
||||
#define R_PPC64_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */
|
||||
#define R_PPC64_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */
|
||||
#define R_PPC64_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */
|
||||
#define R_PPC64_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */
|
||||
#define R_PPC64_GOT_TPREL16_DS 87 /* half16ds* (sym+add)@got@tprel */
|
||||
#define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l */
|
||||
#define R_PPC64_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */
|
||||
#define R_PPC64_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */
|
||||
#define R_PPC64_GOT_DTPREL16_DS 91 /* half16ds* (sym+add)@got@dtprel */
|
||||
#define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l */
|
||||
#define R_PPC64_GOT_DTPREL16_HI 93 /* half16 (sym+add)@got@dtprel@h */
|
||||
#define R_PPC64_GOT_DTPREL16_HA 94 /* half16 (sym+add)@got@dtprel@ha */
|
||||
#define R_PPC64_TPREL16_DS 95 /* half16ds* (sym+add)@tprel */
|
||||
#define R_PPC64_TPREL16_LO_DS 96 /* half16ds (sym+add)@tprel@l */
|
||||
#define R_PPC64_TPREL16_HIGHER 97 /* half16 (sym+add)@tprel@higher */
|
||||
#define R_PPC64_TPREL16_HIGHERA 98 /* half16 (sym+add)@tprel@highera */
|
||||
#define R_PPC64_TPREL16_HIGHEST 99 /* half16 (sym+add)@tprel@highest */
|
||||
#define R_PPC64_TPREL16_HIGHESTA 100 /* half16 (sym+add)@tprel@highesta */
|
||||
#define R_PPC64_DTPREL16_DS 101 /* half16ds* (sym+add)@dtprel */
|
||||
#define R_PPC64_DTPREL16_LO_DS 102 /* half16ds (sym+add)@dtprel@l */
|
||||
#define R_PPC64_DTPREL16_HIGHER 103 /* half16 (sym+add)@dtprel@higher */
|
||||
#define R_PPC64_DTPREL16_HIGHERA 104 /* half16 (sym+add)@dtprel@highera */
|
||||
#define R_PPC64_DTPREL16_HIGHEST 105 /* half16 (sym+add)@dtprel@highest */
|
||||
#define R_PPC64_DTPREL16_HIGHESTA 106 /* half16 (sym+add)@dtprel@highesta */
|
||||
|
||||
/* Keep this the last entry. */
|
||||
#define R_PPC64_NUM 107
|
||||
|
||||
/* PowerPC64 specific values for the Dyn d_tag field. */
|
||||
#define DT_PPC64_GLINK (DT_LOPROC + 0)
|
||||
#define DT_PPC64_NUM 1
|
||||
|
||||
|
||||
/* ARM specific declarations */
|
||||
|
||||
/* Processor specific flags for the ELF header e_flags field. */
|
||||
|
@ -623,6 +623,53 @@ register void *__gp __asm__("$29");
|
||||
(int *) (__builtin_thread_pointer() + __offset); })
|
||||
# endif
|
||||
|
||||
#elif defined __powerpc__ && !defined __powerpc64__
|
||||
|
||||
# define __TLS_CALL_CLOBBERS \
|
||||
"0", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", \
|
||||
"lr", "ctr", "cr0", "cr1", "cr5", "cr6", "cr7"
|
||||
|
||||
/* PowerPC32 Local Exec TLS access. */
|
||||
# define TLS_LE(x) \
|
||||
({ int *__result; \
|
||||
asm ("addi %0,2," #x "@tprel" \
|
||||
: "=r" (__result)); \
|
||||
__result; })
|
||||
|
||||
/* PowerPC32 Initial Exec TLS access. */
|
||||
# define TLS_IE(x) \
|
||||
({ int *__result; \
|
||||
asm ("bl _GLOBAL_OFFSET_TABLE_@local-4\n\t" \
|
||||
"mflr %0\n\t" \
|
||||
"lwz %0," #x "@got@tprel(%0)\n\t" \
|
||||
"add %0,%0," #x "@tls" \
|
||||
: "=b" (__result) : \
|
||||
: "lr"); \
|
||||
__result; })
|
||||
|
||||
/* PowerPC32 Local Dynamic TLS access. */
|
||||
# define TLS_LD(x) \
|
||||
({ int *__result; \
|
||||
asm ("bl _GLOBAL_OFFSET_TABLE_@local-4\n\t" \
|
||||
"mflr 3\n\t" \
|
||||
"addi 3,3," #x "@got@tlsld\n\t" \
|
||||
"bl __tls_get_addr@plt\n\t" \
|
||||
"addi %0,3," #x "@dtprel" \
|
||||
: "=r" (__result) : \
|
||||
: __TLS_CALL_CLOBBERS); \
|
||||
__result; })
|
||||
|
||||
/* PowerPC32 General Dynamic TLS access. */
|
||||
# define TLS_GD(x) \
|
||||
({ register int *__result __asm__ ("r3"); \
|
||||
asm ("bl _GLOBAL_OFFSET_TABLE_@local-4\n\t" \
|
||||
"mflr 3\n\t" \
|
||||
"addi 3,3," #x "@got@tlsgd\n\t" \
|
||||
"bl __tls_get_addr@plt" \
|
||||
: : \
|
||||
: __TLS_CALL_CLOBBERS); \
|
||||
__result; })
|
||||
|
||||
#elif defined __powerpc__ && defined __powerpc64__
|
||||
|
||||
/* PowerPC64 Local Exec TLS access. */
|
||||
|
@ -1,4 +1,32 @@
|
||||
2003-02-27 Roland McGrath <roland@redhat.com>
|
||||
2003-03-01 Roland McGrath <roland@redhat.com>
|
||||
|
||||
* sysdeps/powerpc/powerpc64/pt-machine.h
|
||||
(THREAD_GETMEM, THREAD_GETMEM_NC, THREAD_SETMEM, THREAD_SETMEM_NC):
|
||||
New macros.
|
||||
* sysdeps/powerpc/tls.h: Don't define those here.
|
||||
|
||||
* sysdeps/powerpc/tls.h [! USE_TLS && !__powerpc64__]: Define
|
||||
tcbhead_t with multiple_threads member.
|
||||
[USE_TLS] (tcbhead_t): Define minimal one-word version.
|
||||
[USE_TLS && !__powerpc64__] (TLS_MULTIPLE_THREADS_IN_TCB): Define.
|
||||
* sysdeps/powerpc/tcb-offsets.sym [USE_TLS]: Use tls.h macros to
|
||||
derive thread register offset of p_multiple_threads member.
|
||||
|
||||
* descr.h (struct _pthread_descr_struct) [!USE_TLS || !TLS_DTV_AT_TP]:
|
||||
Conditionalize p_header member on this.
|
||||
[TLS_MULTIPLE_THREADS_IN_TCB]: Add p_multiple_threads alternatively.
|
||||
* sysdeps/ia64/tls.h [USE_TLS] (TLS_MULTIPLE_THREADS_IN_TCB): Define.
|
||||
* sysdeps/sh/tls.h: Likewise.
|
||||
* sysdeps/ia64/tcb-offsets.sym [USE_TLS]: Use p_multiple_threads.
|
||||
* sysdeps/sh/tcb-offsets.sym: Likewise.
|
||||
* sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
|
||||
(SINGLE_THREAD_P): Likewise.
|
||||
* sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h
|
||||
(SINGLE_THREAD_P): Likewise.
|
||||
* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
|
||||
(SINGLE_THREAD_P): Likewise.
|
||||
* pthread.c (__pthread_initialize_manager): Likewise.
|
||||
* manager.c (pthread_handle_create): Likewise.
|
||||
|
||||
* sysdeps/powerpc/tls.h [HAVE_TLS_SUPPORT]: Define USE_TLS and all
|
||||
related macros.
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <hp-timing.h>
|
||||
#include <tls.h>
|
||||
|
||||
/* Fast thread-specific data internal to libc. */
|
||||
enum __libc_tsd_key_t { _LIBC_TSD_KEY_MALLOC = 0,
|
||||
@ -106,11 +107,14 @@ typedef struct _pthread_rwlock_info {
|
||||
|
||||
union dtv;
|
||||
|
||||
|
||||
struct _pthread_descr_struct {
|
||||
/* XXX Remove this union for IA-64 style TLS module */
|
||||
union {
|
||||
struct {
|
||||
struct _pthread_descr_struct
|
||||
{
|
||||
#if !defined USE_TLS || !TLS_DTV_AT_TP
|
||||
/* This overlaps tcbhead_t (see tls.h), as used for TLS without threads. */
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
void *tcb; /* Pointer to the TCB. This is not always
|
||||
the address of this thread descriptor. */
|
||||
union dtv *dtvp;
|
||||
@ -122,6 +126,11 @@ struct _pthread_descr_struct {
|
||||
} data;
|
||||
void *__padding[16];
|
||||
} p_header;
|
||||
# define p_multiple_threads p_header.data.multiple_threads
|
||||
#elif TLS_MULTIPLE_THREADS_IN_TCB
|
||||
int p_multiple_threads;
|
||||
#endif
|
||||
|
||||
pthread_descr p_nextlive, p_prevlive;
|
||||
/* Double chaining of active threads */
|
||||
pthread_descr p_nextwaiting; /* Next element in the queue holding the thr */
|
||||
|
@ -638,13 +638,13 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
|
||||
new_thread_id = sseg + pthread_threads_counter;
|
||||
/* Initialize the thread descriptor. Elements which have to be
|
||||
initialized to zero already have this value. */
|
||||
#if defined USE_TLS && TLS_DTV_AT_TP
|
||||
new_thread->p_header.data.tcb = new_thread + 1;
|
||||
#else
|
||||
#if !defined USE_TLS || !TLS_DTV_AT_TP
|
||||
new_thread->p_header.data.tcb = new_thread;
|
||||
#endif
|
||||
new_thread->p_header.data.self = new_thread;
|
||||
new_thread->p_header.data.multiple_threads = 1;
|
||||
#endif
|
||||
#if TLS_MULTIPLE_THREADS_IN_TCB || !defined USE_TLS || !TLS_DTV_AT_TP
|
||||
new_thread->p_multiple_threads = 1;
|
||||
#endif
|
||||
new_thread->p_tid = new_thread_id;
|
||||
new_thread->p_lock = &(__pthread_handles[sseg].h_lock);
|
||||
new_thread->p_cancelstate = PTHREAD_CANCEL_ENABLE;
|
||||
|
@ -566,8 +566,10 @@ int __pthread_initialize_manager(void)
|
||||
#endif
|
||||
|
||||
__pthread_multiple_threads = 1;
|
||||
__pthread_main_thread->p_header.data.multiple_threads = 1;
|
||||
* __libc_multiple_threads_ptr = 1;
|
||||
#if TLS_MULTIPLE_THREADS_IN_TCB || !defined USE_TLS || !TLS_DTV_AT_TP
|
||||
__pthread_main_thread->p_multiple_threads = 1;
|
||||
#endif
|
||||
*__libc_multiple_threads_ptr = 1;
|
||||
|
||||
#ifndef HAVE_Z_NODELETE
|
||||
if (__builtin_expect (&__dso_handle != NULL, 1))
|
||||
@ -611,9 +613,13 @@ int __pthread_initialize_manager(void)
|
||||
__pthread_handles[1].h_descr = manager_thread = mgr;
|
||||
|
||||
/* Initialize the descriptor. */
|
||||
#if !defined USE_TLS || !TLS_DTV_AT_TP
|
||||
mgr->p_header.data.tcb = tcbp;
|
||||
mgr->p_header.data.self = mgr;
|
||||
mgr->p_header.data.multiple_threads = 1;
|
||||
#elif TLS_MULTIPLE_THREADS_IN_TCB
|
||||
mgr->p_multiple_threads = 1;
|
||||
#endif
|
||||
mgr->p_lock = &__pthread_handles[1].h_lock;
|
||||
# ifndef HAVE___THREAD
|
||||
mgr->p_errnop = &mgr->p_errno;
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
--
|
||||
#ifdef USE_TLS
|
||||
MULTIPLE_THREADS_OFFSET offsetof (struct _pthread_descr_struct, p_header.data.multiple_threads) - sizeof (struct _pthread_descr_struct)
|
||||
MULTIPLE_THREADS_OFFSET offsetof (struct _pthread_descr_struct, p_multiple_threads) - sizeof (struct _pthread_descr_struct)
|
||||
#else
|
||||
MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads)
|
||||
#endif
|
||||
|
@ -98,6 +98,8 @@ typedef struct
|
||||
# define INIT_THREAD_SELF(descr, nr) \
|
||||
(__thread_self = (struct _pthread_descr_struct *)(descr) + 1)
|
||||
|
||||
# define TLS_MULTIPLE_THREADS_IN_TCB 1
|
||||
|
||||
/* Get the thread descriptor definition. */
|
||||
# include <linuxthreads/descr.h>
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Machine-dependent pthreads configuration and inline functions.
|
||||
powerpc version.
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2003 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
|
||||
@ -57,6 +57,16 @@ register struct _pthread_descr_struct *__thread_self __asm__("r13");
|
||||
/* Initialize the thread-unique value. */
|
||||
#define INIT_THREAD_SELF(descr, nr) (__thread_self = (descr))
|
||||
|
||||
/* Access to data in the thread descriptor is easy. */
|
||||
#define THREAD_GETMEM(descr, member) \
|
||||
((void) (descr), THREAD_SELF->member)
|
||||
#define THREAD_GETMEM_NC(descr, member) \
|
||||
((void) (descr), THREAD_SELF->member)
|
||||
#define THREAD_SETMEM(descr, member, value) \
|
||||
((void) (descr), THREAD_SELF->member = (value))
|
||||
#define THREAD_SETMEM_NC(descr, member, value) \
|
||||
((void) (descr), THREAD_SELF->member = (value))
|
||||
|
||||
/* Compare-and-swap for semaphores. */
|
||||
/* note that test-and-set(x) is the same as !compare-and-swap(x, 0, 1) */
|
||||
|
||||
|
@ -1,4 +1,24 @@
|
||||
#include <sysdep.h>
|
||||
#include <tls.h>
|
||||
|
||||
MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads)
|
||||
--
|
||||
|
||||
-- This could go into powerpc32/ instead and conditionalize #include of it.
|
||||
#ifndef __powerpc64__
|
||||
|
||||
# ifdef USE_TLS
|
||||
|
||||
-- Abuse tls.h macros to derive offsets relative to the thread register.
|
||||
# undef __thread_register
|
||||
# define __thread_register ((void *) 0)
|
||||
# define thread_offsetof(mem) ((void *) &THREAD_SELF->p_##mem - (void *) 0)
|
||||
|
||||
# else
|
||||
|
||||
# define thread_offsetof(mem) offsetof (tcbhead_t, mem)
|
||||
|
||||
# endif
|
||||
|
||||
MULTIPLE_THREADS_OFFSET thread_offsetof (multiple_threads)
|
||||
|
||||
#endif
|
||||
|
@ -32,15 +32,6 @@ typedef union dtv
|
||||
void *pointer;
|
||||
} dtv_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void *tcb; /* Pointer to the TCB. Not necessary the
|
||||
thread descriptor used by libpthread. */
|
||||
dtv_t *dtv;
|
||||
void *self; /* Pointer to the thread descriptor. */
|
||||
int multiple_threads;
|
||||
} tcbhead_t;
|
||||
|
||||
#else /* __ASSEMBLER__ */
|
||||
# include <tcb-offsets.h>
|
||||
#endif /* __ASSEMBLER__ */
|
||||
@ -52,6 +43,14 @@ typedef struct
|
||||
|
||||
# ifndef __ASSEMBLER__
|
||||
|
||||
/* This layout is actually wholly private and not affected by the ABI.
|
||||
Nor does it overlap the pthread data structure, so we need nothing
|
||||
extra here at all. */
|
||||
typedef struct
|
||||
{
|
||||
dtv_t *dtv;
|
||||
} tcbhead_t;
|
||||
|
||||
/* This is the size of the initial TCB. */
|
||||
# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
|
||||
|
||||
@ -67,12 +66,12 @@ typedef struct
|
||||
/* This is the size we need before TCB. */
|
||||
# define TLS_PRE_TCB_SIZE sizeof (struct _pthread_descr_struct)
|
||||
|
||||
/* The following assumes that TP (R13) is points to the end of the
|
||||
/* The following assumes that TP (R2 or R13) is points to the end of the
|
||||
TCB + 0x7000 (per the ABI). This implies that TCB address is
|
||||
R13-(TLS_TCB_SIZE + 0x7000). As we define TLS_DTV_AT_TP we can
|
||||
TP-(TLS_TCB_SIZE + 0x7000). As we define TLS_DTV_AT_TP we can
|
||||
assume that the pthread_descr is allocated immediately ahead of the
|
||||
TCB. This implies that the pthread_descr address is
|
||||
R13-(TLS_PRE_TCB_SIZE + TLS_TCB_SIZE + 0x7000). */
|
||||
TP-(TLS_PRE_TCB_SIZE + TLS_TCB_SIZE + 0x7000). */
|
||||
# define TLS_TCB_OFFSET 0x7000
|
||||
|
||||
/* The DTV is allocated at the TP; the TCB is placed elsewhere. */
|
||||
@ -99,7 +98,7 @@ typedef struct
|
||||
special attention since 'errno' is not yet available and if the
|
||||
operation can cause a failure 'errno' must not be touched. */
|
||||
# define TLS_INIT_TP(TCBP, SECONDCALL) \
|
||||
(__thread_register = (void *) (TCBP) + TLS_TCB_OFFSET + TLS_TCB_SIZE, 0)
|
||||
(__thread_register = (void *) (TCBP) + TLS_TCB_OFFSET + TLS_TCB_SIZE, NULL)
|
||||
|
||||
/* Return the address of the dtv for the current thread. */
|
||||
# define THREAD_DTV() \
|
||||
@ -116,30 +115,36 @@ typedef struct
|
||||
(__thread_register = ((void *) (DESCR) \
|
||||
+ TLS_TCB_OFFSET + TLS_TCB_SIZE + TLS_PRE_TCB_SIZE))
|
||||
|
||||
/* Make sure we have the p_multiple_threads member in the thread structure.
|
||||
See below. */
|
||||
# ifndef __powerpc64__
|
||||
# define TLS_MULTIPLE_THREADS_IN_TCB 1
|
||||
# endif
|
||||
|
||||
/* Get the thread descriptor definition. */
|
||||
# include <linuxthreads/descr.h>
|
||||
|
||||
/* Generic bits of LinuxThreads may call these macros with
|
||||
DESCR set to NULL. We are expected to be able to reference
|
||||
the "current" value. */
|
||||
|
||||
# define THREAD_GETMEM(descr, member) \
|
||||
((void) sizeof (descr), THREAD_SELF->member)
|
||||
# define THREAD_SETMEM(descr, member, value) \
|
||||
((void) sizeof (descr), THREAD_SELF->member = (value))
|
||||
|
||||
#define THREAD_GETMEM_NC(descr, member) THREAD_GETMEM (descr, member)
|
||||
#define THREAD_SETMEM_NC(descr, member, value) \
|
||||
THREAD_SETMEM ((descr), member, (value))
|
||||
|
||||
# endif /* __ASSEMBLER__ */
|
||||
|
||||
#else /* Not HAVE_TLS_SUPPORT. */
|
||||
#elif !defined __ASSEMBLER__ && !defined __powerpc64__
|
||||
|
||||
/* This overlaps the start of the pthread_descr. On PPC32, system
|
||||
calls and such use this to find the multiple_threads flag and need
|
||||
to use the same offset relative to the thread register in both
|
||||
single-threaded and multi-threaded code. On PPC64, the global
|
||||
variable is always used, so single-threaded code without TLS
|
||||
never needs to initialize the thread register at all. */
|
||||
typedef struct
|
||||
{
|
||||
void *tcb; /* Never used. */
|
||||
dtv_t *dtv; /* Never used. */
|
||||
void *self; /* Used only if multithreaded, and rarely. */
|
||||
int multiple_threads; /* Only this member is really used. */
|
||||
} tcbhead_t;
|
||||
|
||||
#define NONTLS_INIT_TP \
|
||||
do { \
|
||||
static const tcbhead_t nontls_init_tp \
|
||||
= { .multiple_threads = 0 }; \
|
||||
static const tcbhead_t nontls_init_tp = { .multiple_threads = 0 }; \
|
||||
__thread_self = (__typeof (__thread_self)) &nontls_init_tp; \
|
||||
} while (0)
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
--
|
||||
#ifdef USE_TLS
|
||||
MULTIPLE_THREADS_OFFSET offsetof (struct _pthread_descr_struct, p_header.data.multiple_threads)
|
||||
MULTIPLE_THREADS_OFFSET offsetof (struct _pthread_descr_struct, p_multiple_threads)
|
||||
TLS_PRE_TCB_SIZE sizeof (struct _pthread_descr_struct)
|
||||
#else
|
||||
MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads)
|
||||
|
@ -112,6 +112,8 @@ typedef struct
|
||||
__asm __volatile ("ldc %0,gbr" : : "r" (__self + 1)); \
|
||||
0; })
|
||||
|
||||
# define TLS_MULTIPLE_THREADS_IN_TCB 1
|
||||
|
||||
/* Get the thread descriptor definition. This must be after the
|
||||
the definition of THREAD_SELF for TLS. */
|
||||
# include <linuxthreads/descr.h>
|
||||
|
@ -101,8 +101,7 @@ __syscall_error_##args: \
|
||||
|
||||
# ifndef __ASSEMBLER__
|
||||
# define SINGLE_THREAD_P \
|
||||
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
|
||||
p_header.data.multiple_threads) == 0, 1)
|
||||
__builtin_expect (THREAD_GETMEM (THREAD_SELF, p_multiple_threads) == 0, 1)
|
||||
# else
|
||||
# define SINGLE_THREAD_P \
|
||||
adds r14 = MULTIPLE_THREADS_OFFSET, r13 ;; ld4 r14 = [r14] ;; cmp4.ne p6, p7 = 0, r14
|
||||
|
@ -85,8 +85,7 @@
|
||||
|
||||
# ifndef __ASSEMBLER__
|
||||
# define SINGLE_THREAD_P \
|
||||
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
|
||||
p_header.data.multiple_threads) == 0, 1)
|
||||
__builtin_expect (THREAD_GETMEM (THREAD_SELF, p_multiple_threads) == 0, 1)
|
||||
# else
|
||||
# define SINGLE_THREAD_P \
|
||||
lwz 10,MULTIPLE_THREADS_OFFSET(2); \
|
||||
|
@ -121,8 +121,7 @@
|
||||
# ifndef __ASSEMBLER__
|
||||
# if defined FLOATING_STACKS && USE___THREAD && defined PIC
|
||||
# define SINGLE_THREAD_P \
|
||||
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
|
||||
p_header.data.multiple_threads) == 0, 1)
|
||||
__builtin_expect (THREAD_GETMEM (THREAD_SELF, p_multiple_threads) == 0, 1)
|
||||
# else
|
||||
extern int __local_multiple_threads attribute_hidden;
|
||||
# define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
|
||||
|
@ -1,3 +1,10 @@
|
||||
2003-02-27 Roland McGrath <roland@redhat.com>
|
||||
|
||||
* td_thr_tls_get_addr.c (td_thr_tls_get_addr): Handle TLS_DTV_AT_TP.
|
||||
|
||||
* td_ta_thr_iter.c (handle_descr) [!defined USE_TLS || !TLS_DTV_AT_TP]:
|
||||
Conditionalize p_header use on this.
|
||||
|
||||
2003-01-29 Roland McGrath <roland@redhat.com>
|
||||
|
||||
* td_ta_new.c (td_ta_new): Cap the `sizeof_descr' value read from the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Iterate over a process's threads.
|
||||
Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999,2000,2001,2002,2003 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
|
||||
|
||||
@ -40,7 +40,9 @@ handle_descr (const td_thragent_t *ta, td_thr_iter_f *callback,
|
||||
memset (&pds, '\0', sizeof (pds));
|
||||
|
||||
/* Empty thread descriptor the thread library would create. */
|
||||
#if !defined USE_TLS || !TLS_DTV_AT_TP
|
||||
pds.p_header.data.self = &pds;
|
||||
#endif
|
||||
pds.p_nextlive = pds.p_prevlive = &pds;
|
||||
pds.p_tid = PTHREAD_THREADS_MAX;
|
||||
/* The init code also sets up p_lock, p_errnop, p_herrnop, and
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Get address of thread local variable.
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002,2003 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 2002.
|
||||
|
||||
@ -18,8 +18,8 @@
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
|
||||
#include "link.h"
|
||||
#include <stddef.h>
|
||||
#include <link.h>
|
||||
#include "thread_dbP.h"
|
||||
|
||||
/* Value used for dtv entries for which the allocation is delayed. */
|
||||
@ -38,10 +38,17 @@ td_thr_tls_get_addr (const td_thrhandle_t *th __attribute__ ((unused)),
|
||||
|
||||
LOG ("td_thr_tls_get_addr");
|
||||
|
||||
psaddr_t dtvpp = th->th_unique;
|
||||
#if TLS_TCB_AT_TP
|
||||
dtvpp += offsetof (struct _pthread_descr_struct, p_header.data.dtvp);
|
||||
#elif TLS_DTV_AT_TP
|
||||
dtvpp += TLS_PRE_TCB_SIZE + offsetof (tcbhead_t, dtv);
|
||||
#else
|
||||
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined."
|
||||
#endif
|
||||
|
||||
/* Get the DTV pointer from the thread descriptor. */
|
||||
if (ps_pdread (th->th_ta_p->ph,
|
||||
&((struct _pthread_descr_struct *) th->th_unique)->p_header.data.dtvp,
|
||||
&dtvp, sizeof dtvp) != PS_OK)
|
||||
if (ps_pdread (th->th_ta_p->ph, dtvpp, &dtvp, sizeof dtvp) != PS_OK)
|
||||
return TD_ERR; /* XXX Other error value? */
|
||||
|
||||
/* Read the module ID from the link_map. */
|
||||
|
@ -23,6 +23,7 @@
|
||||
#define ELF_MACHINE_NAME "powerpc"
|
||||
|
||||
#include <assert.h>
|
||||
#include <dl-tls.h>
|
||||
|
||||
/* Return nonzero iff ELF header is compatible with the running host. */
|
||||
static inline int
|
||||
@ -275,11 +276,22 @@ __elf_preferred_address(struct link_map *loader, size_t maplength,
|
||||
/* We never want to use a PLT entry as the destination of a
|
||||
reloc, when what is being relocated is a branch. This is
|
||||
partly for efficiency, but mostly so we avoid loops. */
|
||||
#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD)
|
||||
#define elf_machine_type_class(type) \
|
||||
((((type) == R_PPC_JMP_SLOT \
|
||||
|| (type) == R_PPC_REL24 \
|
||||
|| (type) == R_PPC_DTPMOD32 \
|
||||
|| (type) == R_PPC_DTPREL32 \
|
||||
|| (type) == R_PPC_TPREL32 \
|
||||
|| (type) == R_PPC_ADDR24) * ELF_RTYPE_CLASS_PLT) \
|
||||
| (((type) == R_PPC_COPY) * ELF_RTYPE_CLASS_COPY))
|
||||
#else
|
||||
#define elf_machine_type_class(type) \
|
||||
((((type) == R_PPC_JMP_SLOT \
|
||||
|| (type) == R_PPC_REL24 \
|
||||
|| (type) == R_PPC_ADDR24) * ELF_RTYPE_CLASS_PLT) \
|
||||
| (((type) == R_PPC_COPY) * ELF_RTYPE_CLASS_COPY))
|
||||
#endif
|
||||
|
||||
/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
|
||||
#define ELF_MACHINE_JMP_SLOT R_PPC_JMP_SLOT
|
||||
@ -341,44 +353,29 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
|
||||
Elf32_Addr *const reloc_addr)
|
||||
{
|
||||
const Elf32_Sym *const refsym = sym;
|
||||
Elf32_Word finaladdr;
|
||||
const int rinfo = ELF32_R_TYPE (reloc->r_info);
|
||||
Elf32_Addr value;
|
||||
const int r_type = ELF32_R_TYPE (reloc->r_info);
|
||||
|
||||
#ifndef RESOLVE_CONFLICT_FIND_MAP
|
||||
if (__builtin_expect (rinfo == R_PPC_NONE, 0))
|
||||
if (r_type == R_PPC_RELATIVE)
|
||||
{
|
||||
*reloc_addr = map->l_addr + reloc->r_addend;
|
||||
return;
|
||||
}
|
||||
|
||||
if (__builtin_expect (r_type == R_PPC_NONE, 0))
|
||||
return;
|
||||
|
||||
/* The condition on the next two lines is a hack around a bug in Solaris
|
||||
tools on Sparc. It's not clear whether it should really be here at all,
|
||||
but if not the binutils need to be changed. */
|
||||
if (rinfo == R_PPC_RELATIVE
|
||||
|| (sym->st_shndx != SHN_UNDEF
|
||||
&& ELF32_ST_BIND (sym->st_info) == STB_LOCAL))
|
||||
{
|
||||
/* Has already been relocated. */
|
||||
Elf32_Word loadbase = map->l_addr;
|
||||
finaladdr = loadbase + reloc->r_addend;
|
||||
}
|
||||
else
|
||||
{
|
||||
Elf32_Word loadbase
|
||||
= (Elf32_Word) (char *) (RESOLVE (&sym, version,
|
||||
ELF32_R_TYPE(reloc->r_info)));
|
||||
if (sym == NULL)
|
||||
{
|
||||
/* Weak symbol that wasn't actually defined anywhere. */
|
||||
assert (loadbase == 0);
|
||||
finaladdr = reloc->r_addend;
|
||||
}
|
||||
else
|
||||
finaladdr = (loadbase + (Elf32_Word) (char *) sym->st_value
|
||||
+ reloc->r_addend);
|
||||
}
|
||||
#if defined USE_TLS && !defined RTLD_BOOTSTRAP
|
||||
struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type);
|
||||
value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value;
|
||||
#else
|
||||
finaladdr = reloc->r_addend;
|
||||
if (rinfo == R_PPC_JMP_SLOT)
|
||||
RESOLVE_CONFLICT_FIND_MAP (map, reloc_addr);
|
||||
value = RESOLVE (&sym, version, r_type);
|
||||
# ifndef RTLD_BOOTSTRAP
|
||||
if (sym != NULL)
|
||||
# endif
|
||||
value += sym->st_value;
|
||||
#endif
|
||||
value += reloc->r_addend;
|
||||
|
||||
/* A small amount of code is duplicated here for speed. In libc,
|
||||
more than 90% of the relocs are R_PPC_RELATIVE; in the X11 shared
|
||||
@ -386,15 +383,55 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
|
||||
R_PPC_ADDR32, and 16% are R_PPC_JMP_SLOT (which this routine
|
||||
wouldn't usually handle). As an bonus, doing this here allows
|
||||
the switch statement in __process_machine_rela to work. */
|
||||
if (rinfo == R_PPC_RELATIVE
|
||||
|| rinfo == R_PPC_GLOB_DAT
|
||||
|| rinfo == R_PPC_ADDR32)
|
||||
switch (r_type)
|
||||
{
|
||||
*reloc_addr = finaladdr;
|
||||
case R_PPC_GLOB_DAT:
|
||||
case R_PPC_ADDR32:
|
||||
*reloc_addr = value;
|
||||
break;
|
||||
|
||||
#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD)
|
||||
case R_PPC_DTPMOD32:
|
||||
# ifdef RTLD_BOOTSTRAP
|
||||
/* During startup the dynamic linker is always index 1. */
|
||||
*reloc_addr = 1;
|
||||
# else
|
||||
/* Get the information from the link map returned by the
|
||||
RESOLVE_MAP function. */
|
||||
if (sym_map != NULL)
|
||||
*reloc_addr = sym_map->l_tls_modid;
|
||||
# endif
|
||||
break;
|
||||
case R_PPC_DTPREL32:
|
||||
/* During relocation all TLS symbols are defined and used.
|
||||
Therefore the offset is already correct. */
|
||||
# ifndef RTLD_BOOTSTRAP
|
||||
*reloc_addr = TLS_DTPREL_VALUE (sym, reloc);
|
||||
# endif
|
||||
break;
|
||||
case R_PPC_TPREL32:
|
||||
# ifndef RTLD_BOOTSTRAP
|
||||
if (sym_map)
|
||||
{
|
||||
CHECK_STATIC_TLS (map, sym_map);
|
||||
# endif
|
||||
*reloc_addr = TLS_TPREL_VALUE (sym_map, sym, reloc);
|
||||
# ifndef RTLD_BOOTSTRAP
|
||||
}
|
||||
# endif
|
||||
break;
|
||||
#endif /* USE_TLS etc. */
|
||||
|
||||
#ifdef RESOLVE_CONFLICT_FIND_MAP
|
||||
case R_PPC_JMP_SLOT:
|
||||
RESOLVE_CONFLICT_FIND_MAP (map, reloc_addr);
|
||||
/* FALLTHROUGH */
|
||||
#endif
|
||||
|
||||
default:
|
||||
__process_machine_rela (map, reloc, sym, refsym,
|
||||
reloc_addr, value, r_type);
|
||||
}
|
||||
else
|
||||
__process_machine_rela (map, reloc, sym, refsym,
|
||||
reloc_addr, finaladdr, rinfo);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
57
sysdeps/powerpc/powerpc32/elf/configure
vendored
Executable file
57
sysdeps/powerpc/powerpc32/elf/configure
vendored
Executable file
@ -0,0 +1,57 @@
|
||||
# This file is generated from configure.in by Autoconf. DO NOT EDIT!
|
||||
# Local configure fragment for sysdeps/powerpc32/elf.
|
||||
|
||||
if test "$usetls" != no; then
|
||||
# Check for support of thread-local storage handling in assembler and
|
||||
# linker.
|
||||
echo "$as_me:$LINENO: checking for powerpc32 TLS support" >&5
|
||||
echo $ECHO_N "checking for powerpc32 TLS support... $ECHO_C" >&6
|
||||
if test "${libc_cv_powerpc32_tls+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
cat > conftest.s <<\EOF
|
||||
.section ".tdata","awT",@progbits
|
||||
x: .long 1
|
||||
x1: .long 1
|
||||
x2: .long 1
|
||||
.text
|
||||
addi 3,31,x@got@tlsgd
|
||||
addi 3,31,x1@got@tlsld
|
||||
addi 9,3,x1@dtprel
|
||||
addis 9,3,x2@dtprel@ha
|
||||
addi 9,9,x2@dtprel@l
|
||||
lwz 0,x1@dtprel(3)
|
||||
addis 9,3,x2@dtprel@ha
|
||||
lwz 0,x2@dtprel@l(9)
|
||||
lwz 9,x3@got@tprel(31)
|
||||
add 9,9,x@tls
|
||||
addi 9,2,x1@tprel
|
||||
addis 9,2,x2@tprel@ha
|
||||
addi 9,9,x2@tprel@l
|
||||
EOF
|
||||
if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
libc_cv_powerpc32_tls=yes
|
||||
else
|
||||
libc_cv_powerpc32_tls=no
|
||||
fi
|
||||
rm -f conftest*
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $libc_cv_powerpc32_tls" >&5
|
||||
echo "${ECHO_T}$libc_cv_powerpc32_tls" >&6
|
||||
if test $libc_cv_powerpc32_tls = yes; then
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_TLS_SUPPORT 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define PI_STATIC_AND_HIDDEN 1
|
||||
_ACEOF
|
||||
|
42
sysdeps/powerpc/powerpc32/elf/configure.in
Normal file
42
sysdeps/powerpc/powerpc32/elf/configure.in
Normal file
@ -0,0 +1,42 @@
|
||||
GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
|
||||
# Local configure fragment for sysdeps/powerpc32/elf.
|
||||
|
||||
if test "$usetls" != no; then
|
||||
# Check for support of thread-local storage handling in assembler and
|
||||
# linker.
|
||||
AC_CACHE_CHECK(for powerpc32 TLS support, libc_cv_powerpc32_tls, [dnl
|
||||
cat > conftest.s <<\EOF
|
||||
.section ".tdata","awT",@progbits
|
||||
x: .long 1
|
||||
x1: .long 1
|
||||
x2: .long 1
|
||||
.text
|
||||
addi 3,31,x@got@tlsgd
|
||||
addi 3,31,x1@got@tlsld
|
||||
addi 9,3,x1@dtprel
|
||||
addis 9,3,x2@dtprel@ha
|
||||
addi 9,9,x2@dtprel@l
|
||||
lwz 0,x1@dtprel(3)
|
||||
addis 9,3,x2@dtprel@ha
|
||||
lwz 0,x2@dtprel@l(9)
|
||||
lwz 9,x3@got@tprel(31)
|
||||
add 9,9,x@tls
|
||||
addi 9,2,x1@tprel
|
||||
addis 9,2,x2@tprel@ha
|
||||
addi 9,9,x2@tprel@l
|
||||
EOF
|
||||
dnl
|
||||
if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
|
||||
libc_cv_powerpc32_tls=yes
|
||||
else
|
||||
libc_cv_powerpc32_tls=no
|
||||
fi
|
||||
rm -f conftest*])
|
||||
if test $libc_cv_powerpc32_tls = yes; then
|
||||
AC_DEFINE(HAVE_TLS_SUPPORT)
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl It is always possible to access static and hidden symbols in an
|
||||
dnl position independent way.
|
||||
AC_DEFINE(PI_STATIC_AND_HIDDEN)
|
@ -330,12 +330,12 @@ elf_machine_dynamic (void)
|
||||
of the main executable's symbols, as for a COPY reloc. */
|
||||
|
||||
#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD)
|
||||
#define elf_machine_type_class(type) \
|
||||
( (((type) == R_PPC64_DTPMOD64 \
|
||||
|| (type) == R_PPC64_DTPREL64 \
|
||||
|| (type) == R_PPC64_TPREL64 \
|
||||
|| (type) == R_PPC64_ADDR24) * ELF_RTYPE_CLASS_PLT) \
|
||||
| (((type) == R_PPC64_COPY) * ELF_RTYPE_CLASS_COPY))
|
||||
#define elf_machine_type_class(type) \
|
||||
((((type) == R_PPC64_DTPMOD64 \
|
||||
|| (type) == R_PPC64_DTPREL64 \
|
||||
|| (type) == R_PPC64_TPREL64 \
|
||||
|| (type) == R_PPC64_ADDR24) * ELF_RTYPE_CLASS_PLT) \
|
||||
| (((type) == R_PPC64_COPY) * ELF_RTYPE_CLASS_COPY))
|
||||
#else
|
||||
#define elf_machine_type_class(type) \
|
||||
((((type) == R_PPC64_ADDR24) * ELF_RTYPE_CLASS_PLT) \
|
||||
@ -472,9 +472,6 @@ elf_machine_fixup_plt (struct link_map *map, lookup_t sym_map,
|
||||
Elf64_FuncDesc *plt = (Elf64_FuncDesc *) reloc_addr;
|
||||
Elf64_FuncDesc *rel = (Elf64_FuncDesc *) finaladdr;
|
||||
Elf64_Addr offset = 0;
|
||||
#ifndef RTLD_BOOTSTRAP
|
||||
weak_extern (GL(dl_rtld_map));
|
||||
#endif
|
||||
|
||||
/* If sym_map is NULL, it's a weak undefined sym; Leave the plt zero. */
|
||||
if (sym_map == NULL)
|
||||
@ -483,7 +480,7 @@ elf_machine_fixup_plt (struct link_map *map, lookup_t sym_map,
|
||||
/* If the opd entry is not yet relocated (because it's from a shared
|
||||
object that hasn't been processed yet), then manually reloc it. */
|
||||
if (map != sym_map && !sym_map->l_relocated
|
||||
#ifndef RTLD_BOOTSTRAP
|
||||
#if !defined RTLD_BOOTSTRAP && defined SHARED
|
||||
/* Bootstrap map doesn't have l_relocated set for it. */
|
||||
&& sym_map != &GL(dl_rtld_map)
|
||||
#endif
|
||||
@ -528,7 +525,8 @@ elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc,
|
||||
#define PPC_HIGHERA(v) PPC_HIGHER ((v) + 0x8000)
|
||||
#define PPC_HIGHEST(v) (((v) >> 48) & 0xffff)
|
||||
#define PPC_HIGHESTA(v) PPC_HIGHEST ((v) + 0x8000)
|
||||
#define BIT_INSERT(old, val, mask) ((old & ~(Elf64_Addr) mask) | (val & mask))
|
||||
#define BIT_INSERT(var, val, mask) \
|
||||
((var) = ((var) & ~(Elf64_Addr) (mask) | ((val) & (mask))))
|
||||
|
||||
#define dont_expect(X) __builtin_expect ((X), 0)
|
||||
|
||||
@ -555,9 +553,9 @@ elf_machine_rela (struct link_map *map,
|
||||
const struct r_found_version *version,
|
||||
Elf64_Addr *const reloc_addr)
|
||||
{
|
||||
int r_type = ELF64_R_TYPE (reloc->r_info);
|
||||
const int r_type = ELF64_R_TYPE (reloc->r_info);
|
||||
struct link_map *sym_map;
|
||||
Elf64_Addr value, raw_value;
|
||||
Elf64_Addr value;
|
||||
#ifndef RTLD_BOOTSTRAP
|
||||
const Elf64_Sym *const refsym = sym;
|
||||
#endif
|
||||
@ -568,17 +566,23 @@ elf_machine_rela (struct link_map *map,
|
||||
return;
|
||||
}
|
||||
|
||||
if (r_type == R_PPC64_NONE)
|
||||
if (__builtin_expect (r_type == R_PPC64_NONE, 0))
|
||||
return;
|
||||
|
||||
sym_map = RESOLVE_MAP (&sym, version, r_type);
|
||||
value = raw_value = reloc->r_addend;
|
||||
if (sym_map)
|
||||
{
|
||||
raw_value += sym->st_value;
|
||||
value = raw_value + sym_map->l_addr;
|
||||
}
|
||||
#if defined USE_TLS && !defined RTLD_BOOTSTRAP
|
||||
struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type);
|
||||
value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value;
|
||||
#else
|
||||
value = RESOLVE (&sym, version, r_type);
|
||||
# ifndef RTLD_BOOTSTRAP
|
||||
if (sym != NULL)
|
||||
# endif
|
||||
value += sym->st_value;
|
||||
#endif
|
||||
value += reloc->r_addend;
|
||||
|
||||
/* For relocs that don't edit code, return.
|
||||
For relocs that might edit instructions, break from the switch. */
|
||||
switch (r_type)
|
||||
{
|
||||
case R_PPC64_ADDR64:
|
||||
@ -586,112 +590,63 @@ elf_machine_rela (struct link_map *map,
|
||||
*reloc_addr = value;
|
||||
return;
|
||||
|
||||
#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD)
|
||||
case R_PPC64_JMP_SLOT:
|
||||
#ifdef RESOLVE_CONFLICT_FIND_MAP
|
||||
RESOLVE_CONFLICT_FIND_MAP (map, reloc_addr);
|
||||
#endif
|
||||
elf_machine_fixup_plt (map, sym_map, reloc, reloc_addr, value);
|
||||
return;
|
||||
|
||||
#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD)
|
||||
case R_PPC64_DTPMOD64:
|
||||
#ifdef RTLD_BOOTSTRAP
|
||||
# ifdef RTLD_BOOTSTRAP
|
||||
/* During startup the dynamic linker is always index 1. */
|
||||
*reloc_addr = 1;
|
||||
#else
|
||||
# else
|
||||
/* Get the information from the link map returned by the
|
||||
resolve function. */
|
||||
if (sym_map != NULL)
|
||||
*reloc_addr = sym_map->l_tls_modid;
|
||||
#endif
|
||||
# endif
|
||||
return;
|
||||
|
||||
case R_PPC64_TPREL64:
|
||||
#ifdef RTLD_BOOTSTRAP
|
||||
*reloc_addr = (sym_map->l_tls_offset - TLS_TCB_SIZE
|
||||
+ raw_value - TLS_TP_OFFSET);
|
||||
#else
|
||||
case R_PPC_DTPREL64:
|
||||
/* During relocation all TLS symbols are defined and used.
|
||||
Therefore the offset is already correct. */
|
||||
# ifndef RTLD_BOOTSTRAP
|
||||
*reloc_addr = TLS_DTPREL_VALUE (sym, reloc);
|
||||
# endif
|
||||
break;
|
||||
case R_PPC_TPREL64:
|
||||
# ifndef RTLD_BOOTSTRAP
|
||||
if (sym_map)
|
||||
{
|
||||
CHECK_STATIC_TLS (map, sym_map);
|
||||
*reloc_addr = (sym_map->l_tls_offset - TLS_TCB_SIZE
|
||||
+ raw_value - TLS_TP_OFFSET);
|
||||
# endif
|
||||
*reloc_addr = TLS_TPREL_VALUE (sym_map, sym, reloc);
|
||||
# ifndef RTLD_BOOTSTRAP
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
|
||||
case R_PPC64_DTPREL64:
|
||||
#ifndef RTLD_BOOTSTRAP
|
||||
/* During relocation all TLS symbols are defined and used.
|
||||
Therefore the offset is already correct. */
|
||||
*reloc_addr = raw_value - TLS_DTV_OFFSET;
|
||||
#endif
|
||||
return;
|
||||
#endif
|
||||
|
||||
case R_PPC64_JMP_SLOT:
|
||||
|
||||
elf_machine_fixup_plt (map, sym_map, reloc, reloc_addr, value);
|
||||
return;
|
||||
# endif
|
||||
break;
|
||||
#endif /* USE_TLS etc. */
|
||||
|
||||
#ifndef RTLD_BOOTSTRAP /* None of the following appear in ld.so */
|
||||
case R_PPC64_ADDR16_LO_DS:
|
||||
if (dont_expect ((value & 3) != 0))
|
||||
_dl_reloc_overflow (map, "R_PPC64_ADDR16_LO_DS",
|
||||
reloc_addr, sym, refsym);
|
||||
*(Elf64_Half *) reloc_addr = BIT_INSERT (*(Elf64_Half *) reloc_addr,
|
||||
value, 0xfffc);
|
||||
break;
|
||||
|
||||
case R_PPC64_TPREL16_LO_DS:
|
||||
if (dont_expect ((value & 3) != 0))
|
||||
_dl_reloc_overflow (map, "R_PPC64_TPREL16_LO_DS",
|
||||
reloc_addr, sym, refsym);
|
||||
*(Elf64_Half *) reloc_addr = BIT_INSERT (*(Elf64_Half *) reloc_addr,
|
||||
value, 0xfffc);
|
||||
break;
|
||||
|
||||
case R_PPC64_DTPREL16_LO_DS:
|
||||
if (dont_expect ((value & 3) != 0))
|
||||
_dl_reloc_overflow (map, "R_PPC64_DTPREL16_LO_DS",
|
||||
reloc_addr, sym, refsym);
|
||||
*(Elf64_Half *) reloc_addr = BIT_INSERT (*(Elf64_Half *) reloc_addr,
|
||||
value, 0xfffc);
|
||||
break;
|
||||
|
||||
case R_PPC64_GOT_TPREL16_LO_DS:
|
||||
if (dont_expect ((value & 3) != 0))
|
||||
_dl_reloc_overflow (map, "R_PPC64_GOT_TPREL16_LO_DS",
|
||||
reloc_addr, sym, refsym);
|
||||
*(Elf64_Half *) reloc_addr = BIT_INSERT (*(Elf64_Half *) reloc_addr,
|
||||
value, 0xfffc);
|
||||
break;
|
||||
|
||||
case R_PPC64_GOT_DTPREL16_LO_DS:
|
||||
if (dont_expect ((value & 3) != 0))
|
||||
_dl_reloc_overflow (map, "R_PPC64_GOT_DTPREL16_LO_DS",
|
||||
reloc_addr, sym, refsym);
|
||||
*(Elf64_Half *) reloc_addr = BIT_INSERT (*(Elf64_Half *) reloc_addr,
|
||||
value, 0xfffc);
|
||||
BIT_INSERT (*(Elf64_Half *) reloc_addr, value, 0xfffc);
|
||||
break;
|
||||
|
||||
case R_PPC64_ADDR16_LO:
|
||||
case R_PPC64_TPREL16_LO:
|
||||
case R_PPC64_DTPREL16_LO:
|
||||
case R_PPC64_GOT_TLSGD16_LO:
|
||||
case R_PPC64_GOT_TLSLD16_LO:
|
||||
*(Elf64_Half *) reloc_addr = PPC_LO (value);
|
||||
break;
|
||||
|
||||
case R_PPC64_ADDR16_HI:
|
||||
case R_PPC64_TPREL16_HI:
|
||||
case R_PPC64_DTPREL16_HI:
|
||||
case R_PPC64_GOT_TPREL16_HI:
|
||||
case R_PPC64_GOT_DTPREL16_HI:
|
||||
case R_PPC64_GOT_TLSGD16_HI:
|
||||
case R_PPC64_GOT_TLSLD16_HI:
|
||||
*(Elf64_Half *) reloc_addr = PPC_HI (value);
|
||||
break;
|
||||
|
||||
case R_PPC64_ADDR16_HA:
|
||||
case R_PPC64_TPREL16_HA:
|
||||
case R_PPC64_DTPREL16_HA:
|
||||
case R_PPC64_GOT_TLSGD16_HA:
|
||||
case R_PPC64_GOT_TLSLD16_HA:
|
||||
*(Elf64_Half *) reloc_addr = PPC_HA (value);
|
||||
break;
|
||||
|
||||
@ -700,8 +655,7 @@ elf_machine_rela (struct link_map *map,
|
||||
Elf64_Addr delta = value - (Elf64_Xword) reloc_addr;
|
||||
if (dont_expect ((delta + 0x2000000) >= 0x4000000 || (delta & 3) != 0))
|
||||
_dl_reloc_overflow (map, "R_PPC64_REL24", reloc_addr, sym, refsym);
|
||||
*(Elf64_Word *) reloc_addr = BIT_INSERT (*(Elf64_Word *) reloc_addr,
|
||||
delta, 0x3fffffc);
|
||||
BIT_INSERT (*(Elf64_Word *) reloc_addr, delta, 0x3fffffc);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -747,8 +701,7 @@ elf_machine_rela (struct link_map *map,
|
||||
case R_PPC64_ADDR24:
|
||||
if (dont_expect ((value + 0x2000000) >= 0x4000000 || (value & 3) != 0))
|
||||
_dl_reloc_overflow (map, "R_PPC64_ADDR24", reloc_addr, sym, refsym);
|
||||
*(Elf64_Word *) reloc_addr = BIT_INSERT (*(Elf64_Word *) reloc_addr,
|
||||
value, 0x3fffffc);
|
||||
BIT_INSERT (*(Elf64_Word *) reloc_addr, value, 0x3fffffc);
|
||||
break;
|
||||
|
||||
case R_PPC64_ADDR16:
|
||||
@ -768,63 +721,22 @@ elf_machine_rela (struct link_map *map,
|
||||
case R_PPC64_ADDR16_DS:
|
||||
if (dont_expect ((value + 0x8000) >= 0x10000 || (value & 3) != 0))
|
||||
_dl_reloc_overflow (map, "R_PPC64_ADDR16_DS", reloc_addr, sym, refsym);
|
||||
*(Elf64_Half *) reloc_addr = BIT_INSERT (*(Elf64_Half *) reloc_addr,
|
||||
value, 0xfffc);
|
||||
break;
|
||||
|
||||
case R_PPC64_TPREL16_DS:
|
||||
if (dont_expect ((value + 0x8000) >= 0x10000 || (value & 3) != 0))
|
||||
_dl_reloc_overflow (map, "R_PPC64_TPREL16_DS", reloc_addr,
|
||||
sym, refsym);
|
||||
*(Elf64_Half *) reloc_addr = BIT_INSERT (*(Elf64_Half *) reloc_addr,
|
||||
value, 0xfffc);
|
||||
break;
|
||||
|
||||
case R_PPC64_DTPREL16_DS:
|
||||
if (dont_expect ((value + 0x8000) >= 0x10000 || (value & 3) != 0))
|
||||
_dl_reloc_overflow (map, "R_PPC64_DTPREL16_DS", reloc_addr,
|
||||
sym, refsym);
|
||||
*(Elf64_Half *) reloc_addr = BIT_INSERT (*(Elf64_Half *) reloc_addr,
|
||||
value, 0xfffc);
|
||||
break;
|
||||
|
||||
case R_PPC64_GOT_TPREL16_DS:
|
||||
if (dont_expect ((value + 0x8000) >= 0x10000 || (value & 3) != 0))
|
||||
_dl_reloc_overflow (map, "R_PPC64_GOT_TPREL16_DS", reloc_addr,
|
||||
sym, refsym);
|
||||
*(Elf64_Half *) reloc_addr = BIT_INSERT (*(Elf64_Half *) reloc_addr,
|
||||
value, 0xfffc);
|
||||
break;
|
||||
|
||||
case R_PPC64_GOT_DTPREL16_DS:
|
||||
if (dont_expect ((value + 0x8000) >= 0x10000 || (value & 3) != 0))
|
||||
_dl_reloc_overflow (map, "R_PPC64_GOT_DTPREL16_DS",
|
||||
reloc_addr, sym, refsym);
|
||||
*(Elf64_Half *) reloc_addr = BIT_INSERT (*(Elf64_Half *) reloc_addr,
|
||||
value, 0xfffc);
|
||||
BIT_INSERT (*(Elf64_Half *) reloc_addr, value, 0xfffc);
|
||||
break;
|
||||
|
||||
case R_PPC64_ADDR16_HIGHER:
|
||||
case R_PPC64_TPREL16_HIGHER:
|
||||
case R_PPC64_DTPREL16_HIGHER:
|
||||
*(Elf64_Half *) reloc_addr = PPC_HIGHER (value);
|
||||
break;
|
||||
|
||||
case R_PPC64_ADDR16_HIGHEST:
|
||||
case R_PPC64_TPREL16_HIGHEST:
|
||||
case R_PPC64_DTPREL16_HIGHEST:
|
||||
*(Elf64_Half *) reloc_addr = PPC_HIGHEST (value);
|
||||
break;
|
||||
|
||||
case R_PPC64_ADDR16_HIGHERA:
|
||||
case R_PPC64_TPREL16_HIGHERA:
|
||||
case R_PPC64_DTPREL16_HIGHERA:
|
||||
*(Elf64_Half *) reloc_addr = PPC_HIGHERA (value);
|
||||
break;
|
||||
|
||||
case R_PPC64_ADDR16_HIGHESTA:
|
||||
case R_PPC64_TPREL16_HIGHESTA:
|
||||
case R_PPC64_DTPREL16_HIGHESTA:
|
||||
*(Elf64_Half *) reloc_addr = PPC_HIGHESTA (value);
|
||||
break;
|
||||
|
||||
@ -832,20 +744,20 @@ elf_machine_rela (struct link_map *map,
|
||||
case R_PPC64_ADDR14_BRTAKEN:
|
||||
case R_PPC64_ADDR14_BRNTAKEN:
|
||||
{
|
||||
Elf64_Word insn;
|
||||
if (dont_expect ((value + 0x8000) >= 0x10000 || (value & 3) != 0))
|
||||
_dl_reloc_overflow (map, "R_PPC64_ADDR14", reloc_addr, sym, refsym);
|
||||
insn = BIT_INSERT (*(Elf64_Word *) reloc_addr, value, 0xfffc);
|
||||
_dl_reloc_overflow (map, "R_PPC64_ADDR14", reloc_addr, sym, refsym);
|
||||
Elf64_Word insn = *(Elf64_Word *) reloc_addr;
|
||||
BIT_INSERT (insn, value, 0xfffc);
|
||||
if (r_type != R_PPC64_ADDR14)
|
||||
{
|
||||
insn &= ~(1 << 21);
|
||||
if (r_type == R_PPC64_ADDR14_BRTAKEN)
|
||||
insn |= 1 << 21;
|
||||
if ((insn & (0x14 << 21)) == (0x04 << 21))
|
||||
insn |= 0x02 << 21;
|
||||
else if ((insn & (0x14 << 21)) == (0x10 << 21))
|
||||
insn |= 0x08 << 21;
|
||||
}
|
||||
{
|
||||
insn &= ~(1 << 21);
|
||||
if (r_type == R_PPC64_ADDR14_BRTAKEN)
|
||||
insn |= 1 << 21;
|
||||
if ((insn & (0x14 << 21)) == (0x04 << 21))
|
||||
insn |= 0x02 << 21;
|
||||
else if ((insn & (0x14 << 21)) == (0x10 << 21))
|
||||
insn |= 0x08 << 21;
|
||||
}
|
||||
*(Elf64_Word *) reloc_addr = insn;
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user