mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-15 23:31:37 +00:00
1. ARM/MC/ELF: A few more ELF relocs for .o
2. Fixed EmitLocalCommonSymbol for ELF (Yes, they exist. :) Test added. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121951 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
745dacc91d
commit
f13743bb3c
@ -1565,8 +1565,12 @@ unsigned ARMELFObjectWriter::GetRelocType(const MCValue &Target,
|
|||||||
Type = ELF::R_ARM_GOT_BREL; break;
|
Type = ELF::R_ARM_GOT_BREL; break;
|
||||||
case MCSymbolRefExpr::VK_ARM_TLSGD:
|
case MCSymbolRefExpr::VK_ARM_TLSGD:
|
||||||
Type = ELF::R_ARM_TLS_GD32; break;
|
Type = ELF::R_ARM_TLS_GD32; break;
|
||||||
|
case MCSymbolRefExpr::VK_ARM_TPOFF:
|
||||||
|
Type = ELF::R_ARM_TLS_LE32; break;
|
||||||
case MCSymbolRefExpr::VK_ARM_GOTTPOFF:
|
case MCSymbolRefExpr::VK_ARM_GOTTPOFF:
|
||||||
Type = ELF::R_ARM_TLS_IE32; break;
|
Type = ELF::R_ARM_TLS_IE32; break;
|
||||||
|
case MCSymbolRefExpr::VK_None:
|
||||||
|
Type = ELF::R_ARM_ABS32; break;
|
||||||
case MCSymbolRefExpr::VK_ARM_GOTOFF:
|
case MCSymbolRefExpr::VK_ARM_GOTOFF:
|
||||||
Type = ELF::R_ARM_GOTOFF32; break;
|
Type = ELF::R_ARM_GOTOFF32; break;
|
||||||
} break;
|
} break;
|
||||||
@ -1579,6 +1583,8 @@ unsigned ARMELFObjectWriter::GetRelocType(const MCValue &Target,
|
|||||||
case ARM::fixup_arm_thumb_br:
|
case ARM::fixup_arm_thumb_br:
|
||||||
assert(0 && "Unimplemented"); break;
|
assert(0 && "Unimplemented"); break;
|
||||||
case ARM::fixup_arm_branch:
|
case ARM::fixup_arm_branch:
|
||||||
|
// FIXME: Differentiate between R_ARM_CALL and
|
||||||
|
// R_ARM_JUMP24 (latter used for conditional jumps)
|
||||||
Type = ELF::R_ARM_CALL; break;
|
Type = ELF::R_ARM_CALL; break;
|
||||||
case ARM::fixup_arm_movt_hi16:
|
case ARM::fixup_arm_movt_hi16:
|
||||||
Type = ELF::R_ARM_MOVT_ABS; break;
|
Type = ELF::R_ARM_MOVT_ABS; break;
|
||||||
|
@ -113,9 +113,8 @@ public:
|
|||||||
SD.setSize(Value);
|
SD.setSize(Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size) {
|
virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size);
|
||||||
assert(0 && "ELF doesn't support this directive");
|
|
||||||
}
|
|
||||||
virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
|
virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
|
||||||
unsigned Size = 0, unsigned ByteAlignment = 0) {
|
unsigned Size = 0, unsigned ByteAlignment = 0) {
|
||||||
assert(0 && "ELF doesn't support this directive");
|
assert(0 && "ELF doesn't support this directive");
|
||||||
@ -362,6 +361,16 @@ void MCELFStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
|||||||
SD.setSize(MCConstantExpr::Create(Size, getContext()));
|
SD.setSize(MCConstantExpr::Create(Size, getContext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MCELFStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size) {
|
||||||
|
// FIXME: Should this be caught and done earlier?
|
||||||
|
MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
|
||||||
|
SetBinding(SD, ELF::STB_LOCAL);
|
||||||
|
SD.setExternal(false);
|
||||||
|
BindingExplicitlySet.insert(Symbol);
|
||||||
|
// FIXME: ByteAlignment is not needed here, but is required.
|
||||||
|
EmitCommonSymbol(Symbol, Size, 1);
|
||||||
|
}
|
||||||
|
|
||||||
void MCELFStreamer::EmitBytes(StringRef Data, unsigned AddrSpace) {
|
void MCELFStreamer::EmitBytes(StringRef Data, unsigned AddrSpace) {
|
||||||
// TODO: This is exactly the same as WinCOFFStreamer. Consider merging into
|
// TODO: This is exactly the same as WinCOFFStreamer. Consider merging into
|
||||||
// MCObjectStreamer.
|
// MCObjectStreamer.
|
||||||
|
35
test/CodeGen/ARM/2010-12-15-elf-lcomm.ll
Normal file
35
test/CodeGen/ARM/2010-12-15-elf-lcomm.ll
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
; RUN: llc %s -mtriple=armv7-linux-gnueabi -arm-use-movt -filetype=obj -o - | \
|
||||||
|
; RUN: elf-dump --dump-section-data | FileCheck -check-prefix=OBJ %s
|
||||||
|
; RUN: llc %s -mtriple=armv7-linux-gnueabi -arm-use-movt -o - | \
|
||||||
|
; RUN: FileCheck -check-prefix=ASM %s
|
||||||
|
|
||||||
|
|
||||||
|
@dummy = internal global i32 666
|
||||||
|
@array00 = internal global [20 x i32] zeroinitializer
|
||||||
|
@sum = internal global i32 55
|
||||||
|
@STRIDE = internal global i32 8
|
||||||
|
|
||||||
|
; ASM: .type array00,%object @ @array00
|
||||||
|
; ASM-NEXT: .lcomm array00,80 @ @array00
|
||||||
|
; ASM-NEXT: .type _MergedGlobals,%object @ @_MergedGlobals
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; OBJ: Section 0x00000003
|
||||||
|
; OBJ-NEXT: '.bss'
|
||||||
|
|
||||||
|
; OBJ: 'array00'
|
||||||
|
; OBJ-NEXT: 'st_value', 0x00000000
|
||||||
|
; OBJ-NEXT: 'st_size', 0x00000050
|
||||||
|
; OBJ-NEXT: 'st_bind', 0x00000000
|
||||||
|
; OBJ-NEXT: 'st_type', 0x00000001
|
||||||
|
; OBJ-NEXT: 'st_other', 0x00000000
|
||||||
|
; OBJ-NEXT: 'st_shndx', 0x00000003
|
||||||
|
|
||||||
|
define i32 @main(i32 %argc) nounwind {
|
||||||
|
%1 = load i32* @sum, align 4
|
||||||
|
%2 = getelementptr [20 x i32]* @array00, i32 0, i32 %argc
|
||||||
|
%3 = load i32* %2, align 4
|
||||||
|
%4 = add i32 %1, %3
|
||||||
|
ret i32 %4;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user