diff options
author | Fangrui Song <maskray@google.com> | 2020-03-28 23:12:04 -0700 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2020-04-14 22:35:46 -0700 |
commit | 71c3f57326cf956330f47f9061104e0f299cb7cf (patch) | |
tree | ac60a5959216252e5fc3a463122a3a70097f90d4 /llvm/lib/Target/X86/X86PadShortFunction.cpp | |
parent | b2881de649ca27bd00942a4dc6b0e3a0f7e7f32f (diff) | |
download | bcm5719-llvm-71c3f57326cf956330f47f9061104e0f299cb7cf.tar.gz bcm5719-llvm-71c3f57326cf956330f47f9061104e0f299cb7cf.zip |
[ELF] Allow SHF_LINK_ORDER and non-SHF_LINK_ORDER to be mixed
Currently, `error: incompatible section flags for .rodata` is reported
when we mix SHF_LINK_ORDER and non-SHF_LINK_ORDER sections in an output section.
This is overconstrained. This patch allows mixed flags with the
requirement that SHF_LINK_ORDER sections must be contiguous. Mixing
flags is used by Linux aarch64 (https://github.com/ClangBuiltLinux/linux/issues/953)
.init.data : { ... KEEP(*(__patchable_function_entries)) ... }
When the integrated assembler is enabled, clang's -fpatchable-function-entry=N[,M]
implementation sets the SHF_LINK_ORDER flag (D72215) to fix a number of
garbage collection issues.
Strictly speaking, the ELF specification does not require contiguous
SHF_LINK_ORDER sections but for many current uses of SHF_LINK_ORDER like
.ARM.exidx/__patchable_function_entries there has been a requirement for
the sections to be contiguous on top of the requirements of the ELF
specification.
This patch also imposes one restriction: SHF_LINK_ORDER sections cannot
be separated by a symbol assignment or a BYTE command. Not allowing BYTE
is a natural extension that a non-SHF_LINK_ORDER cannot be a separator.
Symbol assignments can delimiter the contents of SHF_LINK_ORDER
sections. Allowing SHF_LINK_ORDER sections across symbol assignments
(especially __start_/__stop_) can make things hard to explain. The
restriction should not be a problem for practical use cases.
Reviewed By: psmith
Differential Revision: https://reviews.llvm.org/D77007
(cherry picked from commit 673e81eee4fa3ffa38736f1063e6c4fa2d9278b0)
Diffstat (limited to 'llvm/lib/Target/X86/X86PadShortFunction.cpp')
0 files changed, 0 insertions, 0 deletions