https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99490
Bug ID: 99490
Summary: -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main
file, not .dwo file
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: debug
Assignee: unassigned at gcc dot gnu.org
Reporter: jan.kratochvil at redhat dot com
Target Milestone: ---
FAIL: gcc-11.0.0-0.19.fc35.x86_64
PASS: clang-12.0.0-0.1.rc1.fc35.x86_64
double p_ext=3.14,e_ext=2.71;
int main(void) {
double q,f;
{ volatile double p=p_ext;
q=p/1.1;
}
{ volatile double e=e_ext;
f=e/1.1;
}
return q+f;
}
clang -o range-clang range.c -Wall -O3 -gdwarf-5 -gsplit-dwarf;gcc -o
range-gcc.s range.c -Wall -O3 -gdwarf-5 -gsplit-dwarf
llvm-readelf -WS range-{clang,gcc}{,.dwo} | egrep '^File:|debug_rnglists'
File: range-clang
File: range-clang.dwo
[ 6] .debug_rnglists.dwo PROGBITS 0000000000000000 0001d4 000017 00 E
0 0 1
Actual:
File: range-gcc
[33] .debug_rnglists PROGBITS 0000000000000000 004c0a 000049 00
0 0 1
File: range-gcc.dwo
Expected:
File: range-gcc
File: range-gcc.dwo
[33] .debug_rnglists PROGBITS 0000000000000000 004c0a 000049 00
0 0 1
DWARF-5 spec:
"The .debug_rnglists.dwosection contains range lists referenced by any
DW_AT_ranges attributes in the split DWARF object."
"Range lists are contained in a separate object file section called
.debug_rnglists or .debug_rnglists.dwo (in split units)."
Reproducer from attached .s files:
: clang -S -o range-clang.s range.c -Wall -O3 -gdwarf-5 -gsplit-dwarf;clang -o
range-clang range-clang.s -Wall -gdwarf-5 -gsplit-dwarf;: gcc -S -o range-gcc.s
range.c -Wall -O3 -gdwarf-5 -gsplit-dwarf;gcc -o range-gcc range-gcc.s -Wall
-gdwarf-5 -gsplit-dwarf