aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorTom Rix <trix@redhat.com>2002-01-03 22:06:38 +0000
committerTom Rix <trix@redhat.com>2002-01-03 22:06:38 +0000
commit04b5af89eacadbe75e37b0eb8acb6e8c90da2636 (patch)
tree2b93a9c0a14a95622b539657eb137386aeb0554c /bfd
parent741247bffa06dd2bb6738dd54fed98221347b418 (diff)
downloadgdb-04b5af89eacadbe75e37b0eb8acb6e8c90da2636.zip
gdb-04b5af89eacadbe75e37b0eb8acb6e8c90da2636.tar.gz
gdb-04b5af89eacadbe75e37b0eb8acb6e8c90da2636.tar.bz2
Fix xcoff linker's ordering of pad sections
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/xcofflink.c51
2 files changed, 35 insertions, 21 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b5b8212..0f4c1dc 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2002-01-03 Tom Rix <trix@redhat.com>
+
+ * xcofflink.c (_bfd_xcoff_bfd_final_link): Update .pad section ordering
+ for recent bfd_make_section_anyway change.
+
2002-01-03 Nick Clifton <nickc@cambridge.redhat.com>
* elf32-arm.h (elf32_arm_final_link_relocate): Handle
diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c
index e27f648..1995769 100644
--- a/bfd/xcofflink.c
+++ b/bfd/xcofflink.c
@@ -3656,14 +3656,15 @@ _bfd_xcoff_bfd_final_link (abfd, info)
{
boolean saw_contents;
int indx;
- asection **op;
+ asection **op, **prev;
file_ptr sofar;
-
+
/* Insert .pad sections before every section which has
contents and is loaded, if it is preceded by some other
section which has contents and is loaded. */
saw_contents = true;
- for (op = &abfd->sections; *op != NULL; op = &(*op)->next)
+ for (op = &abfd->sections, prev = NULL;
+ *op != NULL; prev = op, op = &(*op)->next)
{
if (strcmp ((*op)->name, ".pad") == 0)
saw_contents = false;
@@ -3674,20 +3675,39 @@ _bfd_xcoff_bfd_final_link (abfd, info)
saw_contents = true;
else
{
- asection *n, *hold;
-
+ asection *n, *hold, **st;
+
+ /* Create a pad section and place it before the section
+ that needs padding. This requires unlinking and
+ relinking the bfd's sections list.
+
+ sections = S1
+ . S1.next = S2
+ . S2.next = S3
+ . S3.next = NULL
+ section_tail = &S3.next */
+
hold = *op;
- *op = NULL;
+ st = abfd->section_tail;
+
n = bfd_make_section_anyway (abfd, ".pad");
- BFD_ASSERT (*op == n);
- n->next = hold;
n->flags = SEC_HAS_CONTENTS;
- n->alignment_power = 0;
+ n->alignment_power = 0;
+
+ if (NULL == prev)
+ abfd->sections = n;
+ else
+ (*prev)->next = n;
+
+ n->next = hold;
+ *st = NULL;
+ abfd->section_tail = st;
+
saw_contents = false;
}
}
}
-
+
/* Reset the section indices after inserting the new
sections. */
indx = 0;
@@ -3958,17 +3978,6 @@ _bfd_xcoff_bfd_final_link (abfd, info)
goto error_return;
}
- /* init-fini */
- if (info->init_function || info->fini_function)
- {
- struct xcoff_link_hash_entry *hrtinit;
-
- hrtinit = xcoff_link_hash_lookup (xcoff_hash_table (info),
- "__rtinit",
- false, false, true);
- }
-
-
/* Write out all the global symbols which do not come from XCOFF
input files. */
xcoff_link_hash_traverse (xcoff_hash_table (info),