[PATCH] D74927: [MC][ARM] make Thumb function also if type attribute is set
Stefan Agner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 23 16:19:34 PST 2020
falstaff84 updated this revision to Diff 246131.
falstaff84 added a comment.
- Check if Symbol has previously been defined
- Remove unnecessary cast
- Mark function as override
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74927/new/
https://reviews.llvm.org/D74927
Files:
llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
llvm/test/MC/ARM/thumb-function-address.s
Index: llvm/test/MC/ARM/thumb-function-address.s
===================================================================
--- /dev/null
+++ llvm/test/MC/ARM/thumb-function-address.s
@@ -0,0 +1,20 @@
+@ RUN: llvm-mc -filetype=obj -triple=armv7-linux-gnueabi %s -o %t
+@ RUN: llvm-readobj --symbols %t | FileCheck %s
+
+ .syntax unified
+ .text
+ .thumb
+func_label:
+ .type func_label, %function
+
+@ Check func_label address has bit 1 set.
+@ CHECK: Symbol {
+@ CHECK: Name: func_label (7)
+@ CHECK: Value: 0x1
+@ CHECK: Size: 0
+@ CHECK: Binding: Local (0x0)
+@ CHECK: Type: Function (0x2)
+@ CHECK: Other: 0
+@ CHECK: Section: .text (0x2)
+@ CHECK: }
+
Index: llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
===================================================================
--- llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
+++ llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
@@ -587,6 +587,20 @@
}
}
+ bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override {
+ bool val = MCELFStreamer::EmitSymbolAttribute(Symbol, Attribute);
+
+ if (!IsThumb)
+ return val;
+
+ unsigned Type = cast<MCSymbolELF>(Symbol)->getType();
+ if ((Type == ELF::STT_FUNC || Type == ELF::STT_GNU_IFUNC) &&
+ Symbol->isDefined())
+ getAssembler().setIsThumbFunc(Symbol);
+
+ return val;
+ };
+
private:
enum ElfMappingSymbol {
EMS_None,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74927.246131.patch
Type: text/x-patch
Size: 1434 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200224/a49e19bd/attachment.bin>
More information about the llvm-commits
mailing list