MC/Mach-O/Thumb: Set the thumb bit in the symbol table.
authorDaniel Dunbar <daniel@zuster.org>
Wed, 29 Dec 2010 14:14:06 +0000 (14:14 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Wed, 29 Dec 2010 14:14:06 +0000 (14:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122630 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCMachOSymbolFlags.h
lib/MC/MCMachOStreamer.cpp
test/MC/MachO/darwin-Thumb-reloc.s

index 787131245544f58a4d81a5dbc6d266e16c95a2f4..696436dffa6eca3a52f9ae38163c259fd287ce8a 100644 (file)
@@ -34,6 +34,7 @@ namespace llvm {
     SF_ReferenceTypePrivateUndefinedLazy    = 0x0005,
 
     // Other 'desc' flags.
+    SF_ThumbFunc                            = 0x0008,
     SF_NoDeadStrip                          = 0x0020,
     SF_WeakReference                        = 0x0040,
     SF_WeakDefinition                       = 0x0080,
index 0e21f4d00c14271f6ef19b9634747dda8c77dd1a..7e1cda25b6f38b44aac7723b1e197db976860d54 100644 (file)
@@ -140,12 +140,16 @@ void MCMachOStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
   }
 }
 
-void MCMachOStreamer::EmitThumbFunc(MCSymbol *Func) {
+void MCMachOStreamer::EmitThumbFunc(MCSymbol *Symbol) {
   // FIXME: Flag the function ISA as thumb with DW_AT_APPLE_isa.
 
   // Remember that the function is a thumb function. Fixup and relocation
   // values will need adjusted.
-  getAssembler().setIsThumbFunc(Func);
+  getAssembler().setIsThumbFunc(Symbol);
+
+  // Mark the thumb bit on the symbol.
+  MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
+  SD.setFlags(SD.getFlags() | SF_ThumbFunc);
 }
 
 void MCMachOStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
index 200b8593791ad620bc0ac31138a9f9513f427629..567573d9ef197cc6ad17eb4e4019707390c9a0c2 100644 (file)
@@ -98,7 +98,7 @@ L_.str:
 @ CHECK:    (('n_strx', 1)
 @ CHECK:     ('n_type', 0xf)
 @ CHECK:     ('n_sect', 1)
-@ CHECK-FIXME:     ('n_desc', 8)
+@ CHECK:     ('n_desc', 8)
 @ CHECK:     ('n_value', 0)
 @ CHECK:     ('_string', '_main')
 @ CHECK:    ),