[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/26256] New: Support mixed SHF_LINK_ORDER & non-SHF_LINK_ORDER co
From: |
i at maskray dot me |
Subject: |
[Bug ld/26256] New: Support mixed SHF_LINK_ORDER & non-SHF_LINK_ORDER components in an output section |
Date: |
Fri, 17 Jul 2020 04:14:40 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=26256
Bug ID: 26256
Summary: Support mixed SHF_LINK_ORDER & non-SHF_LINK_ORDER
components in an output section
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: ---
See https://groups.google.com/forum/#!topic/generic-abi/hgx_m1aXqUo
"SHF_LINK_ORDER's original semantics make upgrade difficult"
Mixed SHF_LINK_ORDER and non-SHF_LINK_ORDER components are not allowed. This
makes it infeasible to add SHF_LINK_ORDER to an existing metadata section if
backward compatibility with older object files are concerned.
It would be nice if the two different semantics (ordering requirement & garbage
collection) were not overloaded on one section flag, however, it is probably
difficult to obtain a generic flag at this point
(https://groups.google.com/forum/#!topic/generic-abi/hgx_m1aXqUo
"SHF_LINK_ORDER's original semantics make upgrade difficult").
On the other hand, defining an order is not going to be troublesome, and will
help metadata sections.
cat > a.s <<e
.section .text.bar,"a",@progbits
.byte 2
.section .text.foo,"a",@progbits
.byte 1
.section .rodata.foo,"ao",@progbits,.text.foo
.byte 1
## If the two .rodata.bar sections are in the same input section description,
## 03 (sh_link!=0) will be ordered before 02 (sh_link=0).
.section .rodata.bar,"a",@progbits
.byte 2
.section .rodata.bar,"ao",@progbits,.text.bar
.byte 3
e
as-new a.s -o a.o
ld-new a.o # .rodata has both ordered [`.rodata.foo' in a.o] and unordered
[`.rodata.bar' in a.o] sections
I am going to change LLD to perform ordering within an input section
description.
For example, .rodata : {*(.rodata.foo) *(.rodata.bar)}, has two
InputSectionDescription's. If there is at least one SHF_LINK_ORDER and at least
one non-SHF_LINK_ORDER in .rodata.foo, they are ordered within *(.rodata.foo):
we arbitrarily place SHF_LINK_ORDER components before non-SHF_LINK_ORDER
components (like Solaris ld).
*(.rodata.bar) is ordered similarly, but the two input section descriptions
don't interact.
Section content of .rodata for a few different linker scripts:
# RUN: echo 'SECTIONS { .rodata : {BYTE(0) *(.rodata*) BYTE(4)} \
# RUN: .text : {*(.text.foo) *(.text.bar)} }' > %t1.lds
# RUN: ld.lld -T %t1.lds %t.o -o %t1
0003010204
# RUN: echo 'SECTIONS { .rodata : {*(.rodata.foo) *(.rodata.bar)} }' > %t2.lds
# RUN: ld.lld -T %t2.lds %t.o -o %t2
010302
## Non-contiguous SHF_LINK_ORDER sections, separated by a symbol assignment.
# RUN: echo 'SECTIONS { .rodata : {*(.rodata.foo) a = .; *(.rodata.bar)} }' >
%t5.lds
# RUN: ld.lld -T %t5.lds %t.o -o %t5
# RUN: llvm-readelf -S -x .rodata %t5 | FileCheck --check-prefix=CHECK2 %s
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/26256] New: Support mixed SHF_LINK_ORDER & non-SHF_LINK_ORDER components in an output section,
i at maskray dot me <=