aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2009-03-14 09:14:30 +0000
committerRichard Sandiford <rdsandiford@googlemail.com>2009-03-14 09:14:30 +0000
commit9ec59d51e9ad0caf39d28ca85cf4a55bbbbc3929 (patch)
tree2daea64c35a65c61bac80c5c5b2035b625fff44b /ld/emultempl
parente52315924b94ebfea09366bebb535692f274dc52 (diff)
downloadgdb-9ec59d51e9ad0caf39d28ca85cf4a55bbbbc3929.zip
gdb-9ec59d51e9ad0caf39d28ca85cf4a55bbbbc3929.tar.gz
gdb-9ec59d51e9ad0caf39d28ca85cf4a55bbbbc3929.tar.bz2
ld/
* emultempl/aix.em (gld${EMULATION_NAME}_before_allocation): Mark .text, .data and .bss output sections as SEC_KEEP. ld/testsuite/ * ld-powerpc/aix-core-sec-1.s, ld-powerpc/aix-core-sec-1.ex, ld-powerpc/aix-core-sec-1.hd, ld-powerpc/aix-core-sec-2.s, ld-powerpc/aix-core-sec-2.ex, ld-powerpc/aix-core-sec-2.hd, ld-powerpc/aix-core-sec-3.s, ld-powerpc/aix-core-sec-3.ex, ld-powerpc/aix-core-sec-3.hd: New tests. * ld-powerpc/aix52.exp: New harness.
Diffstat (limited to 'ld/emultempl')
-rw-r--r--ld/emultempl/aix.em23
1 files changed, 22 insertions, 1 deletions
diff --git a/ld/emultempl/aix.em b/ld/emultempl/aix.em
index ecb6645..b30000b 100644
--- a/ld/emultempl/aix.em
+++ b/ld/emultempl/aix.em
@@ -616,7 +616,12 @@ gld${EMULATION_NAME}_before_allocation (void)
struct export_symbol_list *el;
char *libpath;
asection *special_sections[XCOFF_NUMBER_OF_SPECIAL_SECTIONS];
- int i;
+ static const char *const must_keep_sections[] = {
+ ".text",
+ ".data",
+ ".bss"
+ };
+ unsigned int i;
/* Handle the import and export files, if any. */
for (fl = import_files; fl != NULL; fl = fl->next)
@@ -824,6 +829,22 @@ gld${EMULATION_NAME}_before_allocation (void)
}
}
+ /* Executables and shared objects must always have .text, .data
+ and .bss output sections, so that the header can refer to them.
+ The kernel refuses to load objects that have missing sections. */
+ if (!link_info.relocatable)
+ for (i = 0; i < ARRAY_SIZE (must_keep_sections); i++)
+ {
+ asection *sec;
+
+ sec = bfd_get_section_by_name (link_info.output_bfd,
+ must_keep_sections[i]);
+ if (sec == NULL)
+ einfo ("%P: can't find required output section %s\n", must_keep_sections[i]);
+ else
+ sec->flags |= SEC_KEEP;
+ }
+
before_allocation_default ();
}