From e94425729cbce686e83117b6b008dd7860199910 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 31 Aug 2007 00:39:53 +0000 Subject: [PATCH] * ldlang.c (lang_record_phdrs): Give a fatal error if no sections assigned to phdrs. Avoid multiple forward scans for a section with phdr assignment. --- ld/ChangeLog | 6 ++++++ ld/ldlang.c | 13 ++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index a2bee5fc4f4..8a94b2e1e56 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2007-08-31 Alan Modra + + * ldlang.c (lang_record_phdrs): Give a fatal error if no sections + assigned to phdrs. Avoid multiple forward scans for a section + with phdr assignment. + 2007-08-28 Mark Shinwell Joseph Myers diff --git a/ld/ldlang.c b/ld/ldlang.c index 1fcb991ae32..f247a173315 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -6263,9 +6263,7 @@ lang_record_phdrs (void) || (os->bfd_section->flags & SEC_ALLOC) == 0) continue; - if (last) - pl = last; - else + if (last == NULL) { lang_output_section_statement_type * tmp_os; @@ -6279,9 +6277,14 @@ lang_record_phdrs (void) http://sourceware.org/ml/binutils/2007-02/msg00291.html */ for (tmp_os = os; tmp_os; tmp_os = tmp_os->next) if (tmp_os->phdrs) - break; - pl = tmp_os->phdrs; + { + last = tmp_os->phdrs; + break; + } + if (last == NULL) + einfo (_("%F%P: no sections assigned to phdrs\n")); } + pl = last; } if (os->bfd_section == NULL) -- 2.30.2