[llvm] 19fff85 - Revert "[X86] Set SHF_X86_64_LARGE for globals with explicit well-known large section name (#74381)"
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 12 16:32:04 PST 2023
Author: Arthur Eubanks
Date: 2023-12-12T16:31:41-08:00
New Revision: 19fff858931bf575b63a0078cc553f8f93cced20
URL: https://github.com/llvm/llvm-project/commit/19fff858931bf575b63a0078cc553f8f93cced20
DIFF: https://github.com/llvm/llvm-project/commit/19fff858931bf575b63a0078cc553f8f93cced20.diff
LOG: Revert "[X86] Set SHF_X86_64_LARGE for globals with explicit well-known large section name (#74381)"
This reverts commit 323451ab88866c42c87971cbc670771bd0d48692.
Code with these section names in the wild doesn't compile because
support for large globals in the small code model is not complete yet.
Added:
Modified:
llvm/lib/Target/TargetMachine.cpp
llvm/test/CodeGen/X86/code-model-elf-sections.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/TargetMachine.cpp b/llvm/lib/Target/TargetMachine.cpp
index 246f6b4b492c8..5428e14eca5f8 100644
--- a/llvm/lib/Target/TargetMachine.cpp
+++ b/llvm/lib/Target/TargetMachine.cpp
@@ -55,6 +55,8 @@ bool TargetMachine::isLargeGlobalObject(const GlobalObject *GO) const {
// We should properly mark well-known section name prefixes as small/large,
// because otherwise the output section may have the wrong section flags and
// the linker will lay it out in an unexpected way.
+ // TODO: bring back lbss/ldata/lrodata checks after fixing accesses to large
+ // globals in the small code model.
StringRef Name = GV->getSection();
if (!Name.empty()) {
auto IsPrefix = [&](StringRef Prefix) {
@@ -63,8 +65,6 @@ bool TargetMachine::isLargeGlobalObject(const GlobalObject *GO) const {
};
if (IsPrefix(".bss") || IsPrefix(".data") || IsPrefix(".rodata"))
return false;
- if (IsPrefix(".lbss") || IsPrefix(".ldata") || IsPrefix(".lrodata"))
- return true;
}
// For x86-64, we treat an explicit GlobalVariable small code model to mean
diff --git a/llvm/test/CodeGen/X86/code-model-elf-sections.ll b/llvm/test/CodeGen/X86/code-model-elf-sections.ll
index 749d5b6bf904e..cb19f0d34f59f 100644
--- a/llvm/test/CodeGen/X86/code-model-elf-sections.ll
+++ b/llvm/test/CodeGen/X86/code-model-elf-sections.ll
@@ -21,16 +21,16 @@
; SMALL: .data {{.*}} WA {{.*}}
; SMALL: .data.x {{.*}} WA {{.*}}
; SMALL: .data0 {{.*}} WA {{.*}}
-; SMALL: .ldata {{.*}} WAl {{.*}}
-; SMALL: .ldata.x {{.*}} WAl {{.*}}
+; SMALL: .ldata {{.*}} WA {{.*}}
+; SMALL: .ldata.x {{.*}} WA {{.*}}
; SMALL: .ldata0 {{.*}} WA {{.*}}
; SMALL: force_small {{.*}} WA {{.*}}
; SMALL: force_large {{.*}} WAl {{.*}}
; SMALL: foo {{.*}} WA {{.*}}
; SMALL: .bss {{.*}} WA {{.*}}
-; SMALL: .lbss {{.*}} WAl {{.*}}
+; SMALL: .lbss {{.*}} WA {{.*}}
; SMALL: .rodata {{.*}} A {{.*}}
-; SMALL: .lrodata {{.*}} Al {{.*}}
+; SMALL: .lrodata {{.*}} A {{.*}}
; SMALL: .data.rel.ro {{.*}} WA {{.*}}
; SMALL: .tbss {{.*}} WAT {{.*}}
; SMALL: .tdata {{.*}} WAT {{.*}}
@@ -38,16 +38,16 @@
; SMALL-DS: .data {{.*}} WA {{.*}}
; SMALL-DS: .data.x {{.*}} WA {{.*}}
; SMALL-DS: .data0 {{.*}} WA {{.*}}
-; SMALL-DS: .ldata {{.*}} WAl {{.*}}
-; SMALL-DS: .ldata.x {{.*}} WAl {{.*}}
+; SMALL-DS: .ldata {{.*}} WA {{.*}}
+; SMALL-DS: .ldata.x {{.*}} WA {{.*}}
; SMALL-DS: .ldata0 {{.*}} WA {{.*}}
; SMALL-DS: .data.data {{.*}} WA {{.*}}
; SMALL-DS: force_small {{.*}} WA {{.*}}
; SMALL-DS: force_large {{.*}} WAl {{.*}}
; SMALL-DS: foo {{.*}} WA {{.*}}
-; SMALL-DS: .lbss {{.*}} WAl {{.*}}
+; SMALL-DS: .lbss {{.*}} WA {{.*}}
; SMALL-DS: .bss.bss {{.*}} WA {{.*}}
-; SMALL-DS: .lrodata {{.*}} Al {{.*}}
+; SMALL-DS: .lrodata {{.*}} A {{.*}}
; SMALL-DS: .rodata.rodata {{.*}} A {{.*}}
; SMALL-DS: .data.rel.ro.relro {{.*}} WA {{.*}}
; SMALL-DS: .tbss.tbss {{.*}} WAT {{.*}}
More information about the llvm-commits
mailing list