This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
double size of ppc32 GOT
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sources dot redhat dot com
- Date: Sat, 7 May 2005 01:00:24 +0930
- Subject: double size of ppc32 GOT
The current ppc32 ld only supports a 32k GOT, while the ABI allows 64k.
What's more, placing the header and _GLOBAL_OFFSET_TABLE_ symbol
definition at the start of .got isn't ideal for SYSV ABI .sdata in
shared objects, which is addressed using the GOT pointer.
This patch supports a full 64k GOT, and prefers to put
_GLOBAL_OFFSET_TABLE_ and the reserved entries around it to the end of a
GOT less than 32k in size. I developed this as part of code supporting
a revised ppc32 .plt and .got, and figure it's worth committing
separately. As well, this patch gets rid of a struct elf_backend_data
field only used by ppc.
I'll commit this tomorrow morning after running overnight tests.
bfd/
* elf-bfd.h (struct elf_backend_data): Remove got_symbol_offset.
* elfxx-target.h (elf_backend_got_symbol_offset): Delete.
* elflink.c (_bfd_elf_create_got_section): Use zero in place of
got_symbol_offset.
* elf-m10300.c (_bfd_mn10300_elf_create_got_section): Likewise.
* elf32-frv.c (_frv_create_got_section): Likewise.
* elf32-i370.c (i370_elf_finish_dynamic_sections): Delete ppc code.
(elf_backend_got_symbol_offset): Don't define.
* elf32-ppc.c (struct ppc_elf_link_hash_table): Add got_header_size
and got_gap.
(ppc_elf_create_got): Tidy.
(ppc_elf_create_dynamic_sections): Don't set SEC_IN_MEMORY for .plt.
(ppc_elf_check_relocs): Reduce string comparisons by using elf.hgot.
(ppc_elf_gc_sweep_hook): Likewise.
(ppc_elf_relocate_section): Likewise.
(ppc_elf_finish_dynamic_symbol): Likewise.
(allocate_got): New function.
(allocate_dynrelocs): Use allocate_got.
(ppc_elf_size_dynamic_sections): Likewise. Delay tlsld_got allocation
so that local got can refcount it. Set got_header_size.
(ppc_elf_relocate_section): Use value of elf.hgot rather than hard-
coded 4.
(ppc_elf_finish_dynamic_sections): Likewise.
(elf_backend_got_symbol_offset): Don't define.
(elf_backend_got_header_size): Ditto.
* elf64-ppc.c (elf_backend_got_symbol_offset): Don't define.
ld/testsuite/
* ld-powerpc/tlsexe32.d: Update for changed got layout.
* ld-powerpc/tlsexe32.g: Likewise.
* ld-powerpc/tlsexe32.r: Likewise.
* ld-powerpc/tlsso32.d: Likewise.
* ld-powerpc/tlsso32.g: Likewise.
* ld-powerpc/tlsso32.r: Likewise.
Index: bfd/elf-bfd.h
===================================================================
RCS file: /cvs/src/src/bfd/elf-bfd.h,v
retrieving revision 1.184
diff -u -p -r1.184 elf-bfd.h
--- bfd/elf-bfd.h 5 May 2005 14:37:10 -0000 1.184
+++ bfd/elf-bfd.h 6 May 2005 07:02:05 -0000
@@ -977,10 +977,6 @@ struct elf_backend_data
/* An array of target specific special section map. */
const struct bfd_elf_special_section *special_sections;
- /* offset of the _GLOBAL_OFFSET_TABLE_ symbol from the start of the
- .got section */
- bfd_vma got_symbol_offset;
-
/* The size in bytes of the header for the GOT. This includes the
so-called reserved entries on some systems. */
bfd_vma got_header_size;
Index: bfd/elfxx-target.h
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-target.h,v
retrieving revision 1.82
diff -u -p -r1.82 elfxx-target.h
--- bfd/elfxx-target.h 5 May 2005 14:37:15 -0000 1.82
+++ bfd/elfxx-target.h 6 May 2005 07:02:27 -0000
@@ -72,9 +72,6 @@
#define bfd_elfNN_get_section_contents_in_window \
_bfd_generic_get_section_contents_in_window
-#ifndef elf_backend_got_symbol_offset
-#define elf_backend_got_symbol_offset (bfd_vma) 0
-#endif
#ifndef elf_backend_can_refcount
#define elf_backend_can_refcount 0
#endif
@@ -592,7 +589,6 @@ static const struct elf_backend_data elf
ELF_MACHINE_ALT2,
&elf_backend_size_info,
elf_backend_special_sections,
- elf_backend_got_symbol_offset,
elf_backend_got_header_size,
elf_backend_collect,
elf_backend_type_change_ok,
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.161
diff -u -p -r1.161 elflink.c
--- bfd/elflink.c 5 May 2005 16:40:07 -0000 1.161
+++ bfd/elflink.c 6 May 2005 07:02:27 -0000
@@ -81,7 +81,7 @@ _bfd_elf_create_got_section (bfd *abfd,
bh = NULL;
if (!(_bfd_generic_link_add_one_symbol
(info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s,
- bed->got_symbol_offset, NULL, FALSE, bed->collect, &bh)))
+ 0, NULL, FALSE, bed->collect, &bh)))
return FALSE;
h = (struct elf_link_hash_entry *) bh;
h->def_regular = 1;
@@ -96,7 +96,7 @@ _bfd_elf_create_got_section (bfd *abfd,
}
/* The first bit of the global offset table is the header. */
- s->size += bed->got_header_size + bed->got_symbol_offset;
+ s->size += bed->got_header_size;
return TRUE;
}
Index: bfd/elf-m10300.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-m10300.c,v
retrieving revision 1.64
diff -u -p -r1.64 elf-m10300.c
--- bfd/elf-m10300.c 5 May 2005 14:33:43 -0000 1.64
+++ bfd/elf-m10300.c 6 May 2005 07:02:07 -0000
@@ -620,8 +620,7 @@ _bfd_mn10300_elf_create_got_section (abf
bh = NULL;
if (!(_bfd_generic_link_add_one_symbol
(info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s,
- bed->got_symbol_offset, (const char *) NULL, FALSE,
- bed->collect, &bh)))
+ 0, (const char *) NULL, FALSE, bed->collect, &bh)))
return FALSE;
h = (struct elf_link_hash_entry *) bh;
h->def_regular = 1;
@@ -634,7 +633,7 @@ _bfd_mn10300_elf_create_got_section (abf
elf_hash_table (info)->hgot = h;
/* The first bit of the global offset table is the header. */
- s->size += bed->got_header_size + bed->got_symbol_offset;
+ s->size += bed->got_header_size;
return TRUE;
}
Index: bfd/elf32-frv.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-frv.c,v
retrieving revision 1.40
diff -u -p -r1.40 elf32-frv.c
--- bfd/elf32-frv.c 5 May 2005 14:33:45 -0000 1.40
+++ bfd/elf32-frv.c 6 May 2005 07:02:10 -0000
@@ -4304,8 +4304,7 @@ _frv_create_got_section (bfd *abfd, stru
bh = NULL;
if (!(_bfd_generic_link_add_one_symbol
(info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s,
- bed->got_symbol_offset, (const char *) NULL, FALSE,
- bed->collect, &bh)))
+ 0, (const char *) NULL, FALSE, bed->collect, &bh)))
return FALSE;
h = (struct elf_link_hash_entry *) bh;
h->def_regular = 1;
@@ -4321,7 +4320,7 @@ _frv_create_got_section (bfd *abfd, stru
}
/* The first bit of the global offset table is the header. */
- s->size += bed->got_header_size + bed->got_symbol_offset;
+ s->size += bed->got_header_size;
/* This is the machine-specific part. Create and initialize section
data for the got. */
Index: bfd/elf32-i370.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i370.c,v
retrieving revision 1.45
diff -u -p -r1.45 elf32-i370.c
--- bfd/elf32-i370.c 5 May 2005 14:33:47 -0000 1.45
+++ bfd/elf32-i370.c 6 May 2005 07:02:14 -0000
@@ -1022,20 +1022,16 @@ i370_elf_finish_dynamic_sections (output
}
}
- /* Add a blrl instruction at _GLOBAL_OFFSET_TABLE_-4 so that a function can
- easily find the address of the _GLOBAL_OFFSET_TABLE_. */
-/* XXX this is clearly very wrong for the 370 arch */
if (sgot)
{
unsigned char *contents = sgot->contents;
- bfd_put_32 (output_bfd, (bfd_vma) 0x4e800021 /* blrl */, contents);
if (sdyn == NULL)
- bfd_put_32 (output_bfd, (bfd_vma) 0, contents+4);
+ bfd_put_32 (output_bfd, (bfd_vma) 0, contents);
else
bfd_put_32 (output_bfd,
sdyn->output_section->vma + sdyn->output_offset,
- contents+4);
+ contents);
elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
}
@@ -1487,7 +1483,6 @@ i370_elf_post_process_headers (abfd, lin
#define elf_info_to_howto i370_elf_info_to_howto
#define elf_backend_plt_not_loaded 1
-#define elf_backend_got_symbol_offset 4
#define elf_backend_rela_normal 1
#define bfd_elf32_bfd_reloc_type_lookup i370_elf_reloc_type_lookup
Index: bfd/elf32-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-ppc.c,v
retrieving revision 1.153
diff -u -p -r1.153 elf32-ppc.c
--- bfd/elf32-ppc.c 5 May 2005 14:33:49 -0000 1.153
+++ bfd/elf32-ppc.c 6 May 2005 13:54:22 -0000
@@ -2131,6 +2131,11 @@ struct ppc_elf_link_hash_table
bfd_vma offset;
} tlsld_got;
+ /* Size of reserved GOT entries. */
+ unsigned int got_header_size;
+ /* Non-zero if allocating the header left a gap. */
+ unsigned int got_gap;
+
/* Small local sym to section mapping cache. */
struct sym_sec_cache sym_sec;
};
@@ -2220,12 +2225,9 @@ ppc_elf_create_got (bfd *abfd, struct bf
if (!bfd_set_section_flags (abfd, s, flags))
return FALSE;
- htab->relgot = bfd_make_section_with_flags (abfd, ".rela.got",
- SEC_ALLOC | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_READONLY);
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED | SEC_READONLY);
+ htab->relgot = bfd_make_section_with_flags (abfd, ".rela.got", flags);
if (!htab->relgot
|| ! bfd_set_section_alignment (abfd, htab->relgot, 2))
return FALSE;
@@ -2257,18 +2259,18 @@ ppc_elf_create_dynamic_sections (bfd *ab
| SEC_LINKER_CREATED);
htab->dynbss = bfd_get_section_by_name (abfd, ".dynbss");
- htab->dynsbss = s = bfd_make_section_with_flags (abfd, ".dynsbss",
- SEC_ALLOC
- | SEC_LINKER_CREATED);
+ s = bfd_make_section_with_flags (abfd, ".dynsbss",
+ SEC_ALLOC | SEC_LINKER_CREATED);
+ htab->dynsbss = s;
if (s == NULL)
return FALSE;
if (! info->shared)
{
htab->relbss = bfd_get_section_by_name (abfd, ".rela.bss");
- htab->relsbss = s = bfd_make_section_with_flags (abfd,
- ".rela.sbss",
- flags | SEC_READONLY);
+ s = bfd_make_section_with_flags (abfd, ".rela.sbss",
+ flags | SEC_READONLY);
+ htab->relsbss = s;
if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
@@ -2279,7 +2281,7 @@ ppc_elf_create_dynamic_sections (bfd *ab
if (s == NULL)
abort ();
- flags = SEC_ALLOC | SEC_CODE | SEC_IN_MEMORY | SEC_LINKER_CREATED;
+ flags = SEC_ALLOC | SEC_CODE | SEC_LINKER_CREATED;
return bfd_set_section_flags (abfd, s, flags);
}
@@ -2626,15 +2628,15 @@ ppc_elf_check_relocs (bfd *abfd,
/* If a relocation refers to _GLOBAL_OFFSET_TABLE_, create the .got.
This shows up in particular in an R_PPC_ADDR32 in the eabi
startup code. */
- if (h && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+ if (h != NULL
+ && htab->got == NULL
+ && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
{
- if (htab->got == NULL)
- {
- if (htab->elf.dynobj == NULL)
- htab->elf.dynobj = abfd;
- if (!ppc_elf_create_got (htab->elf.dynobj, info))
- return FALSE;
- }
+ if (htab->elf.dynobj == NULL)
+ htab->elf.dynobj = abfd;
+ if (!ppc_elf_create_got (htab->elf.dynobj, info))
+ return FALSE;
+ BFD_ASSERT (h == htab->elf.hgot);
}
r_type = ELF32_R_TYPE (rel->r_info);
@@ -2860,8 +2862,7 @@ ppc_elf_check_relocs (bfd *abfd,
case R_PPC_REL14_BRTAKEN:
case R_PPC_REL14_BRNTAKEN:
case R_PPC_REL32:
- if (h == NULL
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+ if (h == NULL || h == htab->elf.hgot)
break;
/* fall through */
@@ -3240,8 +3241,7 @@ ppc_elf_gc_sweep_hook (bfd *abfd,
case R_PPC_REL14_BRTAKEN:
case R_PPC_REL14_BRNTAKEN:
case R_PPC_REL32:
- if (h == NULL
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+ if (h == NULL || h == htab->elf.hgot)
break;
/* Fall thru */
@@ -3648,6 +3648,34 @@ ppc_elf_adjust_dynamic_symbol (struct bf
return TRUE;
}
+/* Allocate NEED contiguous space in .got, and return the offset.
+ Handles allocation of the got header when crossing 32k. */
+
+static bfd_vma
+allocate_got (struct ppc_elf_link_hash_table *htab, unsigned int need)
+{
+ bfd_vma where;
+ unsigned int max_before_header = 32764;
+
+ if (need <= htab->got_gap)
+ {
+ where = max_before_header - htab->got_gap;
+ htab->got_gap -= need;
+ }
+ else
+ {
+ if (htab->got->size + need > max_before_header
+ && htab->got->size <= max_before_header)
+ {
+ htab->got_gap = max_before_header - htab->got->size;
+ htab->got->size = max_before_header + htab->got_header_size;
+ }
+ where = htab->got->size;
+ htab->got->size += need;
+ }
+ return where;
+}
+
/* Allocate space in associated reloc sections for dynamic relocs. */
static bfd_boolean
@@ -3749,33 +3777,32 @@ allocate_dynrelocs (struct elf_link_hash
else
{
bfd_boolean dyn;
- eh->elf.got.offset = htab->got->size;
+ unsigned int need = 0;
if ((eh->tls_mask & TLS_TLS) != 0)
{
if ((eh->tls_mask & TLS_LD) != 0)
- htab->got->size += 8;
+ need += 8;
if ((eh->tls_mask & TLS_GD) != 0)
- htab->got->size += 8;
+ need += 8;
if ((eh->tls_mask & (TLS_TPREL | TLS_TPRELGD)) != 0)
- htab->got->size += 4;
+ need += 4;
if ((eh->tls_mask & TLS_DTPREL) != 0)
- htab->got->size += 4;
+ need += 4;
}
else
- htab->got->size += 4;
+ need += 4;
+ eh->elf.got.offset = allocate_got (htab, need);
dyn = htab->elf.dynamic_sections_created;
if ((info->shared
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, &eh->elf))
&& (ELF_ST_VISIBILITY (eh->elf.other) == STV_DEFAULT
|| eh->elf.root.type != bfd_link_hash_undefweak))
{
- /* All the entries we allocated need relocs. */
- htab->relgot->size
- += ((htab->got->size - eh->elf.got.offset) / 4
- * sizeof (Elf32_External_Rela));
- /* Except LD only needs one. */
+ /* All the entries we allocated need relocs.
+ Except LD only needs one. */
if ((eh->tls_mask & TLS_LD) != 0)
- htab->relgot->size -= sizeof (Elf32_External_Rela);
+ need -= 4;
+ htab->relgot->size += need * (sizeof (Elf32_External_Rela) / 4);
}
}
}
@@ -3932,15 +3959,7 @@ ppc_elf_size_dynamic_sections (bfd *outp
}
}
- if (htab->tlsld_got.refcount > 0)
- {
- htab->tlsld_got.offset = htab->got->size;
- htab->got->size += 8;
- if (info->shared)
- htab->relgot->size += sizeof (Elf32_External_Rela);
- }
- else
- htab->tlsld_got.offset = (bfd_vma) -1;
+ htab->got_header_size = 16;
/* Set up .got offsets for local syms, and space for local dynamic
relocs. */
@@ -3951,7 +3970,6 @@ ppc_elf_size_dynamic_sections (bfd *outp
char *lgot_masks;
bfd_size_type locsymcount;
Elf_Internal_Shdr *symtab_hdr;
- asection *srel;
if (!is_ppc_elf_target (ibfd->xvec))
continue;
@@ -3993,8 +4011,6 @@ ppc_elf_size_dynamic_sections (bfd *outp
locsymcount = symtab_hdr->sh_info;
end_local_got = local_got + locsymcount;
lgot_masks = (char *) end_local_got;
- s = htab->got;
- srel = htab->relgot;
for (; local_got < end_local_got; ++local_got, ++lgot_masks)
if (*local_got > 0)
{
@@ -4002,41 +4018,60 @@ ppc_elf_size_dynamic_sections (bfd *outp
{
/* If just an LD reloc, we'll just use
htab->tlsld_got.offset. */
- if (htab->tlsld_got.offset == (bfd_vma) -1)
- {
- htab->tlsld_got.offset = s->size;
- s->size += 8;
- if (info->shared)
- srel->size += sizeof (Elf32_External_Rela);
- }
+ htab->tlsld_got.refcount += 1;
*local_got = (bfd_vma) -1;
}
else
{
- *local_got = s->size;
+ unsigned int need = 0;
if ((*lgot_masks & TLS_TLS) != 0)
{
if ((*lgot_masks & TLS_GD) != 0)
- s->size += 8;
+ need += 8;
if ((*lgot_masks & (TLS_TPREL | TLS_TPRELGD)) != 0)
- s->size += 4;
+ need += 4;
if ((*lgot_masks & TLS_DTPREL) != 0)
- s->size += 4;
+ need += 4;
}
else
- s->size += 4;
+ need += 4;
+ *local_got = allocate_got (htab, need);
if (info->shared)
- srel->size += ((s->size - *local_got) / 4
- * sizeof (Elf32_External_Rela));
+ htab->relgot->size += (need
+ * (sizeof (Elf32_External_Rela) / 4));
}
}
else
*local_got = (bfd_vma) -1;
}
+ if (htab->tlsld_got.refcount > 0)
+ {
+ htab->tlsld_got.offset = allocate_got (htab, 8);
+ if (info->shared)
+ htab->relgot->size += sizeof (Elf32_External_Rela);
+ }
+ else
+ htab->tlsld_got.offset = (bfd_vma) -1;
+
/* Allocate space for global sym dynamic relocs. */
elf_link_hash_traverse (elf_hash_table (info), allocate_dynrelocs, info);
+ if (htab->got != NULL)
+ {
+ unsigned int g_o_t = 32768;
+
+ /* If we haven't allocated the header, do so now. */
+ if (htab->got->size <= 32768)
+ {
+ g_o_t = htab->got->size;
+ htab->got->size += htab->got_header_size;
+ }
+ g_o_t += 4;
+
+ htab->elf.hgot->root.u.def.value = g_o_t;
+ }
+
/* We've now determined the sizes of the various dynamic sections.
Allocate memory for them. */
relocs = FALSE;
@@ -5273,7 +5308,8 @@ ppc_elf_relocate_section (bfd *output_bf
}
}
- relocation = htab->got->output_offset + off - 4;
+ relocation = htab->got->output_offset + off;
+ relocation -= htab->elf.hgot->root.u.def.value;
/* Addends on got relocations don't make much sense.
x+off@got is actually x@got+off, and since the got is
@@ -5347,7 +5383,7 @@ ppc_elf_relocate_section (bfd *output_bf
/* If these relocations are not to a named symbol, they can be
handled right here, no need to bother the dynamic linker. */
if (SYMBOL_REFERENCES_LOCAL (info, h)
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+ || h == htab->elf.hgot)
break;
/* fall through */
@@ -5952,8 +5988,8 @@ ppc_elf_finish_dynamic_symbol (bfd *outp
#endif
/* Mark some specially defined symbols as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
+ if (h == htab->elf.hgot
+ || strcmp (h->root.root.string, "_DYNAMIC") == 0
|| strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0)
sym->st_shndx = SHN_ABS;
@@ -6035,17 +6071,18 @@ ppc_elf_finish_dynamic_sections (bfd *ou
/* Add a blrl instruction at _GLOBAL_OFFSET_TABLE_-4 so that a function can
easily find the address of the _GLOBAL_OFFSET_TABLE_. */
- if (htab->got)
+ if (htab->got != NULL)
{
- unsigned char *contents = htab->got->contents;
- bfd_put_32 (output_bfd, 0x4e800021 /* blrl */, contents);
+ unsigned char *p = htab->got->contents;
+ bfd_vma val;
- if (sdyn == NULL)
- bfd_put_32 (output_bfd, 0, contents + 4);
- else
- bfd_put_32 (output_bfd,
- sdyn->output_section->vma + sdyn->output_offset,
- contents + 4);
+ p += elf_hash_table (info)->hgot->root.u.def.value;
+ bfd_put_32 (output_bfd, 0x4e800021 /* blrl */, p - 4);
+
+ val = 0;
+ if (sdyn != NULL)
+ val = sdyn->output_section->vma + sdyn->output_offset;
+ bfd_put_32 (output_bfd, val, p);
elf_section_data (htab->got->output_section)->this_hdr.sh_entsize = 4;
}
@@ -6076,10 +6113,8 @@ ppc_elf_finish_dynamic_sections (bfd *ou
#endif
#define elf_backend_plt_not_loaded 1
-#define elf_backend_got_symbol_offset 4
#define elf_backend_can_gc_sections 1
#define elf_backend_can_refcount 1
-#define elf_backend_got_header_size 12
#define elf_backend_rela_normal 1
#define bfd_elf32_mkobject ppc_elf_mkobject
Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.203
diff -u -p -r1.203 elf64-ppc.c
--- bfd/elf64-ppc.c 5 May 2005 14:33:55 -0000 1.203
+++ bfd/elf64-ppc.c 6 May 2005 07:02:19 -0000
@@ -67,7 +67,6 @@ static bfd_vma opd_entry_value
#define elf_backend_want_plt_sym 0
#define elf_backend_plt_alignment 3
#define elf_backend_plt_not_loaded 1
-#define elf_backend_got_symbol_offset 0
#define elf_backend_got_header_size 8
#define elf_backend_can_gc_sections 1
#define elf_backend_can_refcount 1
Index: ld/testsuite/ld-powerpc/tlsexe32.d
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-powerpc/tlsexe32.d,v
retrieving revision 1.7
diff -u -p -r1.7 tlsexe32.d
--- ld/testsuite/ld-powerpc/tlsexe32.d 16 Mar 2005 02:41:27 -0000 1.7
+++ ld/testsuite/ld-powerpc/tlsexe32.d 6 May 2005 07:02:31 -0000
@@ -9,9 +9,9 @@
Disassembly of section \.text:
.* <_start>:
-.*: 80 7f 00 0c lwz r3,12\(r31\)
+.*: 80 7f ff f0 lwz r3,-16\(r31\)
.*: 7c 63 12 14 add r3,r3,r2
-.*: 38 7f 00 10 addi r3,r31,16
+.*: 38 7f ff f4 addi r3,r31,-12
.*: 48 01 01 85 bl .*<__tls_get_addr@plt>
.*: 3c 62 00 00 addis r3,r2,0
.*: 38 63 90 1c addi r3,r3,-28644
@@ -39,8 +39,9 @@ Disassembly of section \.text:
.*: a9 49 90 18 lha r10,-28648\(r9\)
Disassembly of section \.got:
-.* <_GLOBAL_OFFSET_TABLE_-0x4>:
+.* <_GLOBAL_OFFSET_TABLE_-0x10>:
+ \.\.\.
.*: 4e 80 00 21 blrl
+
.* <_GLOBAL_OFFSET_TABLE_>:
-.*: 01 81 02 d0 00 00 00 00 00 00 00 00 00 00 00 00 .*
- \.\.\.
+.*: 01 81 02 d0 00 00 00 00 00 00 00 00 .*
Index: ld/testsuite/ld-powerpc/tlsexe32.g
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-powerpc/tlsexe32.g,v
retrieving revision 1.3
diff -u -p -r1.3 tlsexe32.g
--- ld/testsuite/ld-powerpc/tlsexe32.g 16 Mar 2005 02:41:28 -0000 1.3
+++ ld/testsuite/ld-powerpc/tlsexe32.g 6 May 2005 07:02:31 -0000
@@ -7,5 +7,5 @@
.*: +file format elf32-powerpc
Contents of section \.got:
-.* 4e800021 018102d0 00000000 00000000 .*
-.* 00000000 00000000 00000000 .*
+.* 00000000 00000000 00000000 4e800021 .*
+.* 018102d0 00000000 00000000 .*
Index: ld/testsuite/ld-powerpc/tlsexe32.r
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-powerpc/tlsexe32.r,v
retrieving revision 1.8
diff -u -p -r1.8 tlsexe32.r
--- ld/testsuite/ld-powerpc/tlsexe32.r 21 Mar 2005 13:56:56 -0000 1.8
+++ ld/testsuite/ld-powerpc/tlsexe32.r 6 May 2005 07:02:31 -0000
@@ -52,8 +52,8 @@ Program Headers:
Relocation section '\.rela\.dyn' at offset 0x220 contains 2 entries:
Offset +Info +Type +Sym\. Value +Symbol's Name \+ Addend
-01810380 +00000249 R_PPC_TPREL32 +00000000 +gd \+ 0
-01810384 +00000444 R_PPC_DTPMOD32 +00000000 +ld \+ 0
+01810370 +00000249 R_PPC_TPREL32 +00000000 +gd \+ 0
+01810374 +00000444 R_PPC_DTPMOD32 +00000000 +ld \+ 0
Relocation section '\.rela\.plt' at offset 0x238 contains 1 entries:
Offset +Info +Type +Sym\. Value +Symbol's Name \+ Addend
@@ -109,7 +109,7 @@ Symbol table '\.symtab' contains 40 entr
.*: 00000024 +0 TLS +GLOBAL DEFAULT +9 ld1
.*: [0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS __bss_start
.*: [0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS _edata
-.*: 01810374 +0 OBJECT +GLOBAL +HIDDEN +11 _GLOBAL_OFFSET_TABLE_
+.*: 01810380 +0 OBJECT +GLOBAL +HIDDEN +11 _GLOBAL_OFFSET_TABLE_
.*: [0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS _end
.*: 0000001c +0 TLS +GLOBAL DEFAULT +9 gd0
.*: 0000002c +0 TLS +GLOBAL DEFAULT +9 ie0
Index: ld/testsuite/ld-powerpc/tlsso32.d
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-powerpc/tlsso32.d,v
retrieving revision 1.9
diff -u -p -r1.9 tlsso32.d
--- ld/testsuite/ld-powerpc/tlsso32.d 21 Mar 2005 13:56:57 -0000 1.9
+++ ld/testsuite/ld-powerpc/tlsso32.d 6 May 2005 07:02:31 -0000
@@ -9,30 +9,30 @@
Disassembly of section \.text:
.* <_start>:
-.*: 38 7f 00 1c addi r3,r31,28
+.*: 38 7f ff e8 addi r3,r31,-24
.*: 48 00 00 01 bl .*
-.*: 38 7f 00 0c addi r3,r31,12
+.*: 38 7f ff e0 addi r3,r31,-32
.*: 48 00 00 01 bl .*
-.*: 38 7f 00 24 addi r3,r31,36
+.*: 38 7f ff f0 addi r3,r31,-16
.*: 48 01 01 95 bl .*<__tls_get_addr@plt>
-.*: 38 7f 00 0c addi r3,r31,12
+.*: 38 7f ff e0 addi r3,r31,-32
.*: 48 01 01 8d bl .*<__tls_get_addr@plt>
.*: 39 23 80 20 addi r9,r3,-32736
.*: 3d 23 00 00 addis r9,r3,0
.*: 81 49 80 24 lwz r10,-32732\(r9\)
-.*: 81 3f 00 2c lwz r9,44\(r31\)
+.*: 81 3f ff f8 lwz r9,-8\(r31\)
.*: 7d 49 12 2e lhzx r10,r9,r2
.*: 89 42 00 00 lbz r10,0\(r2\)
.*: 3d 22 00 00 addis r9,r2,0
.*: 99 49 00 00 stb r10,0\(r9\)
-.*: 38 7e 00 14 addi r3,r30,20
+.*: 38 7e ff d8 addi r3,r30,-40
.*: 48 00 00 01 bl .*
-.*: 38 7e 00 0c addi r3,r30,12
+.*: 38 7e ff e0 addi r3,r30,-32
.*: 48 00 00 01 bl .*
.*: 91 43 80 04 stw r10,-32764\(r3\)
.*: 3d 23 00 00 addis r9,r3,0
.*: 91 49 80 08 stw r10,-32760\(r9\)
-.*: 81 3e 00 2c lwz r9,44\(r30\)
+.*: 81 3e ff f8 lwz r9,-8\(r30\)
.*: 7d 49 13 2e sthx r10,r9,r2
.*: a1 42 00 00 lhz r10,0\(r2\)
.*: 3d 22 00 00 addis r9,r2,0
@@ -40,6 +40,7 @@ Disassembly of section \.text:
Disassembly of section \.got:
.* <\.got>:
+ \.\.\.
.*: 4e 80 00 21 blrl
.*: 00 01 04 90 .*
\.\.\.
Index: ld/testsuite/ld-powerpc/tlsso32.g
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-powerpc/tlsso32.g,v
retrieving revision 1.5
diff -u -p -r1.5 tlsso32.g
--- ld/testsuite/ld-powerpc/tlsso32.g 21 Mar 2005 13:56:57 -0000 1.5
+++ ld/testsuite/ld-powerpc/tlsso32.g 6 May 2005 07:02:31 -0000
@@ -7,7 +7,7 @@
.*: +file format elf32-powerpc
Contents of section \.got:
-.* 4e800021 00010490 00000000 00000000 .*
.* 00000000 00000000 00000000 00000000 .*
.* 00000000 00000000 00000000 00000000 .*
+.* 00000000 4e800021 00010490 00000000 .*
.* 00000000 .*
Index: ld/testsuite/ld-powerpc/tlsso32.r
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-powerpc/tlsso32.r,v
retrieving revision 1.10
diff -u -p -r1.10 tlsso32.r
--- ld/testsuite/ld-powerpc/tlsso32.r 21 Mar 2005 13:56:57 -0000 1.10
+++ ld/testsuite/ld-powerpc/tlsso32.r 6 May 2005 07:02:31 -0000
@@ -55,14 +55,14 @@ Relocation section '\.rela\.dyn' at offs
0+46a +0+245 R_PPC_TPREL16 +0+10474 +\.tdata \+ 10488
0+46e +0+248 R_PPC_TPREL16_HA +0+10474 +\.tdata \+ 1048c
0+472 +0+246 R_PPC_TPREL16_LO +0+10474 +\.tdata \+ 1048c
-0+10540 +0+44 R_PPC_DTPMOD32 +0+
-0+10548 +0+44 R_PPC_DTPMOD32 +0+
-0+1054c +0+4e R_PPC_DTPREL32 +0+
-0+10550 +0+844 R_PPC_DTPMOD32 +0+ +gd \+ 0
-0+10554 +0+84e R_PPC_DTPREL32 +0+ +gd \+ 0
-0+10558 +0+1544 R_PPC_DTPMOD32 +0+1c +gd0 \+ 0
-0+1055c +0+154e R_PPC_DTPREL32 +0+1c +gd0 \+ 0
-0+10560 +0+1649 R_PPC_TPREL32 +0+2c +ie0 \+ 0
+0+10530 +0+44 R_PPC_DTPMOD32 +0+
+0+10534 +0+4e R_PPC_DTPREL32 +0+
+0+10538 +0+44 R_PPC_DTPMOD32 +0+
+0+10540 +0+844 R_PPC_DTPMOD32 +0+ +gd \+ 0
+0+10544 +0+84e R_PPC_DTPREL32 +0+ +gd \+ 0
+0+10548 +0+1544 R_PPC_DTPMOD32 +0+1c +gd0 \+ 0
+0+1054c +0+154e R_PPC_DTPREL32 +0+1c +gd0 \+ 0
+0+10550 +0+1649 R_PPC_TPREL32 +0+2c +ie0 \+ 0
Relocation section '\.rela\.plt' at offset 0x[0-9a-f]+ contains 1 entries:
Offset +Info +Type +Sym\. Value +Symbol's Name \+ Addend
@@ -118,7 +118,7 @@ Symbol table '\.symtab' contains 39 entr
+[0-9]+: 0+10 +0 TLS +LOCAL +DEFAULT +7 ie4
+[0-9]+: 0+14 +0 TLS +LOCAL +DEFAULT +7 le4
+[0-9]+: 0+18 +0 TLS +LOCAL +DEFAULT +7 le5
- +[0-9]+: 0+10534 +0 OBJECT +LOCAL +HIDDEN +ABS _GLOBAL_OFFSET_TABLE_
+ +[0-9]+: 0+10558 +0 OBJECT +LOCAL +HIDDEN +ABS _GLOBAL_OFFSET_TABLE_
+[0-9]+: 0+10490 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC
+[0-9]+: 0+ +0 TLS +GLOBAL DEFAULT +UND gd
+[0-9]+: 0+30 +0 TLS +GLOBAL DEFAULT +8 le0
--
Alan Modra
IBM OzLabs - Linux Technology Centre