[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/18836] New: ld handles .gnu.lto_ prefixed sections oddly, /DISCA
From: |
rguenth at gcc dot gnu.org |
Subject: |
[Bug ld/18836] New: ld handles .gnu.lto_ prefixed sections oddly, /DISCARD/ semantics unclear |
Date: |
Mon, 17 Aug 2015 08:54:38 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=18836
Bug ID: 18836
Summary: ld handles .gnu.lto_ prefixed sections oddly,
/DISCARD/ semantics unclear
Product: binutils
Version: 2.25
Status: NEW
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: rguenth at gcc dot gnu.org
Target Milestone: ---
For t.s
.section .gnu.lto_.debug_info,"",@progbits
.hidden t.c.f0aceea6
.globl t.c.f0aceea6
t.c.f0aceea6:
.long 0x31
.value 0x4
.long .Ldebug_abbrev1
.section .gnu.lto_.debug_abbrev,"",@progbits
.Ldebug_abbrev1:
.uleb128 0x1
.section .gnu.lto_.debug_str,"MS",@progbits,1
.string "/abuild/rguenther/trunk-g/gcc"
and the linker script
SECTIONS {
.debug_info : { t.o(.gnu.lto_.debug_info) }
.debug_abbrev : { t.o(.gnu.lto_.debug_abbrev) }
.debug_str : { t.o(.gnu.lto_.debug_str) }
}
desired to link .gnu.lto_ debug-info sections from LTO input to a final
executable by linking them as regular debug-info sections like with
> as -o t.o t.s
> ld -o x script
ld: warning: cannot find entry symbol _start; defaulting to 0000000000400040
ld produces
> readelf -S x
There are 5 section headers, starting at offset 0x138:
Section Headers:
[Nr] Name Type Address Offset
Size EntSize Flags Link Info Align
[ 0] NULL 0000000000000000 00000000
0000000000000000 0000000000000000 0 0 0
[ 1] .debug_str PROGBITS 0000000000000000 00000040
000000000000001e 0000000000000001 MS 0 0 1
[ 2] .shstrtab STRTAB 0000000000000000 0000005e
0000000000000026 0000000000000000 0 0 1
[ 3] .symtab SYMTAB 0000000000000000 00000088
0000000000000090 0000000000000018 4 2 8
[ 4] .strtab STRTAB 0000000000000000 00000118
0000000000000020 0000000000000000 0 0 1
so it dropped all but .debug_str, presumably because of the default
/DISCARD/ : { *(.gnu.lto*) }
rule in effect for non-partial links. But oddly this rule didn't apply
to .debug_str.
Also there is no way to "override" this DISCARD as it seems to apply
in "order" of the linker scripts(?) rather than in the order suggested
by -M:
Discarded input sections
.gnu.lto_.debug_info
0x0000000000000000 0xa t.o
.gnu.lto_.debug_abbrev
0x0000000000000000 0x1 t.o
Memory Configuration
Name Origin Length Attributes
*default* 0x0000000000000000 0xffffffffffffffff
Linker script and memory map
...
.debug_info
*(.debug_info .gnu.linkonce.wi.*)
t.o(.gnu.lto_.debug_info)
.debug_abbrev
*(.debug_abbrev)
t.o(.gnu.lto_.debug_abbrev)
...
.debug_str 0x0000000000000000 0x1e
*(.debug_str)
t.o(.gnu.lto_.debug_str)
.gnu.lto_.debug_str
0x0000000000000000 0x1e t.o
...
/DISCARD/
*(.note.GNU-stack)
*(.gnu_debuglink)
*(.gnu.lto_*)
OUTPUT(x elf64-x86-64)
which I hope is a bug. Otherwise I'd need a new feature to be able to
get at inputs discarded sections... (doing a partial link now as a
workaround, but that creates additional I/O and a quite big temporary file)
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/18836] New: ld handles .gnu.lto_ prefixed sections oddly, /DISCARD/ semantics unclear,
rguenth at gcc dot gnu.org <=
- [Bug ld/18836] ld handles .gnu.lto_ prefixed sections oddly, /DISCARD/ semantics unclear, rguenth at gcc dot gnu.org, 2015/08/17
- [Bug ld/18836] ld handles .gnu.lto_ prefixed sections oddly, /DISCARD/ semantics unclear, hjl.tools at gmail dot com, 2015/08/17
- [Bug ld/18836] ld handles .gnu.lto_ prefixed sections oddly, /DISCARD/ semantics unclear, rguenth at gcc dot gnu.org, 2015/08/17
- [Bug ld/18836] ld handles .gnu.lto_ prefixed sections oddly, /DISCARD/ semantics unclear, rguenth at gcc dot gnu.org, 2015/08/17
- [Bug ld/18836] ld handles .gnu.lto_ prefixed sections oddly, /DISCARD/ semantics unclear, hjl.tools at gmail dot com, 2015/08/17
- [Bug ld/18836] ld handles .gnu.lto_ prefixed sections oddly, /DISCARD/ semantics unclear, hjl.tools at gmail dot com, 2015/08/17
- [Bug ld/18836] ld handles .gnu.lto_ prefixed sections oddly, /DISCARD/ semantics unclear, hjl.tools at gmail dot com, 2015/08/17
- [Bug ld/18836] ld handles .gnu.lto_ prefixed sections oddly, /DISCARD/ semantics unclear, rguenth at gcc dot gnu.org, 2015/08/17
- [Bug ld/18836] ld handles .gnu.lto_ prefixed sections oddly, /DISCARD/ semantics unclear, hjl.tools at gmail dot com, 2015/08/17
- [Bug ld/18836] ld handles .gnu.lto_ prefixed sections oddly, /DISCARD/ semantics unclear, rguenther at suse dot de, 2015/08/17