llvm.org GIT mirror llvm / f3ce0c0
ARM: print COFF function header for Windows on ARM Emit the COFF header when printing out the function. This is important as the header contains two important pieces of information: the storage class for the symbol and the symbol type information. This bit of information is required for the linker to correctly identify the type of symbol that it is dealing with. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207613 91177308-0d34-0410-b5e6-96231b3b80d8 Saleem Abdulrasool 6 years ago
2 changed file(s) with 68 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
4343 #include "llvm/MC/MCStreamer.h"
4444 #include "llvm/MC/MCSymbol.h"
4545 #include "llvm/Support/ARMBuildAttributes.h"
46 #include "llvm/Support/COFF.h"
4647 #include "llvm/Support/CommandLine.h"
4748 #include "llvm/Support/Debug.h"
4849 #include "llvm/Support/ELF.h"
9697 AFI = MF.getInfo();
9798 MCP = MF.getConstantPool();
9899
99 return AsmPrinter::runOnMachineFunction(MF);
100 SetupMachineFunction(MF);
101
102 if (Subtarget->isTargetCOFF()) {
103 bool Internal = MF.getFunction()->hasInternalLinkage();
104 COFF::SymbolStorageClass Scl = Internal ? COFF::IMAGE_SYM_CLASS_STATIC
105 : COFF::IMAGE_SYM_CLASS_EXTERNAL;
106 int Type = COFF::IMAGE_SYM_DTYPE_FUNCTION << COFF::SCT_COMPLEX_TYPE_SHIFT;
107
108 OutStreamer.BeginCOFFSymbolDef(CurrentFnSym);
109 OutStreamer.EmitCOFFSymbolStorageClass(Scl);
110 OutStreamer.EmitCOFFSymbolType(Type);
111 OutStreamer.EndCOFFSymbolDef();
112 }
113
114 // Have common code print out the function header with linkage info etc.
115 EmitFunctionHeader();
116
117 // Emit the rest of the function body.
118 EmitFunctionBody();
119
120 // We didn't modify anything.
121 return false;
100122 }
101123
102124 void ARMAsmPrinter::printOperand(const MachineInstr *MI, int OpNum,
0 ; RUN: llc -mtriple thumbv7-windows-itanium -filetype asm -o - %s \
1 ; RUN: | FileCheck %s -check-prefix CHECK-ASM
2
3 ; RUN: llc -mtriple thumbv7-windows-itanium -filetype obj -o - %s \
4 ; RUN: | llvm-readobj -t | FileCheck %s -check-prefix CHECK-OBJECT
5
6 define arm_aapcs_vfpcc void @external() {
7 entry:
8 ret void
9 }
10
11 ; CHECK-ASM: .def external
12 ; CHECK-ASM: .scl 2
13 ; CHECK-ASM: .type 32
14 ; CHECK-ASM: .endef
15 ; CHECK-ASM: .globl external
16
17 define internal arm_aapcs_vfpcc void @internal() {
18 entry:
19 ret void
20 }
21
22 ; CHECK-ASM: .def internal
23 ; CHECK-ASM: .scl 3
24 ; CHECK-ASM: .type 32
25 ; CHECK-ASM: .endef
26 ; CHECK-ASM-NOT: .globl internal
27
28 ; CHECK-OBJECT: Symbol {
29 ; CHECK-OBJECT: Name: external
30 ; CHECK-OBJECT: Section: .text
31 ; CHECK-OBJECT: BaseType: Null
32 ; CHECK-OBJECT: ComplexType: Function
33 ; CHECK-OBJECT: StorageClass: External
34 ; CHECK-OBJECT: AuxSymbolCount: 0
35 ; CHECK-OBJECT: }
36 ; CHECK-OBJECT: Symbol {
37 ; CHECK-OBJECT: Name: internal
38 ; CHECK-OBJECT: Section: .text
39 ; CHECK-OBJECT: BaseType: Null
40 ; CHECK-OBJECT: ComplexType: Function
41 ; CHECK-OBJECT: StorageClass: Static
42 ; CHECK-OBJECT: AuxSymbolCount: 0
43 ; CHECK-OBJECT: }
44