markus@x4 /tmp % cat 1.i void foo() {} markus@x4 /tmp % cat 2.i asm(".section .rodata"); markus@x4 /tmp % gcc -g -flto --shared 1.i 2.i /tmp/ccDWL0Ht.s: Assembler messages: /tmp/ccDWL0Ht.s:38: Error: can't resolve `.rodata' {.rodata section} - `.Ltext0' {.text section} /tmp/ccDWL0Ht.s:101: Error: can't resolve `.rodata' {.rodata section} - `.Ltext0' {.text section} lto-wrapper: fatal error: /usr/x86_64-pc-linux-gnu/gcc-bin/7.0.0/gcc returned 1 exit status compilation terminated. /usr/lib/gcc/x86_64-pc-linux-gnu/7.0.0/../../../../x86_64-pc-linux-gnu/bin/ld: fatal error: lto-wrapper failed collect2: error: ld returned 1 exit status gcc-5 was fine.
I suppose it was "fine" by luck. LTRANS now generates .file "<artificial>" .text .Ltext0: .globl foo .type foo, @function foo: .LFB0: .file 1 "t2.c" .loc 1 1 0 .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 .loc 1 1 0 popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size foo, .-foo #APP .section .rodata .Letext0: .section .debug_info,"",@progbits .Ldebug_info0: .long 0x46 .value 0x4 .long .Ldebug_abbrev0 .byte 0x8 .uleb128 0x1 .long .LASF0 .byte 0xc .long .LASF1 .long .LASF2 .quad .Ltext0 .quad .Letext0-.Ltext0 ... .Ldebug_line0: .section .debug_str,"MS",@progbits,1 .LASF2: .string "/abuild/rguenther/obj-early-lto-debug-g/gcc" .LASF1: .string "<artificial>" .LASF0: .string "GNU GIMPLE 7.0.0 20161130 (experimental) [trunk revision 221942] -mtune=generic -march=x86-64 -mtune=generic -march=x86-64 -g -fmath-errno -fsigned-zeros -ftrapping-math -fno-trapv -fno-strict-overflow -fno-openmp -fno-openacc -fltrans" .ident "GCC: (GNU) 7.0.0 20161130 (experimental) [trunk revision 221942]" .section .note.GNU-stack,"",@progbits that's dwarf2out somehow emitting text_end_label when not in .text. If it would be a trunk regression it would be mine ;)
Your top level inline asm does not change the section back. There has been other reports like this and closed as invalid due to that.
*** This bug has been marked as a duplicate of bug 47071 ***