diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2009-10-07 07:25:36 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@codesourcery.com> | 2009-10-07 07:25:36 +0000 |
commit | 5c1a3f0fa74b2b0cc679d03e4158b4f37ae973f1 (patch) | |
tree | 3c22356e4655f4502c04d3602f380617e17d5b10 /ld/ldlang.c | |
parent | 700d40ca16eb3ba1ecc1e602cb3eec175bdf70f0 (diff) | |
download | gdb-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.c | 10 |
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; } |