[PATCH] ARM: take care not to set the ThumbFunc bit on TLS data symbols

scott douglass sdouglass at arm.com
Mon Jun 30 02:45:49 PDT 2014


Closed by commit rL212029 (authored by @scott-0).

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D4324

Files:
  llvm/trunk/include/llvm/MC/MCELFSymbolFlags.h
  llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
  llvm/trunk/test/MC/ARM/thumb-types.s

Index: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
===================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
@@ -992,7 +992,8 @@
     return;
 
   const MCSymbolData &SD = Streamer.getOrCreateSymbolData(Symbol);
-  if (MCELF::GetType(SD) & (ELF::STT_FUNC << ELF_STT_Shift))
+  unsigned Type = MCELF::GetType(SD);
+  if (Type == ELF_STT_Func || Type == ELF_STT_GnuIFunc)
     Streamer.EmitThumbFunc(Symbol);
 }
 
Index: llvm/trunk/test/MC/ARM/thumb-types.s
===================================================================
--- llvm/trunk/test/MC/ARM/thumb-types.s
+++ llvm/trunk/test/MC/ARM/thumb-types.s
@@ -29,6 +29,12 @@
 explicit_function:
 	nop
 
+	.long	tls(TPOFF)
+
+	.type indirect_function,%gnu_indirect_function
+indirect_function:
+	nop
+
 	.data
 
 untyped_data_label:
@@ -38,6 +44,14 @@
 explicit_data:
 	.long 0
 
+	.section	.tdata,"awT",%progbits
+	.type	tls,%object
+	.align	2
+tls:
+	.long	42
+	.size	tls, 4
+
+
 @ CHECK: Symbol {
 @ CHECK:   Name: arm_function
 @ CHECK:   Value: 0x6
@@ -69,6 +83,18 @@
 @ CHECK: }
 
 @ CHECK: Symbol {
+@ CHECK:   Name: indirect_function
+@ CHECK:   Value: 0x13
+@ CHECK:   Type: GNU_IFunc
+@ CHECK: }
+
+@ CHECK: Symbol {
+@ CHECK:   Name: tls
+@ CHECK:   Value: 0x0
+@ CHECK:   Type: TLS
+@ CHECK: }
+
+@ CHECK: Symbol {
 @ CHECK:   Name: untyped_data_label
 @ CHECK:   Value: 0x0
 @ CHECK:   Type: None
Index: llvm/trunk/include/llvm/MC/MCELFSymbolFlags.h
===================================================================
--- llvm/trunk/include/llvm/MC/MCELFSymbolFlags.h
+++ llvm/trunk/include/llvm/MC/MCELFSymbolFlags.h
@@ -41,6 +41,7 @@
       ELF_STT_File      = (ELF::STT_FILE      << ELF_STT_Shift),
       ELF_STT_Common    = (ELF::STT_COMMON    << ELF_STT_Shift),
       ELF_STT_Tls       = (ELF::STT_TLS       << ELF_STT_Shift),
+      ELF_STT_GnuIFunc  = (ELF::STT_GNU_IFUNC << ELF_STT_Shift),
       ELF_STT_Loproc    = (ELF::STT_LOPROC    << ELF_STT_Shift),
       ELF_STT_Hiproc    = (ELF::STT_HIPROC    << ELF_STT_Shift),
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4324.10972.patch
Type: text/x-patch
Size: 2144 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140630/34486b8d/attachment.bin>


More information about the llvm-commits mailing list