From 12de7b2446f6f04700370ed8755e0fc4fc1d941b Mon Sep 17 00:00:00 2001 From: Evgeniy Stepanov Date: Tue, 4 Apr 2017 22:35:08 +0000 Subject: [PATCH] Change section flag character for SHF_LINK_ORDER to "o". GAS uses "m" as a compatibility alias for "M" (SHF_MERGE). "o" is free, except on ia64, where it already means SHF_LINK_ORDER. llvm-svn: 299479 --- llvm/docs/Extensions.rst | 6 +++--- llvm/lib/MC/MCParser/ELFAsmParser.cpp | 2 +- llvm/lib/MC/MCSectionELF.cpp | 2 +- llvm/test/CodeGen/X86/elf-associated.ll | 16 ++++++++-------- llvm/test/MC/ELF/section-metadata-err1.s | 2 +- llvm/test/MC/ELF/section-metadata-err2.s | 2 +- llvm/test/MC/ELF/section-metadata-err3.s | 2 +- llvm/test/MC/ELF/section-metadata-err4.s | 2 +- llvm/test/MC/ELF/section.s | 12 ++++++------ 9 files changed, 23 insertions(+), 23 deletions(-) diff --git a/llvm/docs/Extensions.rst b/llvm/docs/Extensions.rst index 782539dda58e..14fea30204b4 100644 --- a/llvm/docs/Extensions.rst +++ b/llvm/docs/Extensions.rst @@ -204,7 +204,7 @@ For example, the following code creates two sections named ``.text``. The unique number is not present in the resulting object at all. It is just used in the assembler to differentiate the sections. -The 'm' flag is mapped to SHF_LINK_ORDER. If it is present, a symbol +The 'o' flag is mapped to SHF_LINK_ORDER. If it is present, a symbol must be given that identifies the section to be placed is the .sh_link. @@ -212,14 +212,14 @@ must be given that identifies the section to be placed is the .section .foo,"a",@progbits .Ltmp: - .section .bar,"am",@progbits,.Ltmp + .section .bar,"ao",@progbits,.Ltmp which is equivalent to just .. code-block:: gas .section .foo,"a",@progbits - .section .bar,"am",@progbits,.foo + .section .bar,"ao",@progbits,.foo Target Specific Behaviour diff --git a/llvm/lib/MC/MCParser/ELFAsmParser.cpp b/llvm/lib/MC/MCParser/ELFAsmParser.cpp index 3476a02e0fd7..ed911cbc756e 100644 --- a/llvm/lib/MC/MCParser/ELFAsmParser.cpp +++ b/llvm/lib/MC/MCParser/ELFAsmParser.cpp @@ -298,7 +298,7 @@ static unsigned parseSectionFlags(StringRef flagsStr, bool *UseLastGroup) { case 'w': flags |= ELF::SHF_WRITE; break; - case 'm': + case 'o': flags |= ELF::SHF_LINK_ORDER; break; case 'M': diff --git a/llvm/lib/MC/MCSectionELF.cpp b/llvm/lib/MC/MCSectionELF.cpp index 56c51d7539e4..78fe01cca24a 100644 --- a/llvm/lib/MC/MCSectionELF.cpp +++ b/llvm/lib/MC/MCSectionELF.cpp @@ -104,7 +104,7 @@ void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T, if (Flags & ELF::SHF_TLS) OS << 'T'; if (Flags & ELF::SHF_LINK_ORDER) - OS << 'm'; + OS << 'o'; // If there are target-specific flags, print them. Triple::ArchType Arch = T.getArch(); diff --git a/llvm/test/CodeGen/X86/elf-associated.ll b/llvm/test/CodeGen/X86/elf-associated.ll index 20baa8452772..361cf66cce72 100644 --- a/llvm/test/CodeGen/X86/elf-associated.ll +++ b/llvm/test/CodeGen/X86/elf-associated.ll @@ -4,23 +4,23 @@ @a = global i32 1 @b = global i32 2, !associated !0 !0 = !{i32* @a} -; CHECK-DAG: .section .data.b,"awm",@progbits,a +; CHECK-DAG: .section .data.b,"awo",@progbits,a ; Loop is OK. Also, normally -data-sections=0 would place @c and @d in the same section. !associated prevents that. @c = global i32 2, !associated !2 @d = global i32 2, !associated !1 !1 = !{i32* @c} !2 = !{i32* @d} -; CHECK-DAG: .section .data.c,"awm",@progbits,d -; CHECK-DAG: .section .data.d,"awm",@progbits,c +; CHECK-DAG: .section .data.c,"awo",@progbits,d +; CHECK-DAG: .section .data.d,"awo",@progbits,c ; BSS is OK. @e = global i32 0 @f = global i32 0, !associated !3 @g = global i32 1, !associated !3 !3 = !{i32* @e} -; CHECK-DAG: .section .bss.f,"awm",@nobits,e -; CHECK-DAG: .section .data.g,"awm",@progbits,e +; CHECK-DAG: .section .bss.f,"awo",@nobits,e +; CHECK-DAG: .section .data.g,"awo",@progbits,e ; Explicit sections. @h = global i32 1, section "aaa" @@ -29,9 +29,9 @@ @k = global i32 1, !associated !4 !4 = !{i32* @h} ; CHECK-DAG: .section aaa,"aw",@progbits -; CHECK-DAG: .section bbb,"awm",@progbits,h,unique,1 -; CHECK-DAG: .section bbb,"awm",@progbits,h,unique,2 -; CHECK-DAG: .section .data.k,"awm",@progbits,h +; CHECK-DAG: .section bbb,"awo",@progbits,h,unique,1 +; CHECK-DAG: .section bbb,"awo",@progbits,h,unique,2 +; CHECK-DAG: .section .data.k,"awo",@progbits,h ; Non-GlobalObject metadata. @l = global i32 1, section "ccc", !associated !5 diff --git a/llvm/test/MC/ELF/section-metadata-err1.s b/llvm/test/MC/ELF/section-metadata-err1.s index eb468f6b9377..682f0e82f30d 100644 --- a/llvm/test/MC/ELF/section-metadata-err1.s +++ b/llvm/test/MC/ELF/section-metadata-err1.s @@ -2,4 +2,4 @@ // CHECK: error: symbol is not in a section: foo - .section .shf_metadata,"am",@progbits,foo + .section .shf_metadata,"ao",@progbits,foo diff --git a/llvm/test/MC/ELF/section-metadata-err2.s b/llvm/test/MC/ELF/section-metadata-err2.s index 032e000453b0..1912f67d0e0f 100644 --- a/llvm/test/MC/ELF/section-metadata-err2.s +++ b/llvm/test/MC/ELF/section-metadata-err2.s @@ -3,4 +3,4 @@ // CHECK: error: symbol is not in a section: foo .quad foo - .section .shf_metadata,"am",@progbits,foo + .section .shf_metadata,"ao",@progbits,foo diff --git a/llvm/test/MC/ELF/section-metadata-err3.s b/llvm/test/MC/ELF/section-metadata-err3.s index 4d8d0e23f961..388ca377fd42 100644 --- a/llvm/test/MC/ELF/section-metadata-err3.s +++ b/llvm/test/MC/ELF/section-metadata-err3.s @@ -3,4 +3,4 @@ // CHECK: error: symbol is not in a section: foo foo = 42 - .section .shf_metadata,"am",@progbits,foo + .section .shf_metadata,"ao",@progbits,foo diff --git a/llvm/test/MC/ELF/section-metadata-err4.s b/llvm/test/MC/ELF/section-metadata-err4.s index 3c843c046436..d7677d292f70 100644 --- a/llvm/test/MC/ELF/section-metadata-err4.s +++ b/llvm/test/MC/ELF/section-metadata-err4.s @@ -2,4 +2,4 @@ // CHECK: error: expected metadata symbol - .section .shf_metadata,"am",@progbits + .section .shf_metadata,"ao",@progbits diff --git a/llvm/test/MC/ELF/section.s b/llvm/test/MC/ELF/section.s index 2accab0e4498..a852b01eb6e5 100644 --- a/llvm/test/MC/ELF/section.s +++ b/llvm/test/MC/ELF/section.s @@ -163,12 +163,12 @@ bar: .Lshf_metadata_target2_2: .quad 0 -.section .shf_metadata1,"am",@progbits,.Lshf_metadata_target2_1 -.section .shf_metadata2,"am",@progbits,.Lshf_metadata_target2_2 -.section .shf_metadata3,"am",@progbits,.shf_metadata_target1 -// ASM: .section .shf_metadata1,"am",@progbits,.Lshf_metadata_target2_1 -// ASM: .section .shf_metadata2,"am",@progbits,.Lshf_metadata_target2_2 -// ASM: .section .shf_metadata3,"am",@progbits,.shf_metadata_target1 +.section .shf_metadata1,"ao",@progbits,.Lshf_metadata_target2_1 +.section .shf_metadata2,"ao",@progbits,.Lshf_metadata_target2_2 +.section .shf_metadata3,"ao",@progbits,.shf_metadata_target1 +// ASM: .section .shf_metadata1,"ao",@progbits,.Lshf_metadata_target2_1 +// ASM: .section .shf_metadata2,"ao",@progbits,.Lshf_metadata_target2_2 +// ASM: .section .shf_metadata3,"ao",@progbits,.shf_metadata_target1 // CHECK: Section { // CHECK: Index: 22