diff options
author | Tim Northover <t.p.northover@gmail.com> | 2021-07-15 14:21:42 +0100 |
---|---|---|
committer | Tim Northover <t.p.northover@gmail.com> | 2021-07-15 14:40:43 +0100 |
commit | 5d7632ee72c51b518bde17e385b71c5d3f0d2560 (patch) | |
tree | fda9f1f50d72bab83027a8fcca0676529d338266 /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | |
parent | 034b94bb7161c64234e4ec35bf49428c3a1f8f0a (diff) | |
download | llvm-5d7632ee72c51b518bde17e385b71c5d3f0d2560.zip llvm-5d7632ee72c51b518bde17e385b71c5d3f0d2560.tar.gz llvm-5d7632ee72c51b518bde17e385b71c5d3f0d2560.tar.bz2 |
MachO: don't emit L... private symbols in do_not_dead_strip sections.
The linker can sometimes drop the do_not_dead_strip if it can't associate the
atom with a symbol (the other place to specify no dead-stripping in MachO
files).
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index ace475d..56fdbc1 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -1480,11 +1480,10 @@ static bool canUsePrivateLabel(const MCAsmInfo &AsmInfo, if (!AsmInfo.isSectionAtomizableBySymbols(Section)) return true; - // If it is not dead stripped, it is safe to use private labels. - const MCSectionMachO &SMO = cast<MCSectionMachO>(Section); - if (SMO.hasAttribute(MachO::S_ATTR_NO_DEAD_STRIP)) - return true; - + // FIXME: we should be able to use private labels for sections that can't be + // dead-stripped (there's no issue with blocking atomization there), but `ld + // -r` sometimes drops the no_dead_strip attribute from sections so for safety + // we don't allow it. return false; } |