[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/30632] New: ld segfaults if linker script includes
From: |
peter.chubb at unsw dot edu.au |
Subject: |
[Bug ld/30632] New: ld segfaults if linker script includes |
Date: |
Thu, 13 Jul 2023 10:38:15 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=30632
Bug ID: 30632
Summary: ld segfaults if linker script includes
Product: binutils
Version: 2.42 (HEAD)
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: peter.chubb at unsw dot edu.au
Target Milestone: ---
ld -Tscript.ld
segfaults in ldlang.c when a startup file is given in the script.
The problem is commit fb221fba1a5eb05355f248d6aa1e3ab4316899fd
which makes
first_file
NULL if NULL is
My script.ld contains:
----
STARTUP(crt0.o);
----
backtrace:
#0 lang_startup (name=0x5555556f50a0 "crt0.o") at ../../ld/ldlang.c:8704
#1 0x0000555555564e7a in yyparse () at ../../ld/ldgram.y:850
#2 0x0000555555569e88 in parse_args (argc=<optimized out>,
argv=<optimized out>) at ../../ld/lexsup.c:1385
#3 0x00005555555634f5 in main (argc=<optimized out>, argv=<optimized out>)
at ../../ld/ldmain.c:375
(gdb) print first_file
$1 = (lang_input_statement_type *) 0x0
first_file is set in lang_init at line 1331 of ld/ldlang.c:
first_file = lang_add_input_file (NULL, lang_input_file_is_marker_enum,
NULL);
lang_add_input_file() passes its first argument (here NULL) to new_afile()
Commit fb221fba1a5eb05355f248d6aa1e3ab4316899fd changed new_afile() to return
NULL if
the name was NULL. (near line 1139 of ldlang.c):
name = ldfile_possibly_remap_input (name);
if (name == NULL)
return NULL;
I suggest the check for NULL here is incorrect, as NULL is an allowed value for
the name. Commenting out the if statement and its return fixes the issue.
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/30632] New: ld segfaults if linker script includes,
peter.chubb at unsw dot edu.au <=
- [Bug ld/30632] ld segfaults if linker script includes a STARTUP line., peter.chubb at unsw dot edu.au, 2023/07/13
- [Bug ld/30632] ld segfaults if linker script includes a STARTUP line., peter.chubb at unsw dot edu.au, 2023/07/13
- [Bug ld/30632] ld segfaults if linker script includes a STARTUP line., peter.chubb at unsw dot edu.au, 2023/07/13
- [Bug ld/30632] ld segfaults if linker script includes a STARTUP line., nickc at redhat dot com, 2023/07/18
- [Bug ld/30632] ld segfaults if linker script includes a STARTUP line., cvs-commit at gcc dot gnu.org, 2023/07/18
- [Bug ld/30632] ld segfaults if linker script includes a STARTUP line., cvs-commit at gcc dot gnu.org, 2023/07/18
- [Bug ld/30632] ld segfaults if linker script includes a STARTUP line., nickc at redhat dot com, 2023/07/18
- [Bug ld/30632] ld segfaults if linker script includes a STARTUP line., amodra at gmail dot com, 2023/07/20