diff options
author | Arthur Eubanks <aeubanks@google.com> | 2023-12-21 10:41:39 -0800 |
---|---|---|
committer | Arthur Eubanks <aeubanks@google.com> | 2023-12-21 10:51:30 -0800 |
commit | 7433b1ca3ebe9f3b20758336535e82531cbae96f (patch) | |
tree | 808e198282971612a53479eef42f8cb2d4145482 | |
parent | e6f57628790421b16a02b0cb4a67fab4f2f48004 (diff) |
Reapply "[X86] Set SHF_X86_64_LARGE for globals with explicit well-known large section name (#74381)"
This reverts commit 19fff858931bf575b63a0078cc553f8f93cced20.
Now that explicit large globals are handled properly in the small code model.
-rw-r--r-- | llvm/lib/Target/TargetMachine.cpp | 4 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/code-model-elf-sections.ll | 16 |
2 files changed, 10 insertions, 10 deletions
diff --git a/llvm/lib/Target/TargetMachine.cpp b/llvm/lib/Target/TargetMachine.cpp index 3f96bd37755e..2a4383314e46 100644 --- a/llvm/lib/Target/TargetMachine.cpp +++ b/llvm/lib/Target/TargetMachine.cpp @@ -61,8 +61,6 @@ bool TargetMachine::isLargeGlobalValue(const GlobalValue *GVal) 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) { @@ -71,6 +69,8 @@ bool TargetMachine::isLargeGlobalValue(const GlobalValue *GVal) 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 cb19f0d34f59..749d5b6bf904 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 {{.*}} WA {{.*}} -; SMALL: .ldata.x {{.*}} WA {{.*}} +; SMALL: .ldata {{.*}} WAl {{.*}} +; SMALL: .ldata.x {{.*}} WAl {{.*}} ; SMALL: .ldata0 {{.*}} WA {{.*}} ; SMALL: force_small {{.*}} WA {{.*}} ; SMALL: force_large {{.*}} WAl {{.*}} ; SMALL: foo {{.*}} WA {{.*}} ; SMALL: .bss {{.*}} WA {{.*}} -; SMALL: .lbss {{.*}} WA {{.*}} +; SMALL: .lbss {{.*}} WAl {{.*}} ; SMALL: .rodata {{.*}} A {{.*}} -; SMALL: .lrodata {{.*}} A {{.*}} +; SMALL: .lrodata {{.*}} Al {{.*}} ; 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 {{.*}} WA {{.*}} -; SMALL-DS: .ldata.x {{.*}} WA {{.*}} +; SMALL-DS: .ldata {{.*}} WAl {{.*}} +; SMALL-DS: .ldata.x {{.*}} WAl {{.*}} ; 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 {{.*}} WA {{.*}} +; SMALL-DS: .lbss {{.*}} WAl {{.*}} ; SMALL-DS: .bss.bss {{.*}} WA {{.*}} -; SMALL-DS: .lrodata {{.*}} A {{.*}} +; SMALL-DS: .lrodata {{.*}} Al {{.*}} ; SMALL-DS: .rodata.rodata {{.*}} A {{.*}} ; SMALL-DS: .data.rel.ro.relro {{.*}} WA {{.*}} ; SMALL-DS: .tbss.tbss {{.*}} WAT {{.*}} |