summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2005-03-16 02:42:26 +0000
committerAlan Modra <amodra@bigpond.net.au>2005-03-16 02:42:26 +0000
commit93e6d6556f19595415deab9be31c43fd91829bf7 (patch)
treeb39ed5be2e5c74d25642a989e38afa146bb144e9
parent53c9f48b6c51f2230f693e247b1e4db2d78dfe70 (diff)
downloadgdb-93e6d6556f19595415deab9be31c43fd91829bf7.tar.gz
bfd/
* elf32-ppc.c (ppc_elf_create_linker_section): Set SEC_LINKER_CREATED on section. Correct comment, and add FIXME. (ppc_elf_additional_program_headers): Don't bump header count for interp. Test SEC_ALLOC, not SEC_LOAD, and don't test size. (ppc_elf_size_dynamic_sections): Don't strip sdata and sdata2, but do allocate memory if they need it. ld/ * emulparams/elf32ppclinux.sh (OTHER_READWRITE_SECTION): Delete. (OTHER_RELRO_SECTIONS): Set this instead. ld/testsuite/ * ld-powerpc/tlsexe32.d: Update. * ld-powerpc/tlsexe32.g: Update. * ld-powerpc/tlsexe32.r: Update. * ld-powerpc/tlsexe32.t: Update. * ld-powerpc/tlsso32.d: Update. * ld-powerpc/tlsso32.g: Update. * ld-powerpc/tlsso32.r: Update. * ld-powerpc/tlsso32.t: Update.
-rw-r--r--bfd/ChangeLog9
-rw-r--r--bfd/elf32-ppc.c46
2 files changed, 33 insertions, 22 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index d6c9a2bba9d..9114c4e5ccd 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,12 @@
+2005-03-16 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c (ppc_elf_create_linker_section): Set SEC_LINKER_CREATED
+ on section. Correct comment, and add FIXME.
+ (ppc_elf_additional_program_headers): Don't bump header count for
+ interp. Test SEC_ALLOC, not SEC_LOAD, and don't test size.
+ (ppc_elf_size_dynamic_sections): Don't strip sdata and sdata2, but
+ do allocate memory if they need it.
+
2005-03-15 Alan Modra <amodra@bigpond.net.au>
* po/es.po: Commit new Spanish translation.
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index b38a48ab28d..0866e465f03 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -2606,15 +2606,16 @@ ppc_elf_create_linker_section (bfd *abfd,
const char *sym_name;
bfd_vma sym_offset;
- /* Both of these sections are (technically) created by the user
- putting data in them, so they shouldn't be marked
- SEC_LINKER_CREATED.
-
- The linker creates them so it has somewhere to attach their
- respective symbols. In fact, if they were empty it would
- be OK to leave the symbol set to 0 (or any random number), because
- the appropriate register should never be used. */
- flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY;
+ /* The linker creates these sections so it has somewhere to attach
+ their respective symbols. Startup code (crt1.o) uses these symbols
+ to initialize a register pointing to the section. If the output
+ sections corresponding to these input sections were empty it would
+ be OK to set the symbol to 0 (or any random number), because the
+ associated register should never be used.
+ FIXME: Setting a symbol this way is silly. The symbols ought to
+ be set the same way other backends set gp. */
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED);
sym_offset = 32768;
switch (which)
@@ -2711,27 +2712,21 @@ ppc_elf_create_linker_section (bfd *abfd,
return lsect;
}
-/* If we have a non-zero sized .sbss2 or .PPC.EMB.sbss0 sections, we
+/* If we have .sbss2 or .PPC.EMB.sbss0 output sections, we
need to bump up the number of section headers. */
static int
ppc_elf_additional_program_headers (bfd *abfd)
{
asection *s;
- int ret;
-
- ret = 0;
-
- s = bfd_get_section_by_name (abfd, ".interp");
- if (s != NULL)
- ++ret;
+ int ret = 0;
s = bfd_get_section_by_name (abfd, ".sbss2");
- if (s != NULL && (s->flags & SEC_LOAD) != 0 && s->size > 0)
+ if (s != NULL && (s->flags & SEC_ALLOC) != 0)
++ret;
s = bfd_get_section_by_name (abfd, ".PPC.EMB.sbss0");
- if (s != NULL && (s->flags & SEC_LOAD) != 0 && s->size > 0)
+ if (s != NULL && (s->flags & SEC_ALLOC) != 0)
++ret;
return ret;
@@ -3394,13 +3389,20 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
continue;
if (s == htab->plt
- || s == htab->got
- || (htab->sdata != NULL && s == htab->sdata->section)
- || (htab->sdata2 != NULL && s == htab->sdata2->section))
+ || s == htab->got)
{
/* Strip this section if we don't need it; see the
comment below. */
}
+ else if ((htab->sdata != NULL && s == htab->sdata->section)
+ || (htab->sdata2 != NULL && s == htab->sdata2->section))
+ {
+ if (s->size == 0)
+ /* Don't strip these sections. We need them because they
+ define _SDA_BASE_ and _SDA2_BASE_. crt1.o makes a
+ reference to _SDA_BASE_ to set up r13. */
+ continue;
+ }
else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0)
{
if (s->size == 0)