Bug 78613 - [6/7 Regression] Assembler messages: Error: can't resolve `.rodata' {.rodata section} - `.Ltext0' {.text section}
Summary: [6/7 Regression] Assembler messages: Error: can't resolve `.rodata' {.rodata ...
Status: RESOLVED DUPLICATE of bug 47071
Alias: None
Product: gcc
Classification: Unclassified
Component: lto (show other bugs)
Version: 7.0
: P3 normal
Target Milestone: 6.3
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2016-11-30 14:10 UTC by Markus Trippelsdorf
Modified: 2016-11-30 15:12 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work: 5.4.0
Known to fail: 6.2.1, 7.0
Last reconfirmed: 2016-11-30 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Trippelsdorf 2016-11-30 14:10:08 UTC
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.
Comment 1 Richard Biener 2016-11-30 14:26:52 UTC
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 ;)
Comment 2 Andrew Pinski 2016-11-30 14:43:22 UTC
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.
Comment 3 Andrew Pinski 2016-11-30 15:12:41 UTC

*** This bug has been marked as a duplicate of bug 47071 ***