aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-09-12 17:25:46 +0930
committerAlan Modra <amodra@gmail.com>2019-09-19 12:37:30 +0930
commit722b823106e7e3b7ac6eed71d52a748bc4cd4d4f (patch)
tree239630c0ae7df275c22cdb883d8b9450a9d45f82
parentAutomatic date update in version.in (diff)
downloadbinutils-gdb-722b823106e7e3b7ac6eed71d52a748bc4cd4d4f.tar.gz
binutils-gdb-722b823106e7e3b7ac6eed71d52a748bc4cd4d4f.tar.bz2
binutils-gdb-722b823106e7e3b7ac6eed71d52a748bc4cd4d4f.zip
PR24981, Hit assertion failure in ld/ldlang.c:7504
This fixes a problem with commit 128bf1fe608, a patch I made 2019-08-06. Apparently it is possible to trigger the assertion I added during an LTO bootstrap, something I haven't reproduced. However, I did find a case triggered by an odd linker script feature that allows a file to be loaded from the script without specifying that file on the command line. Regarding input sections: "When you use a file name which is not an archive:file specifier and does not contain any wild card characters, the linker will first see if you also specified the file name on the linker command line or in an INPUT command. If you did not, the linker will attempt to open the file as an input file, as though it appeared on the command line." So putting .foo : { foo.a(*) } into a script supposedly extracts foo.a into .foo. Except it doesn't, since this feature is meant for object files only. Well anyway, assuming --whole-archive was given on the command line, foo.a contains a -flto object and no other objects involved were -flto then we'll hit the assert due to files added like foo.a here *not* having their input statement put on the general statement list. Why these are not put on the statement list isn't obvious but it has been that way since commit 193c5f93a17 in 1994. PR 24981 * ldlang.c (lang_process): Remove assertion. Comment. (cherry picked from commit a19826f4c41219be6fb1adb528fe5fd3a3dc4130)
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/ldlang.c5
2 files changed, 9 insertions, 2 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index c65f3c279e0..6d57c99f044 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2019-09-19 Alan Modra <amodra@gmail.com>
+
+ PR 24981
+ Apply 2019-09-12 Alan Modra <amodra@gmail.com>
+ * ldlang.c (lang_process): Remove assertion. Comment.
+
2019-09-18 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/24887
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 303aa674353..cb98982d45f 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -7500,8 +7500,9 @@ lang_process (void)
prev = find_next_input_statement (prev);
if (*prev != (void *) plugin_insert->next_real_file)
{
- /* Huh? We didn't find the expected input statement. */
- ASSERT (0);
+ /* We didn't find the expected input statement.
+ This can happen due to lookup_name creating input
+ statements not linked into the statement list. */
prev = &plugin_insert->header.next;
}
}