summaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2002-12-04 23:56:14 +0000
committerAlan Modra <amodra@bigpond.net.au>2002-12-04 23:56:14 +0000
commit23c86d99c19c3ce03d1345445a56d1cdb60a6789 (patch)
treeb48909d55eac1c0895d9cdd9f600c5538668211b /ld
parent0ab20d319f459725e7c56ec92cf0f08b3223e5e6 (diff)
downloadbinutils-redhat-23c86d99c19c3ce03d1345445a56d1cdb60a6789.tar.gz
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Set
load_base for orphans that follow a section with load_base set.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog5
-rw-r--r--ld/emultempl/elf32.em16
2 files changed, 18 insertions, 3 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 37f1412dfb..09b9c7de1e 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,8 @@
+2002-12-05 Alan Modra <amodra@bigpond.net.au>
+
+ * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Set
+ load_base for orphans that follow a section with load_base set.
+
2002-12-01 H.J. Lu <hjl@gnu.org>
* ld.texinfo: Remove the extra `;' in sample version script.
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 60a789eb37..06fdd81360 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -1093,6 +1093,7 @@ gld${EMULATION_NAME}_place_orphan (file, s)
const char *secname;
const char *ps = NULL;
lang_output_section_statement_type *os;
+ etree_type *load_base;
int isdyn = 0;
secname = bfd_get_section_name (s->owner, s);
@@ -1227,16 +1228,25 @@ gld${EMULATION_NAME}_place_orphan (file, s)
}
}
+ address = NULL;
if (link_info.relocateable || (s->flags & (SEC_LOAD | SEC_ALLOC)) == 0)
address = exp_intop ((bfd_vma) 0);
- else
- address = NULL;
+
+ load_base = NULL;
+ if (place != NULL && place->os->load_base != NULL)
+ {
+ etree_type *lma_from_vma;
+ lma_from_vma = exp_binop ('-', place->os->load_base,
+ exp_nameop (ADDR, place->os->name));
+ load_base = exp_binop ('+', lma_from_vma,
+ exp_nameop (ADDR, secname));
+ }
os = lang_enter_output_section_statement (secname, address, 0,
(bfd_vma) 0,
(etree_type *) NULL,
(etree_type *) NULL,
- (etree_type *) NULL);
+ load_base);
lang_add_section (&os->children, s, os, file);