[llvm-commits] [llvm] r150582 - in /llvm/trunk: lib/MC/MCELFStreamer.cpp test/MC/ELF/tls-i386.s test/MC/ELF/tls.s
David Meyer
pdox at google.com
Wed Feb 15 07:09:06 PST 2012
Author: pdox
Date: Wed Feb 15 09:09:06 2012
New Revision: 150582
URL: http://llvm.org/viewvc/llvm-project?rev=150582&view=rev
Log:
For ELF, also call fixSymbolsInTLSFixups() on expressions passed to EmitValue (literal values). Previously only called on expressions in instructions. New test cases added to tls.s, tls-i386.s. Resolves PR11981.
Modified:
llvm/trunk/lib/MC/MCELFStreamer.cpp
llvm/trunk/test/MC/ELF/tls-i386.s
llvm/trunk/test/MC/ELF/tls.s
Modified: llvm/trunk/lib/MC/MCELFStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCELFStreamer.cpp?rev=150582&r1=150581&r2=150582&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCELFStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCELFStreamer.cpp Wed Feb 15 09:09:06 2012
@@ -102,6 +102,8 @@
unsigned MaxBytesToEmit = 0);
virtual void EmitCodeAlignment(unsigned ByteAlignment,
unsigned MaxBytesToEmit = 0);
+ virtual void EmitValueImpl(const MCExpr *Value, unsigned Size,
+ unsigned AddrSpace);
virtual void EmitFileDirective(StringRef Filename);
@@ -387,6 +389,13 @@
getCurrentSectionData()->setAlignment(ByteAlignment);
}
+void MCELFStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size,
+ unsigned AddrSpace) {
+ fixSymbolsInTLSFixups(Value);
+ MCObjectStreamer::EmitValueImpl(Value, Size, AddrSpace);
+}
+
+
// Add a symbol for the file name of this module. This is the second
// entry in the module's symbol table (the first being the null symbol).
void MCELFStreamer::EmitFileDirective(StringRef Filename) {
Modified: llvm/trunk/test/MC/ELF/tls-i386.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/tls-i386.s?rev=150582&r1=150581&r2=150582&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/tls-i386.s (original)
+++ llvm/trunk/test/MC/ELF/tls-i386.s Wed Feb 15 09:09:06 2012
@@ -9,6 +9,13 @@
movl foo5 at TPOFF(%eax), %eax
movl foo6 at DTPOFF(%eax), %eax
movl foo7 at INDNTPOFF, %eax
+ .long foo8 at NTPOFF
+ .long foo9 at GOTNTPOFF
+ .long fooA at TLSGD
+ .long fooB at TLSLDM
+ .long fooC at TPOFF
+ .long fooD at DTPOFF
+ .long fooE at INDNTPOFF
// CHECK: (('st_name', 0x00000001) # 'foo1'
// CHECK-NEXT: ('st_value', 0x00000000)
@@ -72,3 +79,67 @@
// CHECK-NEXT: ('st_other', 0x00)
// CHECK-NEXT: ('st_shndx', 0x0000)
// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 12
+// CHECK-NEXT: (('st_name', 0x00000024) # 'foo8'
+// CHECK-NEXT: ('st_value', 0x00000000)
+// CHECK-NEXT: ('st_size', 0x00000000)
+// CHECK-NEXT: ('st_bind', 0x1)
+// CHECK-NEXT: ('st_type', 0x6)
+// CHECK-NEXT: ('st_other', 0x00)
+// CHECK-NEXT: ('st_shndx', 0x0000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 13
+// CHECK-NEXT: (('st_name', 0x00000029) # 'foo9'
+// CHECK-NEXT: ('st_value', 0x00000000)
+// CHECK-NEXT: ('st_size', 0x00000000)
+// CHECK-NEXT: ('st_bind', 0x1)
+// CHECK-NEXT: ('st_type', 0x6)
+// CHECK-NEXT: ('st_other', 0x00)
+// CHECK-NEXT: ('st_shndx', 0x0000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 14
+// CHECK-NEXT: (('st_name', 0x0000002e) # 'fooA'
+// CHECK-NEXT: ('st_value', 0x00000000)
+// CHECK-NEXT: ('st_size', 0x00000000)
+// CHECK-NEXT: ('st_bind', 0x1)
+// CHECK-NEXT: ('st_type', 0x6)
+// CHECK-NEXT: ('st_other', 0x00)
+// CHECK-NEXT: ('st_shndx', 0x0000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 15
+// CHECK-NEXT: (('st_name', 0x00000033) # 'fooB'
+// CHECK-NEXT: ('st_value', 0x00000000)
+// CHECK-NEXT: ('st_size', 0x00000000)
+// CHECK-NEXT: ('st_bind', 0x1)
+// CHECK-NEXT: ('st_type', 0x6)
+// CHECK-NEXT: ('st_other', 0x00)
+// CHECK-NEXT: ('st_shndx', 0x0000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 16
+// CHECK-NEXT: (('st_name', 0x00000038) # 'fooC'
+// CHECK-NEXT: ('st_value', 0x00000000)
+// CHECK-NEXT: ('st_size', 0x00000000)
+// CHECK-NEXT: ('st_bind', 0x1)
+// CHECK-NEXT: ('st_type', 0x6)
+// CHECK-NEXT: ('st_other', 0x00)
+// CHECK-NEXT: ('st_shndx', 0x0000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 17
+// CHECK-NEXT: (('st_name', 0x0000003d) # 'fooD'
+// CHECK-NEXT: ('st_value', 0x00000000)
+// CHECK-NEXT: ('st_size', 0x00000000)
+// CHECK-NEXT: ('st_bind', 0x1)
+// CHECK-NEXT: ('st_type', 0x6)
+// CHECK-NEXT: ('st_other', 0x00)
+// CHECK-NEXT: ('st_shndx', 0x0000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 18
+// CHECK-NEXT: (('st_name', 0x00000042) # 'fooE'
+// CHECK-NEXT: ('st_value', 0x00000000)
+// CHECK-NEXT: ('st_size', 0x00000000)
+// CHECK-NEXT: ('st_bind', 0x1)
+// CHECK-NEXT: ('st_type', 0x6)
+// CHECK-NEXT: ('st_other', 0x00)
+// CHECK-NEXT: ('st_shndx', 0x0000)
+// CHECK-NEXT: ),
+
Modified: llvm/trunk/test/MC/ELF/tls.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/tls.s?rev=150582&r1=150581&r2=150582&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/tls.s (original)
+++ llvm/trunk/test/MC/ELF/tls.s Wed Feb 15 09:09:06 2012
@@ -5,12 +5,14 @@
leaq foo1 at TLSGD(%rip), %rdi
leaq foo2 at GOTTPOFF(%rip), %rdi
leaq foo3 at TLSLD(%rip), %rdi
-
+ .long foo4 at GOTTPOFF
+ .long foo5 at TLSLD
+ .long foo6 at TLSGD
.section .zed,"awT", at progbits
foobar:
.long 43
-// CHECK: (('st_name', 0x00000010) # 'foobar'
+// CHECK: (('st_name', 0x0000001f) # 'foobar'
// CHECK-NEXT: ('st_bind', 0x0)
// CHECK-NEXT: ('st_type', 0x6)
// CHECK-NEXT: ('st_other', 0x00)
@@ -46,3 +48,30 @@
// CHECK-NEXT: ('st_value', 0x0000000000000000)
// CHECK-NEXT: ('st_size', 0x0000000000000000)
// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 10
+// CHECK-NEXT: (('st_name', 0x00000010) # 'foo4'
+// CHECK-NEXT: ('st_bind', 0x1)
+// CHECK-NEXT: ('st_type', 0x6)
+// CHECK-NEXT: ('st_other', 0x00)
+// CHECK-NEXT: ('st_shndx', 0x0000)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 11
+// CHECK-NEXT: (('st_name', 0x00000015) # 'foo5'
+// CHECK-NEXT: ('st_bind', 0x1)
+// CHECK-NEXT: ('st_type', 0x6)
+// CHECK-NEXT: ('st_other', 0x00)
+// CHECK-NEXT: ('st_shndx', 0x0000)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 12
+// CHECK-NEXT: (('st_name', 0x0000001a) # 'foo6'
+// CHECK-NEXT: ('st_bind', 0x1)
+// CHECK-NEXT: ('st_type', 0x6)
+// CHECK-NEXT: ('st_other', 0x00)
+// CHECK-NEXT: ('st_shndx', 0x0000)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
More information about the llvm-commits
mailing list