* 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:
Nathan Sidwell
2009-10-07 07:25:36 +00:00
parent 700d40ca16
commit 5c1a3f0fa7
6 changed files with 79 additions and 4 deletions

View File

@@ -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;
}