forked from Imagelibrary/binutils-gdb
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.
This commit is contained in:
10
ld/ldlang.c
10
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user