[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/25022] New: Make /DISCARD/ discard SHF_LINK_ORDER sections
From: |
i at maskray dot me |
Subject: |
[Bug ld/25022] New: Make /DISCARD/ discard SHF_LINK_ORDER sections |
Date: |
Fri, 20 Sep 2019 12:06:12 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=25022
Bug ID: 25022
Summary: Make /DISCARD/ discard SHF_LINK_ORDER sections
Product: binutils
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: i at maskray dot me
Target Milestone: ---
This depends on https://sourceware.org/bugzilla/show_bug.cgi?id=24526
(Generalize GC support for SHF_LINK_ORDER)
# a.script
SECTIONS { /DISCARD/ : { *(.foo) } }
# a.s
.section .foo,"a"
.quad 0
.section .bar,"ao",@progbits,.foo # "o" is llvm-mc specific syntax that sets
SHF_LINK_ORDER and sh_link
.quad 0
.section .zed,"ao",@progbits,.foo
.quad 0
.section .moo,"ao",@progbits,.zed
.quad 0
GNU ld issues an error
% llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o
% ld.bfd -T a.script a.o
ld.bfd: a.out: sh_link of section `.bar' points to discarded section `.foo' of
`a.o'
ld.bfd: final link failed: bad value
In lld, .bar is considered a dependent section of .foo
When /DISCARD/ discards .foo, it discards .bar as well. Transitively, .zed and
.moo are discarded. This rule can be seen as a generalization of SHT_RELA or
SHT_ARM_EXIDX.
% ld.lld -T a.script a.o
ld.lld: warning: cannot find entry symbol _start; defaulting to 0x0
--
You are receiving this mail because:
You are on the CC list for the bug.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug ld/25022] New: Make /DISCARD/ discard SHF_LINK_ORDER sections,
i at maskray dot me <=