summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/ELFObjectWriter.cpp
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2014-03-20 06:05:33 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2014-03-20 06:05:33 +0000
commit39f773f939b33b9f41a8b82a6e386e69750a40a6 (patch)
tree8bdc2e30c64da3a41dc6d567c2f251d3e073af9c /llvm/lib/MC/ELFObjectWriter.cpp
parent38afbfdd7656375e4ac046f1a46a3f5ee0009bf8 (diff)
downloadbcm5719-llvm-39f773f939b33b9f41a8b82a6e386e69750a40a6.tar.gz
bcm5719-llvm-39f773f939b33b9f41a8b82a6e386e69750a40a6.zip
Reapply 'ARM IAS: support .thumb_set'
Re-apply the change after it was reverted to do conflicts due to another change being reverted. llvm-svn: 204306
Diffstat (limited to 'llvm/lib/MC/ELFObjectWriter.cpp')
-rw-r--r--llvm/lib/MC/ELFObjectWriter.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp
index 1dae2f467d3..9168fea53bd 100644
--- a/llvm/lib/MC/ELFObjectWriter.cpp
+++ b/llvm/lib/MC/ELFObjectWriter.cpp
@@ -472,18 +472,21 @@ uint64_t ELFObjectWriter::SymbolValue(MCSymbolData &Data,
if (Symbol.isAbsolute() && Symbol.isVariable()) {
if (const MCExpr *Value = Symbol.getVariableValue()) {
int64_t IntValue;
- if (Value->EvaluateAsAbsolute(IntValue, Layout))
- return (uint64_t)IntValue;
+ if (Value->EvaluateAsAbsolute(IntValue, Layout)) {
+ if (Data.getFlags() & ELF_Other_ThumbFunc)
+ return static_cast<uint64_t>(IntValue | 1);
+ else
+ return static_cast<uint64_t>(IntValue);
+ }
}
}
if (!Symbol.isInSection())
return 0;
-
if (Data.getFragment()) {
if (Data.getFlags() & ELF_Other_ThumbFunc)
- return Layout.getSymbolOffset(&Data)+1;
+ return Layout.getSymbolOffset(&Data) | 1;
else
return Layout.getSymbolOffset(&Data);
}
@@ -578,6 +581,8 @@ void ELFObjectWriter::WriteSymbol(MCDataFragment *SymtabF,
// Binding and Type share the same byte as upper and lower nibbles
uint8_t Binding = MCELF::GetBinding(OrigData);
uint8_t Type = mergeTypeForSet(MCELF::GetType(OrigData), MCELF::GetType(Data));
+ if (OrigData.getFlags() & ELF_Other_ThumbFunc)
+ Type = ELF::STT_FUNC;
uint8_t Info = (Binding << ELF_STB_Shift) | (Type << ELF_STT_Shift);
// Other and Visibility share the same byte with Visibility using the lower
@@ -587,6 +592,8 @@ void ELFObjectWriter::WriteSymbol(MCDataFragment *SymtabF,
Other |= Visibility;
uint64_t Value = SymbolValue(Data, Layout);
+ if (OrigData.getFlags() & ELF_Other_ThumbFunc)
+ Value |= 1;
uint64_t Size = 0;
assert(!(Data.isCommon() && !Data.isExternal()));
OpenPOWER on IntegriCloud