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. llvm-svn: 207613
This commit is contained in:
parent
948dfbf3c4
commit
0aca1c30c6
|
@ -44,6 +44,7 @@
|
|||
#include "llvm/MC/MCStreamer.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include "llvm/Support/ARMBuildAttributes.h"
|
||||
#include "llvm/Support/COFF.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ELF.h"
|
||||
|
@ -97,7 +98,28 @@ bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||
AFI = MF.getInfo<ARMFunctionInfo>();
|
||||
MCP = MF.getConstantPool();
|
||||
|
||||
return AsmPrinter::runOnMachineFunction(MF);
|
||||
SetupMachineFunction(MF);
|
||||
|
||||
if (Subtarget->isTargetCOFF()) {
|
||||
bool Internal = MF.getFunction()->hasInternalLinkage();
|
||||
COFF::SymbolStorageClass Scl = Internal ? COFF::IMAGE_SYM_CLASS_STATIC
|
||||
: COFF::IMAGE_SYM_CLASS_EXTERNAL;
|
||||
int Type = COFF::IMAGE_SYM_DTYPE_FUNCTION << COFF::SCT_COMPLEX_TYPE_SHIFT;
|
||||
|
||||
OutStreamer.BeginCOFFSymbolDef(CurrentFnSym);
|
||||
OutStreamer.EmitCOFFSymbolStorageClass(Scl);
|
||||
OutStreamer.EmitCOFFSymbolType(Type);
|
||||
OutStreamer.EndCOFFSymbolDef();
|
||||
}
|
||||
|
||||
// Have common code print out the function header with linkage info etc.
|
||||
EmitFunctionHeader();
|
||||
|
||||
// Emit the rest of the function body.
|
||||
EmitFunctionBody();
|
||||
|
||||
// We didn't modify anything.
|
||||
return false;
|
||||
}
|
||||
|
||||
void ARMAsmPrinter::printOperand(const MachineInstr *MI, int OpNum,
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
; RUN: llc -mtriple thumbv7-windows-itanium -filetype asm -o - %s \
|
||||
; RUN: | FileCheck %s -check-prefix CHECK-ASM
|
||||
|
||||
; RUN: llc -mtriple thumbv7-windows-itanium -filetype obj -o - %s \
|
||||
; RUN: | llvm-readobj -t | FileCheck %s -check-prefix CHECK-OBJECT
|
||||
|
||||
define arm_aapcs_vfpcc void @external() {
|
||||
entry:
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK-ASM: .def external
|
||||
; CHECK-ASM: .scl 2
|
||||
; CHECK-ASM: .type 32
|
||||
; CHECK-ASM: .endef
|
||||
; CHECK-ASM: .globl external
|
||||
|
||||
define internal arm_aapcs_vfpcc void @internal() {
|
||||
entry:
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK-ASM: .def internal
|
||||
; CHECK-ASM: .scl 3
|
||||
; CHECK-ASM: .type 32
|
||||
; CHECK-ASM: .endef
|
||||
; CHECK-ASM-NOT: .globl internal
|
||||
|
||||
; CHECK-OBJECT: Symbol {
|
||||
; CHECK-OBJECT: Name: external
|
||||
; CHECK-OBJECT: Section: .text
|
||||
; CHECK-OBJECT: BaseType: Null
|
||||
; CHECK-OBJECT: ComplexType: Function
|
||||
; CHECK-OBJECT: StorageClass: External
|
||||
; CHECK-OBJECT: AuxSymbolCount: 0
|
||||
; CHECK-OBJECT: }
|
||||
; CHECK-OBJECT: Symbol {
|
||||
; CHECK-OBJECT: Name: internal
|
||||
; CHECK-OBJECT: Section: .text
|
||||
; CHECK-OBJECT: BaseType: Null
|
||||
; CHECK-OBJECT: ComplexType: Function
|
||||
; CHECK-OBJECT: StorageClass: Static
|
||||
; CHECK-OBJECT: AuxSymbolCount: 0
|
||||
; CHECK-OBJECT: }
|
||||
|
Loading…
Reference in New Issue