mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-27 15:02:16 +00:00
Fix aliases to thumbfunc-based exprs to be thumbfunc.
If F is a Thumb function symbol, and G = F + const, and G is a function symbol, then G is Thumb. Because what else could it be? Differential Revision: https://reviews.llvm.org/D28878 llvm-svn: 292514
This commit is contained in:
parent
51f50e3dd0
commit
5dde1628a4
@ -114,10 +114,16 @@ bool MCAssembler::isThumbFunc(const MCSymbol *Symbol) const {
|
||||
if (!Symbol->isVariable())
|
||||
return false;
|
||||
|
||||
// FIXME: It looks like gas supports some cases of the form "foo + 2". It
|
||||
// is not clear if that is a bug or a feature.
|
||||
const MCExpr *Expr = Symbol->getVariableValue();
|
||||
const MCSymbolRefExpr *Ref = dyn_cast<MCSymbolRefExpr>(Expr);
|
||||
|
||||
MCValue V;
|
||||
if (!Expr->evaluateAsRelocatable(V, nullptr, nullptr))
|
||||
return false;
|
||||
|
||||
if (V.getSymB() || V.getRefKind() != MCSymbolRefExpr::VK_None)
|
||||
return false;
|
||||
|
||||
const MCSymbolRefExpr *Ref = V.getSymA();
|
||||
if (!Ref)
|
||||
return false;
|
||||
|
||||
|
@ -14,6 +14,9 @@ foo:
|
||||
.global bar
|
||||
bar = foo
|
||||
|
||||
.global baz
|
||||
baz = foo + 2
|
||||
|
||||
@@ make sure foo and bar are thumb function: bit 0 = 1 (st_value)
|
||||
@CHECK: Symbol {
|
||||
@CHECK: Name: bar
|
||||
@ -22,6 +25,13 @@ bar = foo
|
||||
@CHECK-NEXT: Binding: Global
|
||||
@CHECK-NEXT: Type: Function
|
||||
|
||||
@CHECK: Symbol {
|
||||
@CHECK: Name: baz
|
||||
@CHECK-NEXT: Value: 0x3
|
||||
@CHECK-NEXT: Size: 0
|
||||
@CHECK-NEXT: Binding: Global
|
||||
@CHECK-NEXT: Type: Function
|
||||
|
||||
@CHECK: Symbol {
|
||||
@CHECK: Name: foo
|
||||
@CHECK-NEXT: Value: 0x1
|
||||
|
Loading…
x
Reference in New Issue
Block a user