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: 0000 00000001 00000006 00000097 0000003f ...............? 0010 24000000 00000000 00000051 24000000 $..........Q$... 0020 00000000 00000064 24000000 00000000 .......d$....... 0030 00000074 24000000 00000000 00000081 ...t$........... 0040 24000000 00000000 0000008c 24000000 $...........$... 0050 00000000 .... Contents of section .stabstr: 0000 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: 0000 00000000 00000000 ........ Contents of section __ksymtab_strings: 0000 6c6f6164 5f66705f 73746174 65007374 load_fp_state.st 0010 6f72655f 66705f73 74617465 00 ore_fp_state. Contents of section ___kcrctab+load_fp_state: 0000 00000000 .... Contents of section ___ksymtab+store_fp_state: 0000 00000000 00000000 ........ Contents of section ___kcrctab+store_fp_state: 0000 00000000 .... Contents of section .debug_line: 0000 00000084 00020000 00400401 fb0e0d00 .........@...... 0010 01010101 00000001 0000012f 7573722f .........../usr/ 0020 7372632f 6b65726e 656c2f61 7263682f src/kernel/arch/ 0030 706f7765 7270632f 6b65726e 656c0000 powerpc/kernel.. 0040 6670752e 53000100 00000005 02000000 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: 0000 00000022 00020000 00000401 00000000 ..."............ 0010 00000000 00000000 00000000 00000000 ................ 0020 00000000 8001 ...... Contents of section .debug_abbrev: 0000 01110010 06110112 01030e1b 0e250e13 .............%.. 0010 05000000 .... Contents of section .debug_aranges: 0000 0000001c 00020000 00000400 00000000 ................ 0010 00000000 00000290 00000000 00000000 ................ Contents of section .debug_str: 0000 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