[llvm] r263528 - [MachO] Extend the alt_entry support for aliases added in r263521 to
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 14 21:20:49 PDT 2016
Author: lhames
Date: Mon Mar 14 23:20:49 2016
New Revision: 263528
URL: http://llvm.org/viewvc/llvm-project?rev=263528&view=rev
Log:
[MachO] Extend the alt_entry support for aliases added in r263521 to
expressions of the form 'a = .' and 'a = Ltmp'.
Modified:
llvm/trunk/lib/MC/MCMachOStreamer.cpp
llvm/trunk/test/MC/MachO/altentry.s
Modified: llvm/trunk/lib/MC/MCMachOStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCMachOStreamer.cpp?rev=263528&r1=263527&r2=263528&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCMachOStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCMachOStreamer.cpp Mon Mar 14 23:20:49 2016
@@ -203,10 +203,13 @@ void MCMachOStreamer::EmitLabel(MCSymbol
void MCMachOStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
MCValue Res;
- if (Value->evaluateAsRelocatable(Res, nullptr, nullptr))
- if (Res.getSymA() && !Res.getSymB() && Res.getConstant() != 0)
- cast<MCSymbolMachO>(Symbol)->setAltEntry();
-
+ if (Value->evaluateAsRelocatable(Res, nullptr, nullptr)) {
+ if (const MCSymbolRefExpr *SymAExpr = Res.getSymA()) {
+ const MCSymbol &SymA = SymAExpr->getSymbol();
+ if (!Res.getSymB() && (SymA.getName() == "" || Res.getConstant() != 0))
+ cast<MCSymbolMachO>(Symbol)->setAltEntry();
+ }
+ }
MCObjectStreamer::EmitAssignment(Symbol, Value);
}
Modified: llvm/trunk/test/MC/MachO/altentry.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/MachO/altentry.s?rev=263528&r1=263527&r2=263528&view=diff
==============================================================================
--- llvm/trunk/test/MC/MachO/altentry.s (original)
+++ llvm/trunk/test/MC/MachO/altentry.s Mon Mar 14 23:20:49 2016
@@ -1,31 +1,53 @@
// RUN: llvm-mc -triple x86_64-apple-darwin -filetype=obj %s -o - | llvm-readobj -t | FileCheck %s
- // CHECK: Symbol {
- // CHECK: Name: _offsetsym0
- // CHECK: Flags [ (0x0)
- // CHECK: Value: 0x0
-
- // CHECK: Symbol {
- // CHECK: Name: _offsetsym1
- // CHECK: Flags [ (0x200)
- // CHECK: Value: 0x4
-
- // CHECK: Symbol {
- // CHECK: Name: _offsetsym2
- // CHECK: Flags [ (0x200)
- // CHECK: Value: 0x8
-
- // CHECK: Symbol {
- // CHECK: Name: _offsetsym3
- // CHECK: Flags [ (0x200)
- // CHECK: Value: 0x18
-
- // CHECK: Symbol {
- // CHECK: Symbol {
- // CHECK: Symbol {
+// CHECK: Symbol {
+// CHECK: Name: _foo
+// CHECK: Flags [ (0x0)
+// CHECK: Value: 0x0
+
+// CHECK: Symbol {
+// CHECK: Name: _bar
+// CHECK: Flags [ (0x0)
+// CHECK: Value: 0x0
+
+// CHECK: Symbol {
+// CHECK: Name: _baz
+// CHECK: Flags [ (0x200)
+// CHECK: Value: 0x1
+
+// CHECK: Symbol {
+// CHECK: Name: _offsetsym0
+// CHECK: Flags [ (0x0)
+// CHECK: Value: 0x8
+
+// CHECK: Symbol {
+// CHECK: Name: _offsetsym1
+// CHECK: Flags [ (0x200)
+// CHECK: Value: 0xC
+
+// CHECK: Symbol {
+// CHECK: Name: _offsetsym2
+// CHECK: Flags [ (0x200)
+// CHECK: Value: 0x10
+
+// CHECK: Symbol {
+// CHECK: Name: _offsetsym3
+// CHECK: Flags [ (0x200)
+// CHECK: Value: 0x20
+
+// CHECK: Symbol {
+// CHECK: Symbol {
+// CHECK: Symbol {
.section __TEXT,__text,regular,pure_instructions
+
+_foo:
+_bar = _foo
+ nop
+_baz = .
+
.comm _g0,4,2
+
.section __DATA,__data
.globl _s0
.align 3
More information about the llvm-commits
mailing list