forked from OSchip/llvm-project
[mach-o] Add test case for armv6 (arm not thumb) hello world
llvm-svn: 213592
This commit is contained in:
parent
bb1321a7be
commit
e1aaced0cb
|
@ -185,8 +185,8 @@ const ArchHandler::StubInfo ArchHandler_arm::_sStubInfoArmPIC = {
|
|||
0x00, 0xF0, 0x9C, 0xE5, // ldr pc, [ip]
|
||||
0x00, 0x00, 0x00, 0x00, // L1: .long fFastStubGOTAtom - (helper+16)
|
||||
0x00, 0x00, 0x00, 0x00 }, // L2: .long dyld_stub_binder - (helper+28)
|
||||
{ Reference::KindArch::ARM, delta32, 28, 0 },
|
||||
{ Reference::KindArch::ARM, delta32, 32, 0 }
|
||||
{ Reference::KindArch::ARM, delta32, 28, 0xC },
|
||||
{ Reference::KindArch::ARM, delta32, 32, 0x04 }
|
||||
};
|
||||
|
||||
const ArchHandler::StubInfo &ArchHandler_arm::stubInfo() {
|
||||
|
@ -548,7 +548,7 @@ ArchHandler_arm::getPairReferenceInfo(const normalized::Relocation &reloc1,
|
|||
"subtrahend label is not in atom"));
|
||||
*kind = delta32;
|
||||
value = clearThumbBit(instruction, *target);
|
||||
*addend = value - (toAddress - fromAddress);
|
||||
*addend = (int32_t)(value - (toAddress - fixupAddress));
|
||||
} else if (funcRel) {
|
||||
toAddress = reloc1.value;
|
||||
fromAddress = reloc2.value;
|
||||
|
@ -618,7 +618,6 @@ void ArchHandler_arm::applyFixupFinal(const Reference &ref, uint8_t *location,
|
|||
assert(ref.kindArch() == Reference::KindArch::ARM);
|
||||
int32_t *loc32 = reinterpret_cast<int32_t *>(location);
|
||||
int32_t displacement;
|
||||
// FIXME: these writes may need a swap.
|
||||
switch (ref.kindValue()) {
|
||||
case thumb_b22:
|
||||
// FIXME
|
||||
|
@ -652,10 +651,10 @@ void ArchHandler_arm::applyFixupFinal(const Reference &ref, uint8_t *location,
|
|||
// FIXME
|
||||
break;
|
||||
case pointer32:
|
||||
// FIXME
|
||||
write32(*loc32, _swap, targetAddress + ref.addend());
|
||||
break;
|
||||
case delta32:
|
||||
// FIXME
|
||||
write32(*loc32, _swap, targetAddress - fixupAddress + ref.addend());
|
||||
break;
|
||||
case lazyPointer:
|
||||
case lazyImmediateLocation:
|
||||
|
|
|
@ -951,7 +951,12 @@ void Util::addRebaseAndBindingInfo(const lld::File &atomFile,
|
|||
}
|
||||
|
||||
uint32_t Util::fileFlags() {
|
||||
return 0; //FIX ME
|
||||
// FIXME: these need to determined at runtime.
|
||||
if (_context.outputMachOType() == MH_OBJECT) {
|
||||
return MH_SUBSECTIONS_VIA_SYMBOLS;
|
||||
} else {
|
||||
return MH_DYLDLINK | MH_NOUNDEFS | MH_TWOLEVEL;
|
||||
}
|
||||
}
|
||||
|
||||
} // end anonymous namespace
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
# RUN: lld -flavor darwin -arch armv6 -ios_version_min 7.0 %s -o %t && \
|
||||
# RUN: llvm-nm %t | FileCheck %s
|
||||
#
|
||||
# Test that armv6 (arm) hello-world can be linked into a mach-o executable
|
||||
#
|
||||
|
||||
--- !mach-o
|
||||
arch: armv6
|
||||
file-type: MH_OBJECT
|
||||
flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ]
|
||||
has-UUID: false
|
||||
OS: unknown
|
||||
sections:
|
||||
- segment: __TEXT
|
||||
section: __text
|
||||
type: S_REGULAR
|
||||
attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
|
||||
alignment: 2
|
||||
address: 0x0000000000000000
|
||||
content: [ 0x80, 0x40, 0x2D, 0xE9, 0x10, 0x00, 0x9F, 0xE5,
|
||||
0x0D, 0x70, 0xA0, 0xE1, 0x00, 0x00, 0x8F, 0xE0,
|
||||
0xFA, 0xFF, 0xFF, 0xEB, 0x00, 0x00, 0xA0, 0xE3,
|
||||
0x80, 0x80, 0xBD, 0xE8, 0x0C, 0x00, 0x00, 0x00 ]
|
||||
relocations:
|
||||
- offset: 0x0000001C
|
||||
scattered: true
|
||||
type: ARM_RELOC_SECTDIFF
|
||||
length: 2
|
||||
pc-rel: false
|
||||
value: 0x00000020
|
||||
- offset: 0x00000000
|
||||
scattered: true
|
||||
type: ARM_RELOC_PAIR
|
||||
length: 2
|
||||
pc-rel: false
|
||||
value: 0x0000000C
|
||||
- offset: 0x00000010
|
||||
type: ARM_RELOC_BR24
|
||||
length: 2
|
||||
pc-rel: true
|
||||
extern: true
|
||||
symbol: 1
|
||||
- segment: __TEXT
|
||||
section: __cstring
|
||||
type: S_CSTRING_LITERALS
|
||||
attributes: [ ]
|
||||
address: 0x0000000000000020
|
||||
content: [ 0x68, 0x65, 0x6C, 0x6C, 0x6F, 0x0A, 0x00 ]
|
||||
global-symbols:
|
||||
- name: _main
|
||||
type: N_SECT
|
||||
scope: [ N_EXT ]
|
||||
sect: 1
|
||||
value: 0x0000000000000000
|
||||
undefined-symbols:
|
||||
- name: _printf
|
||||
type: N_UNDF
|
||||
scope: [ N_EXT ]
|
||||
value: 0x0000000000000000
|
||||
|
||||
--- !mach-o
|
||||
arch: armv6
|
||||
file-type: MH_DYLIB
|
||||
flags: [ ]
|
||||
install-name: /usr/lib/libSystem.B.dylib
|
||||
sections:
|
||||
- segment: __TEXT
|
||||
section: __text
|
||||
type: S_REGULAR
|
||||
attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
|
||||
address: 0x0000000000000000
|
||||
content: [ 0x55 ]
|
||||
|
||||
global-symbols:
|
||||
- name: _printf
|
||||
type: N_SECT
|
||||
scope: [ N_EXT ]
|
||||
sect: 1
|
||||
value: 0x0000000000000001
|
||||
- name: dyld_stub_binder
|
||||
type: N_SECT
|
||||
scope: [ N_EXT ]
|
||||
sect: 1
|
||||
value: 0x0000000000000001
|
||||
|
||||
...
|
||||
|
||||
# CHECK: {{[0-9a-f]+}} T _main
|
||||
# CHECK: U _printf
|
||||
# CHECK: U dyld_stub_binder
|
Loading…
Reference in New Issue