https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121399
Bug ID: 121399
Summary: objdump -S broken with -gsplit-dwarf and -O2 and above
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: debug
Assignee: unassigned at gcc dot gnu.org
Reporter: aboya at igalia dot com
Target Milestone: ---
Repro:
cat <<EOF > hello.c
#include <stdio.h>
int main() {
puts("Hello world");
return 0;
}
EOF
gcc -c hello.c -o hello-O2-regular.o -g -O2
gcc -c hello.c -o hello-O1-split.o -g -O1 -gsplit-dwarf
gcc -c hello.c -o hello-O2-split.o -g -O2 -gsplit-dwarf
objdump -S hello-O2-regular.o # OK: shows sources
objdump -S hello-O1-split.o # OK: shows sources
objdump -S hello-O2-split.o # BUG: does not show sources
Reproduced with gcc version 15.1.1 20250521 (Red Hat 15.1.1-2) for x86_64.
However, this is not a new regression, since I also reproduced it in a build of
gcc 11.2.0 targetting arm32.