diff options
author | Fangrui Song <maskray@google.com> | 2020-03-28 23:12:04 -0700 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2020-03-30 10:03:55 -0700 |
commit | 673e81eee4fa3ffa38736f1063e6c4fa2d9278b0 (patch) | |
tree | 06f502d2ead30d2be8717686ccb17957a2157e53 /llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | |
parent | 094b11c3ab41f44296f11fa607509776e757e054 (diff) | |
download | llvm-673e81eee4fa3ffa38736f1063e6c4fa2d9278b0.zip llvm-673e81eee4fa3ffa38736f1063e6c4fa2d9278b0.tar.gz llvm-673e81eee4fa3ffa38736f1063e6c4fa2d9278b0.tar.bz2 |
[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
Diffstat (limited to 'llvm/lib/Transforms/Utils/BasicBlockUtils.cpp')
0 files changed, 0 insertions, 0 deletions