forked from OSchip/llvm-project
[AsmPrinter] __patchable_function_entries: Set SHF_LINK_ORDER for binutils 2.36 and above
This matches GCC behavior when the configure-time binutils is new. GNU ld<2.36 did not support mixed SHF_LINK_ORDER and non-SHF_LINK_ORDER sections in an output section, so we conservatively disable SHF_LINK_ORDER for <2.36.
This commit is contained in:
parent
801d9cc7b9
commit
853a264916
|
@ -3464,9 +3464,9 @@ void AsmPrinter::emitPatchableFunctionEntries() {
|
|||
const MCSymbolELF *LinkedToSym = nullptr;
|
||||
StringRef GroupName;
|
||||
|
||||
// GNU as < 2.35 did not support section flag 'o'. Use SHF_LINK_ORDER only
|
||||
// if we are using the integrated assembler.
|
||||
if (MAI->useIntegratedAssembler()) {
|
||||
// GNU as < 2.35 did not support section flag 'o'. GNU ld < 2.36 did not
|
||||
// support mixed SHF_LINK_ORDER and non-SHF_LINK_ORDER sections.
|
||||
if (MAI->useIntegratedAssembler() || MAI->binutilsIsAtLeast(2, 36)) {
|
||||
Flags |= ELF::SHF_LINK_ORDER;
|
||||
if (F.hasComdat()) {
|
||||
Flags |= ELF::SHF_GROUP;
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
; RUN: llc -mtriple=aarch64 %s -o - | FileCheck %s
|
||||
; RUN: llc -mtriple=aarch64 -function-sections %s -o - | FileCheck %s
|
||||
; RUN: llc -mtriple=aarch64 -no-integrated-as %s -o - | FileCheck --check-prefix=NOLINK %s
|
||||
; RUN: llc -mtriple=aarch64 -function-sections %s -o - | FileCheck %s
|
||||
; RUN: llc -mtriple=aarch64 -no-integrated-as -binutils-version=2.35 %s -o - | FileCheck --check-prefix=NOLINK %s
|
||||
; RUN: llc -mtriple=aarch64 -no-integrated-as -binutils-version=2.36 %s -o - | FileCheck %s
|
||||
|
||||
;; GNU as < 2.35 did not support section flag 'o'.
|
||||
;; GNU ld < 2.36 did not support mixed SHF_LINK_ORDER and non-SHF_LINK_ORDER sections.
|
||||
; NOLINK-NOT: "awo"
|
||||
|
||||
define i32 @f0() "patchable-function-entry"="0" {
|
||||
|
|
Loading…
Reference in New Issue