diff options
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; } |