https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97441
Bug ID: 97441
Summary: gcc writes absolute path to .stabstr section when
fdebug-prefix-map is used
Product: gcc
Version: 10.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: debug
Assignee: unassigned at gcc dot gnu.org
Reporter: dzagorui at cisco dot com
Target Milestone: ---
Created attachment 49378
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49378&action=edit
asm file after preprocessing
For 32 bit Powerpc Linux Kernel .stabs pseudo asm op is used
https://elixir.bootlin.com/linux/latest/source/arch/powerpc/include/asm/ppc_asm.h#L248
During out of source kernel build
(https://elixir.bootlin.com/linux/latest/source/scripts/mkmakefile) gcc writes
absolute path to first .stab even when -fdebug-prefix-map flag is used.
Provided one compiled asm object
(https://elixir.bootlin.com/linux/latest/source/arch/powerpc/kernel/fpu.S)
as an example. In this example -fdebug-prefix-map remaps only dwarf sections
but doesn't affect .stabstr.
$ powerpc-linux-gnu-gcc -m32 -nostdinc -mbig-endian -Wa,-gdwarf-2
-fdebug-prefix-map=/home/dzagorui/repro/powerpc=/usr/src -c -o fpu.o fpu.s
$ objdump -s fpu.o
Contents of section .stab:
0001 0006 0097 003f ...?
0010 2400 0051 2400 $..Q$...
0020 0064 2400 ...d$...
0030 0074 2400 0081 ...t$...
0040 2400 008c 2400 $...$...
0050
Contents of section .stabstr:
002f686f 6d652f64 7a61676f 7275692f ./home/dzagorui/
0010 72657072 6f2f706f 77657270 632f6b65 repro/powerpc/ke
0020 726e656c 2f617263 682f706f 77657270 rnel/arch/powerp
0030 632f6b65 726e656c 2f667075 2e53006c c/kernel/fpu.S.l
0040 6f61645f 66705f73 74617465 3a462d31 oad_fp_state:F-1
0050 0073746f 72655f66 705f7374 6174653a .store_fp_state:
0060 462d3100 6c6f6164 5f75705f 6670753a F-1.load_up_fpu:
0070 462d3100 73617665 5f667075 3a462d31 F-1.save_fpu:F-1
0080 00637674 5f66643a 462d3100 6376745f .cvt_fd:F-1.cvt_
0090 64663a46 2d3100 df:F-1.
Contents of section ___ksymtab+load_fp_state:
Contents of section __ksymtab_strings:
6c6f6164 5f66705f 73746174 65007374 load_fp_state.st
0010 6f72655f 66705f73 74617465 00ore_fp_state.
Contents of section ___kcrctab+load_fp_state:
Contents of section ___ksymtab+store_fp_state:
Contents of section ___kcrctab+store_fp_state:
Contents of section .debug_line:
0084 0002 00400401 fb0e0d00 .@..
0010 01010101 0001 012f 7573722f .../usr/
0020 7372632f 6b65726e 656c2f61 7263682f src/kernel/arch/
0030 706f7765 7270632f 6b65726e 656c powerpc/kernel..
0040 6670752e 53000100 0005 0200 fpu.S...
0050 00033a01 212108e5 2808e521 21030d20 ..:.!!..(..!!..
0060 21272123 21212103 0a202121 21212121 !'!#!!!.. !!
0070 08e72821 21212121 2108e521 21282121 ..(!!..!!(!!
0080 23212102 01000101#!!.
Contents of section .debug_info:
0022 0002 0401 ..."
0010
0020 8001..
Contents of section .debug_abbrev:
01110010 06110112 01030e1b 0e250e13 .%..
0010 0500
Contents of section .debug_aranges:
001c 0002 0400
0010 0290
Contents of section .debug_str:
2f757372 2f737263 2f6b6572 6e656c2f /usr/src/kernel/
0010 61726368 2f706f77 65727063 2f6b6572 arch/powerpc/ker
0020 6e656c2f 6670752e 53002f68 6f6d652f nel/fpu.S./home/
0030 647a6167 6f727569 2f726570 726f2f74 dzagorui/repro/t
0040 6d700047 4e552041 5320322e 33312e31 mp.GNU AS 2.31.1
0050 00