public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] PR 30632 - ld segfaults if linker script includes a STARTUP line.
@ 2023-07-18 16:05 Nick Clifton
  0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2023-07-18 16:05 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9cc5af6a1f80ea46b2444e266c69193c32c13d3b

commit 9cc5af6a1f80ea46b2444e266c69193c32c13d3b
Author: Pter Chubb <peter.chubb@unsw.edu.au>
Date:   Tue Jul 18 17:04:43 2023 +0100

    PR 30632 - ld segfaults if linker script includes a STARTUP line.

Diff:
---
 ld/ldlang.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/ld/ldlang.c b/ld/ldlang.c
index 4b86c164843..f7760fed69b 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -1136,9 +1136,15 @@ new_afile (const char *name,
 
   lang_has_input_file = true;
 
-  name = ldfile_possibly_remap_input (name);
-  if (name == NULL)
-    return NULL;
+  /* PR 30632: It is OK for name to be NULL.  For example
+     see the initialization of first_file in lang_init().  */
+  if (name != NULL)
+    {
+      name = ldfile_possibly_remap_input (name);
+      /* But if a name is remapped to NULL, it should be ignored.  */
+      if (name == NULL)
+	return NULL;
+    }
 
   p = new_stat (lang_input_statement, stat_ptr);
   memset (&p->the_bfd, 0,

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-07-18 16:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-18 16:05 [binutils-gdb] PR 30632 - ld segfaults if linker script includes a STARTUP line Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).