aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1995-11-09 18:11:03 +0000
committerIan Lance Taylor <ian@airs.com>1995-11-09 18:11:03 +0000
commit97121c41e92ad27bfbf7d8c9814793056e2161be (patch)
tree2111cf3fa908965c28f509b7626fe5a1b0e41753 /ld
parentee17481566f6be499901644030897308d18eb18f (diff)
downloadfsf-binutils-gdb-97121c41e92ad27bfbf7d8c9814793056e2161be.zip
fsf-binutils-gdb-97121c41e92ad27bfbf7d8c9814793056e2161be.tar.gz
fsf-binutils-gdb-97121c41e92ad27bfbf7d8c9814793056e2161be.tar.bz2
* emultempl/aix.em (gld${EMULATION_NAME}_before_allocation): Add
new local variable special_sections, and pass it to size_dynamic_sections. Look through the results, and move the sections around in the mapping so that they are defined correctly.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog7
-rw-r--r--ld/emultempl/aix.em109
2 files changed, 115 insertions, 1 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index a5fdcbf..56986e5 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,10 @@
+Thu Nov 9 13:09:29 1995 Ian Lance Taylor <ian@cygnus.com>
+
+ * emultempl/aix.em (gld${EMULATION_NAME}_before_allocation): Add
+ new local variable special_sections, and pass it to
+ size_dynamic_sections. Look through the results, and move the
+ sections around in the mapping so that they are defined correctly.
+
Wed Nov 8 11:40:59 1995 Ian Lance Taylor <ian@cygnus.com>
* ldemul.c (ldemul_default_target): Cast getenv return value.
diff --git a/ld/emultempl/aix.em b/ld/emultempl/aix.em
index 971eeed..5447697 100644
--- a/ld/emultempl/aix.em
+++ b/ld/emultempl/aix.em
@@ -433,6 +433,8 @@ gld${EMULATION_NAME}_before_allocation ()
struct filelist *fl;
struct export_symbol_list *el;
char *libpath;
+ asection *special_sections[6];
+ int i;
/* Handle the import and export files, if any. */
for (fl = import_files; fl != NULL; fl = fl->next)
@@ -487,8 +489,113 @@ gld${EMULATION_NAME}_before_allocation ()
maxstack, maxdata,
gc ? true : false,
modtype,
- textro ? true : false))
+ textro ? true : false,
+ special_sections))
einfo ("%P%F: failed to set dynamic section sizes: %E\n");
+
+ /* Look through the special sections, and put them in the right
+ place in the link ordering. This is especially magic. */
+ for (i = 0; i < 6; i++)
+ {
+ asection *sec;
+ lang_output_section_statement_type *os;
+ lang_statement_union_type **pls;
+ lang_input_section_type *is;
+ const char *oname;
+ boolean start;
+
+ sec = special_sections[i];
+ if (sec == NULL)
+ continue;
+
+ /* Remove this section from the list of the output section.
+ This assumes we know what the script looks like. */
+ is = NULL;
+ os = lang_output_section_find (sec->output_section->name);
+ if (os == NULL)
+ einfo ("%P%F: can't find output section %s\n",
+ sec->output_section->name);
+ for (pls = &os->children.head; *pls != NULL; pls = &(*pls)->next)
+ {
+ if ((*pls)->header.type == lang_input_section_enum
+ && (*pls)->input_section.section == sec)
+ {
+ is = (lang_input_section_type *) *pls;
+ *pls = (*pls)->next;
+ break;
+ }
+ if ((*pls)->header.type == lang_wild_statement_enum)
+ {
+ lang_statement_union_type **pwls;
+
+ for (pwls = &(*pls)->wild_statement.children.head;
+ *pwls != NULL;
+ pwls = &(*pwls)->next)
+ {
+ if ((*pwls)->header.type == lang_input_section_enum
+ && (*pwls)->input_section.section == sec)
+ {
+ is = (lang_input_section_type *) *pwls;
+ *pwls = (*pwls)->next;
+ break;
+ }
+ }
+ if (is != NULL)
+ break;
+ }
+ }
+
+ if (is == NULL)
+ einfo ("%P%F: can't find %s in output section\n",
+ bfd_get_section_name (sec->owner, sec));
+
+ /* Now figure out where the section should go. */
+ switch (i)
+ {
+ default: /* to avoid warnings */
+ case 0:
+ /* _text */
+ oname = ".text";
+ start = true;
+ break;
+ case 1:
+ /* _etext */
+ oname = ".text";
+ start = false;
+ break;
+ case 2:
+ /* _data */
+ oname = ".data";
+ start = true;
+ break;
+ case 3:
+ /* _edata */
+ oname = ".data";
+ start = false;
+ break;
+ case 4:
+ case 5:
+ /* _end and end */
+ oname = ".bss";
+ start = false;
+ break;
+ }
+
+ os = lang_output_section_find (oname);
+
+ if (start)
+ {
+ is->header.next = os->children.head;
+ os->children.head = (lang_statement_union_type *) is;
+ }
+ else
+ {
+ is->header.next = NULL;
+ lang_statement_append (&os->children,
+ (lang_statement_union_type *) is,
+ &is->header.next);
+ }
+ }
}
/* Read an import or export file. For an import file, this is called