[PATCH] D148836: [X86] Use "l" prefix for data sections under medium/large code model
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 23 09:11:48 PDT 2023
MaskRay added a comment.
For what we want to do with `-mcmodel=large`, I have https://groups.google.com/g/x86-64-abi/c/jnQdJeabxiU and CCed some gcc/binutils folks
================
Comment at: llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp:653
} else {
- Name = getSectionPrefixForGlobal(Kind);
+ bool IsLarge = false;
+ if (isa<GlobalVariable>(GO))
----------------
Use `bool IsLarge = ... && ...` or avoid the used-once variable.
================
Comment at: llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp:858
}
+ if (isa<GlobalVariable>(GO)) {
+ if (TM.isLargeData()) {
----------------
Use `&&`
================
Comment at: llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp:2177
bool UniqueSectionNames = TM.getUniqueSectionNames();
- SmallString<128> Name = getSectionPrefixForGlobal(Kind);
+ SmallString<128> Name = getSectionPrefixForGlobal(Kind, /*IsLarge*/ false);
----------------
The canonical spelling liked by both clang-format and clang-tidy is `/*IsLarge=*/false` (no space).
================
Comment at: llvm/lib/Target/TargetMachine.cpp:47
+ // restrict this to medium.
+ if (getCodeModel() != CodeModel::Medium)
+ return false;
----------------
`return getCodeModel() == CodeModel::Medium`
================
Comment at: llvm/test/CodeGen/X86/code-model-elf-sections.ll:3
+; RUN: llvm-readobj -S %t | FileCheck %s --check-prefix=SMALL
+; RUN: llc < %s -relocation-model=pic -filetype=obj -code-model=medium -o %t
+; RUN: llvm-readobj -S %t | FileCheck %s --check-prefix=LARGE
----------------
It will be useful to test fdata-sections
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148836/new/
https://reviews.llvm.org/D148836
More information about the llvm-commits
mailing list