aboutsummaryrefslogtreecommitdiff
path: root/ld/ldlang.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2009-10-07 07:25:36 +0000
committerNathan Sidwell <nathan@codesourcery.com>2009-10-07 07:25:36 +0000
commit5c1a3f0fa74b2b0cc679d03e4158b4f37ae973f1 (patch)
tree3c22356e4655f4502c04d3602f380617e17d5b10 /ld/ldlang.c
parent700d40ca16eb3ba1ecc1e602cb3eec175bdf70f0 (diff)
downloadgdb-5c1a3f0fa74b2b0cc679d03e4158b4f37ae973f1.zip
gdb-5c1a3f0fa74b2b0cc679d03e4158b4f37ae973f1.tar.gz
gdb-5c1a3f0fa74b2b0cc679d03e4158b4f37ae973f1.tar.bz2
ld/
* ldlang.c (lang_new_phdr): Check PHDRS and FILEHDR in loadable segments do not appear after a different loadable segment. * ld.texinfo (PHDRS): Document order of processing segments. Document where PHDRS and FILEHDR may appear. ld/testsuite/ * ld-scripts/phdrs3.d: New. * ld-scripts/phdrs3.t: New. * ld-scripts/phdrs3.exp: New.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r--ld/ldlang.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 8371370..a46438e 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -6765,6 +6765,7 @@ lang_new_phdr (const char *name,
etree_type *flags)
{
struct lang_phdr *n, **pp;
+ bfd_boolean hdrs;
n = (struct lang_phdr *) stat_alloc (sizeof (struct lang_phdr));
n->next = NULL;
@@ -6774,9 +6775,16 @@ lang_new_phdr (const char *name,
n->phdrs = phdrs;
n->at = at;
n->flags = flags;
+
+ hdrs = n->type == 1 && (phdrs || filehdr);
for (pp = &lang_phdr_list; *pp != NULL; pp = &(*pp)->next)
- ;
+ if (hdrs && (*pp)->type == 1)
+ {
+ einfo (_("%X%P:%S: PHDRS and FILEHDR are only permitted for the first PT_LOAD segment\n"));
+ hdrs = FALSE;
+ }
+
*pp = n;
}