Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeDyld test failures on powerpc-darwin8 #21014

Closed
llvmbot opened this issue Aug 12, 2014 · 21 comments
Closed

RuntimeDyld test failures on powerpc-darwin8 #21014

llvmbot opened this issue Aug 12, 2014 · 21 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla build-problem obsolete Issues with old (unsupported) versions of LLVM

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Aug 12, 2014

Bugzilla Link 20640
Version trunk
OS MacOS X
Reporter LLVM Bugzilla Contributor

Extended Description

FAIL: LLVM :: ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s (6222 of 11280)
******************** TEST 'LLVM :: ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s' FAILED ********************
Script:

gtimeout 1m /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-mc -triple=armv7s-apple-ios7.0.0 -relocation-model=pic -filetype=obj -o /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/ARM/Output/foo.o /Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s
gtimeout 1m /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -triple=armv7s-apple-ios7.0.0 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/ARM/Output/foo.o

Exit Code: 1

Command Output (stderr):

Error evaluating expression '*{4}(stub_addr(foo.o, __text, baz)) = 0xe51ff004': File 'foo.o' not found. No stubs registered.

Error evaluating expression '*{4}(stub_addr(foo.o, __text, baz) + 4) = baz': File 'foo.o' not found. No stubs registered.

Error evaluating expression 'decode_operand(insn3, 0) = stub_addr(foo.o, __text, baz) - (insn3 + 8)': Operand '0' of instruction 'insn3' is not an immediate.
Instruction is:
<MCInst #​424 STRD >
/Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld: error: some checks in '/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s' failed

--


UNSUPPORTED: LLVM :: ExecutionEngine/fma3-jit.ll (6223 of 11280)
FAIL: LLVM :: ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s (6224 of 11280)
******************** TEST 'LLVM :: ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s' FAILED ********************
Script:

gtimeout 1m /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-mc -triple=x86_64-apple-macosx10.9 -relocation-model=pic -filetype=obj -o /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/X86/Output/foo.o /Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s
gtimeout 1m /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -triple=x86_64-apple-macosx10.9 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/X86/Output/foo.o

Exit Code: 1

Command Output (stderr):

Expression '*{8}(stub_addr(foo.o, __text, y)) = y' is false: 0x30000000000000 != 0x3000
/Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld: error: some checks in '/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s' failed

--


r213572: good
r214445: bad
r215366: bad

You mentioned in IRC that you suspect a matter of endian-ness. I'll be happy to test any patches for you.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 12, 2014

assigned to @lhames

@lhames
Copy link
Contributor

lhames commented Aug 19, 2014

Hi David,

I've committed r215938, which is intended to fix endianness handling in RuntimeDyldMachO. This may address some of the issues you've been seeing.

I would not expect the endianness fix to impact the issues that you're seeing in the ARM test - I think there may be something else going on there. I recently ran in to a failure with very similar symptoms on one of my systems and the culprit turned out to be a crufty 'foo.o' object file from an earlier compile that had not been deleted. It might be worth manually clearing out /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/ARM/Output/* to see if that fixes your issue.

  • Lang.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 20, 2014

Hi Lang, I cleaned out that Output dir, but still see failures, but with more diagnostics in one case:

% bin/llvm-lit -v test/ExecutionEngine/RuntimeDyld
second level name optional in hw.optional.fma is invalid
-- Testing: 3 tests, 2 threads --
UNSUPPORTED: LLVM :: ExecutionEngine/RuntimeDyld/AArch64/MachO_ARM64_relocations.s (1 of 3)
FAIL: LLVM :: ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s (2 of 3)
******************** TEST 'LLVM :: ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s' FAILED ********************
Script:

gtimeout 1m /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-mc -triple=armv7s-apple-ios7.0.0 -relocation-model=pic -filetype=obj -o /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/ARM/Output/foo.o /Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s
gtimeout 1m /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -triple=armv7s-apple-ios7.0.0 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/ARM/Output/foo.o

Exit Code: 1

Command Output (stderr):

Error evaluating expression '*{4}(stub_addr(foo.o, __text, baz)) = 0xe51ff004': File 'foo.o' not found. No stubs registered.

Error evaluating expression '*{4}(stub_addr(foo.o, __text, baz) + 4) = baz': File 'foo.o' not found. No stubs registered.

Error evaluating expression 'decode_operand(insn3, 0) = stub_addr(foo.o, __text, baz) - (insn3 + 8)': Operand '0' of instruction 'insn3' is not an immediate.
Instruction is:
<MCInst #​426 STRD >
/Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld: error: some checks in '/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s' failed

--


FAIL: LLVM :: ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s (3 of 3)
******************** TEST 'LLVM :: ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s' FAILED ********************
Script:

gtimeout 1m /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-mc -triple=x86_64-apple-macosx10.9 -relocation-model=pic -filetype=obj -o /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/X86/Output/foo.o /Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s
gtimeout 1m /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -triple=x86_64-apple-macosx10.9 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/X86/Output/foo.o

Exit Code: 1

Command Output (stderr):

Expression 'decode_operand(insn1, 0) = foo - next_pc(insn1)' is false: 0xffffffffffffffff != 0xffffffffffffffeb
Expression 'decode_operand(insn2, 4) = x - next_pc(insn2)' is false: 0x0 != 0xfe5
Expression 'decode_operand(insn3, 4) = stub_addr(foo.o, __text, y) - next_pc(insn3)' is false: 0x0 != 0x6
/Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld: error: some checks in '/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s' failed

--


Testing Time: 8.29s


Failing Tests (2):
LLVM :: ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s
LLVM :: ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s

Unsupported Tests : 1
Unexpected Failures: 2

@lhames
Copy link
Contributor

lhames commented Aug 20, 2014

Patch to add extra debug logging to RuntimeDyldChecker.
Hi David,

This patch will enable extra debug logging from RuntimeDyldChecker which will hopefully help us track down the source of this bug. Could you please:

(1) Apply this patch to your tree.
(2) Copy the failing tests into a scratch directory.
(3) Manually create the objects using llvm-mc with the options specified in the tests.
(4) Manually run the llvm-rtdyld lines with the options specified in the tests.

Once you've verified that that's failing (hopefully in the same way that you're seeing in the regression runs, could you then:

(5) Re-run the llvm-rtdyld commands and add the '-debug' option, and attach the resulting debug output to this bug report?

Cheers,
Lang.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 20, 2014

Here's the requested output for the ARM test case:

% /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=armv7s-apple-ios7.0.0 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/ARM/Output/foo.o
Args: /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=armv7s-apple-ios7.0.0 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/ARM/Output/foo.o
Parse symbols:
emitSection SectionID: 0 Name: __text obj addr: 0x4003570 new addr: 0xed000 DataSize: 24 StubBufSize: 40 Allocate: 64
Offset: 0x0 flags: 0 SID: 0 Type: 4 Name: insn1
Offset: 0x8 flags: 0 SID: 0 Type: 4 Name: nextPC
Offset: 0x4 flags: 0 SID: 0 Type: 4 Name: insn2
Offset: 0xc flags: 0 SID: 0 Type: 4 Name: insn3
Offset: 0x0 flags: 2 SID: 0 Type: 4 Name: bar
Offset: 0x14 flags: 2 SID: 0 Type: 4 Name: foo
Type: 0 Name: baz
emitCommonSection SectionID: 1 new addr: 0xee000 DataSize: 8
Allocating common symbol baz address 0xee000
Parse relocations:
SectionID: 0
resolveRelocation Section: 0 LocalAddress: 0xed00c FinalAddress: 0x0 Value: 0x0 Addend: 0 isPCRel: 1 MachoType: 5 Size: 4
Registering stubs for file 'foo.o', section '__text'
Resolving relocations Section #​0 0x1000
Resolving relocations Section #​1 0x2000
resolveRelocation Section: 0 LocalAddress: 0xed01c FinalAddress: 0x0 Value: 0x0 Addend: -64 isPCRel: 0 MachoType: 0 Size: 4
RuntimeDyldChecker: Checking 'decode_operand(insn1, 1) = (foo-(nextPC+8))[15:0]'...
Reading section starting at symbol 'insn1' - SID: 0, Offset: 0, Size: 240: OPC_ExtractField(25, 3): 1
3: OPC_FilterValue(0, 3020): FAIL: continuing at 3027
3027: OPC_FilterValue(1, 403): PASS: continuing at 3031
3031: OPC_ExtractField(21, 1): 0
3034: OPC_FilterValue(0, 170): PASS: continuing at 3038
3038: OPC_ExtractField(24, 1): 1
3041: OPC_FilterValue(0, 62): FAIL: continuing at 3107
3107: OPC_FilterValue(1, 4551): PASS: continuing at 3111
3111: OPC_ExtractField(22, 2): 0
3114: OPC_FilterValue(0, 32): PASS: continuing at 3118
3118: OPC_ExtractField(20, 1): 0
3121: OPC_FilterValue(0, 8): PASS: continuing at 3125
3125: OPC_CheckPredicate(10): PASS
3129: OPC_Decode: opcode 221, using decoder 49
----- DECODE SUCCESSFUL -----
RuntimeDyldChecker: 'decode_operand(insn1, 1) = (foo-(nextPC+8))[15:0]' passed.
RuntimeDyldChecker: Checking 'decode_operand(insn2, 2) = (foo-(nextPC+8))[31:16]'...
Reading section starting at symbol 'insn2' - SID: 0, Offset: 4, Size: 200: OPC_ExtractField(25, 3): 1
3: OPC_FilterValue(0, 3020): FAIL: continuing at 3027
3027: OPC_FilterValue(1, 403): PASS: continuing at 3031
3031: OPC_ExtractField(21, 1): 0
3034: OPC_FilterValue(0, 170): PASS: continuing at 3038
3038: OPC_ExtractField(24, 1): 1
3041: OPC_FilterValue(0, 62): FAIL: continuing at 3107
3107: OPC_FilterValue(1, 4551): PASS: continuing at 3111
3111: OPC_ExtractField(22, 2): 1
3114: OPC_FilterValue(0, 32): FAIL: continuing at 3150
3150: OPC_FilterValue(1, 31): PASS: continuing at 3154
3154: OPC_ExtractField(20, 1): 0
3157: OPC_FilterValue(0, 8): PASS: continuing at 3161
3161: OPC_CheckPredicate(10): PASS
3165: OPC_Decode: opcode 216, using decoder 49
----- DECODE SUCCESSFUL -----
RuntimeDyldChecker: 'decode_operand(insn2, 2) = (foo-(nextPC+8))[31:16]' passed.
RuntimeDyldChecker: Checking '{4}(stub_addr(foo.o, __text, baz)) = 0xe51ff004'...
Error evaluating expression '
{4}(stub_addr(foo.o, __text, baz)) = 0xe51ff004': File 'foo.o' not found. No stubs registered.

RuntimeDyldChecker: '{4}(stub_addr(foo.o, __text, baz)) = 0xe51ff004' FAILED.
RuntimeDyldChecker: Checking '
{4}(stub_addr(foo.o, __text, baz) + 4) = baz'...
Error evaluating expression '*{4}(stub_addr(foo.o, __text, baz) + 4) = baz': File 'foo.o' not found. No stubs registered.

RuntimeDyldChecker: '*{4}(stub_addr(foo.o, __text, baz) + 4) = baz' FAILED.
RuntimeDyldChecker: Checking 'decode_operand(insn3, 0) = stub_addr(foo.o, __text, baz) - (insn3 + 8)'...
Reading section starting at symbol 'insn3' - SID: 0, Offset: 12, Size: 120: OPC_ExtractField(25, 3): 0
3: OPC_FilterValue(0, 3020): PASS: continuing at 7
7: OPC_ExtractField(21, 1): 0
10: OPC_FilterValue(0, 1545): PASS: continuing at 14
14: OPC_ExtractField(24, 1): 1
17: OPC_FilterValue(0, 336): FAIL: continuing at 357
357: OPC_FilterValue(1, 7301): PASS: continuing at 361
361: OPC_ExtractField(22, 2): 0
364: OPC_FilterValue(0, 422): PASS: continuing at 368
368: OPC_ExtractField(20, 1): 0
371: OPC_FilterValue(0, 349): PASS: continuing at 375
375: OPC_ExtractField(5, 1): 1
378: OPC_FilterValue(0, 276): FAIL: continuing at 658
658: OPC_FilterValue(1, 801): PASS: continuing at 662
662: OPC_ExtractField(6, 2): 3
665: OPC_FilterValue(1, 19): FAIL: continuing at 688
688: OPC_FilterValue(2, 14): FAIL: continuing at 706
706: OPC_FilterValue(3, 753): PASS: continuing at 710
710: OPC_CheckPredicate(3): PASS
714: OPC_CheckField(4, 1, 0, 743): FieldValue = 1, ExpectedValue = 0: FAIL
1463: OPC_ExtractField(4, 4): 15
1466: OPC_FilterValue(11, 27): FAIL: continuing at 1497
1497: OPC_FilterValue(13, 27): FAIL: continuing at 1528
1528: OPC_FilterValue(15, 6130): PASS: continuing at 1532
1532: OPC_ExtractField(20, 1): 0
1535: OPC_FilterValue(0, 8): PASS: continuing at 1539
1539: OPC_CheckPredicate(3): PASS
1543: OPC_Decode: opcode 426, using decoder 7
----- DECODE SUCCESSFUL -----
Error evaluating expression 'decode_operand(insn3, 0) = stub_addr(foo.o, __text, baz) - (insn3 + 8)': Operand '0' of instruction 'insn3' is not an immediate.
Instruction is:
<MCInst #​426 STRD >
RuntimeDyldChecker: 'decode_operand(insn3, 0) = stub_addr(foo.o, __text, baz) - (insn3 + 8)' FAILED.
/Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld: error: some checks in '/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s' failed


and for the X86 test case:

% /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=x86_64-apple-macosx10.9 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/X86/Output/foo.o
Args: /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=x86_64-apple-macosx10.9 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/X86/Output/foo.o
Parse symbols:
emitSection SectionID: 0 Name: __text obj addr: 0x40035e0 new addr: 0xed000 DataSize: 40 StubBufSize: 24 Allocate: 64
Offset: 0x10 flags: 0 SID: 0 Type: 4 Name: insn1
Offset: 0x15 flags: 0 SID: 0 Type: 4 Name: insn2
Offset: 0x1b flags: 0 SID: 0 Type: 4 Name: insn3
Offset: 0x0 flags: 2 SID: 0 Type: 4 Name: foo
Offset: 0x10 flags: 2 SID: 0 Type: 4 Name: main
emitSection SectionID: 1 Name: __data obj addr: 0x4003608 new addr: 0xee000 DataSize: 4 StubBufSize: 0 Allocate: 4
Offset: 0x0 flags: 2 SID: 1 Type: 4 Name: x
Type: 0 Name: y
emitCommonSection SectionID: 2 new addr: 0xef000 DataSize: 8
Allocating common symbol y address 0xef000
Parse relocations:
SectionID: 0
resolveRelocation Section: 0 LocalAddress: 0xed01e FinalAddress: 0x0 Value: 0x0 Addend: 0 isPCRel: 1 MachoType: 0 Size: 4
Registering stubs for file 'foo.o', section '__text'
Symbol '0' location - SID:0, Offset: 40
Resolving relocations Section #​0 0x1000
resolveRelocation Section: 0 LocalAddress: 0xed011 FinalAddress: 0x0 Value: 0x0 Addend: 0 isPCRel: 1 MachoType: 2 Size: 4
Resolving relocations Section #​1 0x2000
resolveRelocation Section: 0 LocalAddress: 0xed017 FinalAddress: 0x0 Value: 0x0 Addend: 0 isPCRel: 1 MachoType: 1 Size: 4
Resolving relocations Section #​2 0x3000
resolveRelocation Section: 0 LocalAddress: 0xed028 FinalAddress: 0x0 Value: 0x0 Addend: 0 isPCRel: 0 MachoType: 0 Size: 8
RuntimeDyldChecker: Checking 'decode_operand(insn1, 0) = foo - next_pc(insn1)'...
Reading section starting at symbol 'insn1' - SID: 0, Offset: 16, Size: 24Reading section starting at symbol 'insn1' - SID: 0, Offset: 16, Size: 24Expression 'decode_operand(insn1, 0) = foo - next_pc(insn1)' is false: 0xffffffffffffffff != 0xffffffffffffffeb
RuntimeDyldChecker: 'decode_operand(insn1, 0) = foo - next_pc(insn1)' FAILED.
RuntimeDyldChecker: Checking 'decode_operand(insn2, 4) = x - next_pc(insn2)'...
Reading section starting at symbol 'insn2' - SID: 0, Offset: 21, Size: 19Reading section starting at symbol 'insn2' - SID: 0, Offset: 21, Size: 19Expression 'decode_operand(insn2, 4) = x - next_pc(insn2)' is false: 0x0 != 0xfe5
RuntimeDyldChecker: 'decode_operand(insn2, 4) = x - next_pc(insn2)' FAILED.
RuntimeDyldChecker: Checking '{8}(stub_addr(foo.o, __text, y)) = y'...
RuntimeDyldChecker: '
{8}(stub_addr(foo.o, __text, y)) = y' passed.
RuntimeDyldChecker: Checking 'decode_operand(insn3, 4) = stub_addr(foo.o, __text, y) - next_pc(insn3)'...
Reading section starting at symbol 'insn3' - SID: 0, Offset: 27, Size: 13Reading section starting at symbol 'insn3' - SID: 0, Offset: 27, Size: 13Expression 'decode_operand(insn3, 4) = stub_addr(foo.o, __text, y) - next_pc(insn3)' is false: 0x0 != 0x6
RuntimeDyldChecker: 'decode_operand(insn3, 4) = stub_addr(foo.o, __text, y) - next_pc(insn3)' FAILED.
/Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld: error: some checks in '/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s' failed

Does this help?

@lhames
Copy link
Contributor

lhames commented Aug 20, 2014

Patch to add extra debug logging to RuntimeDyldChecker v2.
Previous debug-output patch had a think-o in it. That has been fixed in this version.

@lhames
Copy link
Contributor

lhames commented Aug 20, 2014

Patch to add extra debug logging to RuntimeDyldChecker v3.
And this version of the patch tidies up the output a little better (by including a previously missing newline).

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 20, 2014

-debug output again for ARM case:

/Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=armv7s-apple-ios7.0.0 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/ARM/Output/foo.o
Args: /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=armv7s-apple-ios7.0.0 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/ARM/Output/foo.o
Parse symbols:
emitSection SectionID: 0 Name: __text obj addr: 0x4003570 new addr: 0xed000 DataSize: 24 StubBufSize: 40 Allocate: 64
Offset: 0x0 flags: 0 SID: 0 Type: 4 Name: insn1
Offset: 0x8 flags: 0 SID: 0 Type: 4 Name: nextPC
Offset: 0x4 flags: 0 SID: 0 Type: 4 Name: insn2
Offset: 0xc flags: 0 SID: 0 Type: 4 Name: insn3
Offset: 0x0 flags: 2 SID: 0 Type: 4 Name: bar
Offset: 0x14 flags: 2 SID: 0 Type: 4 Name: foo
Type: 0 Name: baz
emitCommonSection SectionID: 1 new addr: 0xee000 DataSize: 8
Allocating common symbol baz address 0xee000
Parse relocations:
SectionID: 0
resolveRelocation Section: 0 LocalAddress: 0xed00c FinalAddress: 0x0 Value: 0x0 Addend: 0 isPCRel: 1 MachoType: 5 Size: 4
Registering stubs for file 'foo.o', section '__text'
Resolving relocations Section #​0 0x1000
Resolving relocations Section #​1 0x2000
resolveRelocation Section: 0 LocalAddress: 0xed01c FinalAddress: 0x0 Value: 0x0 Addend: -64 isPCRel: 0 MachoType: 0 Size: 4
RuntimeDyldChecker: Checking 'decode_operand(insn1, 1) = (foo-(nextPC+8))[15:0]'...
Reading section starting at symbol 'insn1' - SID: 0, Offset: 0, Size: 24
0: OPC_ExtractField(25, 3): 1
3: OPC_FilterValue(0, 3020): FAIL: continuing at 3027
3027: OPC_FilterValue(1, 403): PASS: continuing at 3031
3031: OPC_ExtractField(21, 1): 0
3034: OPC_FilterValue(0, 170): PASS: continuing at 3038
3038: OPC_ExtractField(24, 1): 1
3041: OPC_FilterValue(0, 62): FAIL: continuing at 3107
3107: OPC_FilterValue(1, 4551): PASS: continuing at 3111
3111: OPC_ExtractField(22, 2): 0
3114: OPC_FilterValue(0, 32): PASS: continuing at 3118
3118: OPC_ExtractField(20, 1): 0
3121: OPC_FilterValue(0, 8): PASS: continuing at 3125
3125: OPC_CheckPredicate(10): PASS
3129: OPC_Decode: opcode 221, using decoder 49
----- DECODE SUCCESSFUL -----
RuntimeDyldChecker: 'decode_operand(insn1, 1) = (foo-(nextPC+8))[15:0]' passed.
RuntimeDyldChecker: Checking 'decode_operand(insn2, 2) = (foo-(nextPC+8))[31:16]'...
Reading section starting at symbol 'insn2' - SID: 0, Offset: 4, Size: 20
0: OPC_ExtractField(25, 3): 1
3: OPC_FilterValue(0, 3020): FAIL: continuing at 3027
3027: OPC_FilterValue(1, 403): PASS: continuing at 3031
3031: OPC_ExtractField(21, 1): 0
3034: OPC_FilterValue(0, 170): PASS: continuing at 3038
3038: OPC_ExtractField(24, 1): 1
3041: OPC_FilterValue(0, 62): FAIL: continuing at 3107
3107: OPC_FilterValue(1, 4551): PASS: continuing at 3111
3111: OPC_ExtractField(22, 2): 1
3114: OPC_FilterValue(0, 32): FAIL: continuing at 3150
3150: OPC_FilterValue(1, 31): PASS: continuing at 3154
3154: OPC_ExtractField(20, 1): 0
3157: OPC_FilterValue(0, 8): PASS: continuing at 3161
3161: OPC_CheckPredicate(10): PASS
3165: OPC_Decode: opcode 216, using decoder 49
----- DECODE SUCCESSFUL -----
RuntimeDyldChecker: 'decode_operand(insn2, 2) = (foo-(nextPC+8))[31:16]' passed.
RuntimeDyldChecker: Checking '{4}(stub_addr(foo.o, __text, baz)) = 0xe51ff004'...
Error evaluating expression '
{4}(stub_addr(foo.o, __text, baz)) = 0xe51ff004': File 'foo.o' not found. No stubs registered.

RuntimeDyldChecker: '{4}(stub_addr(foo.o, __text, baz)) = 0xe51ff004' FAILED.
RuntimeDyldChecker: Checking '
{4}(stub_addr(foo.o, __text, baz) + 4) = baz'...
Error evaluating expression '*{4}(stub_addr(foo.o, __text, baz) + 4) = baz': File 'foo.o' not found. No stubs registered.

RuntimeDyldChecker: '*{4}(stub_addr(foo.o, __text, baz) + 4) = baz' FAILED.
RuntimeDyldChecker: Checking 'decode_operand(insn3, 0) = stub_addr(foo.o, __text, baz) - (insn3 + 8)'...
Reading section starting at symbol 'insn3' - SID: 0, Offset: 12, Size: 12
0: OPC_ExtractField(25, 3): 0
3: OPC_FilterValue(0, 3020): PASS: continuing at 7
7: OPC_ExtractField(21, 1): 0
10: OPC_FilterValue(0, 1545): PASS: continuing at 14
14: OPC_ExtractField(24, 1): 1
17: OPC_FilterValue(0, 336): FAIL: continuing at 357
357: OPC_FilterValue(1, 7301): PASS: continuing at 361
361: OPC_ExtractField(22, 2): 0
364: OPC_FilterValue(0, 422): PASS: continuing at 368
368: OPC_ExtractField(20, 1): 0
371: OPC_FilterValue(0, 349): PASS: continuing at 375
375: OPC_ExtractField(5, 1): 1
378: OPC_FilterValue(0, 276): FAIL: continuing at 658
658: OPC_FilterValue(1, 801): PASS: continuing at 662
662: OPC_ExtractField(6, 2): 3
665: OPC_FilterValue(1, 19): FAIL: continuing at 688
688: OPC_FilterValue(2, 14): FAIL: continuing at 706
706: OPC_FilterValue(3, 753): PASS: continuing at 710
710: OPC_CheckPredicate(3): PASS
714: OPC_CheckField(4, 1, 0, 743): FieldValue = 1, ExpectedValue = 0: FAIL
1463: OPC_ExtractField(4, 4): 15
1466: OPC_FilterValue(11, 27): FAIL: continuing at 1497
1497: OPC_FilterValue(13, 27): FAIL: continuing at 1528
1528: OPC_FilterValue(15, 6130): PASS: continuing at 1532
1532: OPC_ExtractField(20, 1): 0
1535: OPC_FilterValue(0, 8): PASS: continuing at 1539
1539: OPC_CheckPredicate(3): PASS
1543: OPC_Decode: opcode 426, using decoder 7
----- DECODE SUCCESSFUL -----
Error evaluating expression 'decode_operand(insn3, 0) = stub_addr(foo.o, __text, baz) - (insn3 + 8)': Operand '0' of instruction 'insn3' is not an immediate.
Instruction is:
<MCInst #​426 STRD >
RuntimeDyldChecker: 'decode_operand(insn3, 0) = stub_addr(foo.o, __text, baz) - (insn3 + 8)' FAILED.
/Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld: error: some checks in '/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s' failed

and for X86 case:
/Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=x86_64-apple-macosx10.9 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/X86/Output/foo.o
Args: /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=x86_64-apple-macosx10.9 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/X86/Output/foo.o
Parse symbols:
emitSection SectionID: 0 Name: __text obj addr: 0x40035e0 new addr: 0xed000 DataSize: 40 StubBufSize: 24 Allocate: 64
Offset: 0x10 flags: 0 SID: 0 Type: 4 Name: insn1
Offset: 0x15 flags: 0 SID: 0 Type: 4 Name: insn2
Offset: 0x1b flags: 0 SID: 0 Type: 4 Name: insn3
Offset: 0x0 flags: 2 SID: 0 Type: 4 Name: foo
Offset: 0x10 flags: 2 SID: 0 Type: 4 Name: main
emitSection SectionID: 1 Name: __data obj addr: 0x4003608 new addr: 0xee000 DataSize: 4 StubBufSize: 0 Allocate: 4
Offset: 0x0 flags: 2 SID: 1 Type: 4 Name: x
Type: 0 Name: y
emitCommonSection SectionID: 2 new addr: 0xef000 DataSize: 8
Allocating common symbol y address 0xef000
Parse relocations:
SectionID: 0
resolveRelocation Section: 0 LocalAddress: 0xed01e FinalAddress: 0x0 Value: 0x0 Addend: 0 isPCRel: 1 MachoType: 0 Size: 4
Registering stubs for file 'foo.o', section '__text'
Symbol 'y' location - SID:0, Offset: 40
Resolving relocations Section #​0 0x1000
resolveRelocation Section: 0 LocalAddress: 0xed011 FinalAddress: 0x0 Value: 0x0 Addend: 0 isPCRel: 1 MachoType: 2 Size: 4
Resolving relocations Section #​1 0x2000
resolveRelocation Section: 0 LocalAddress: 0xed017 FinalAddress: 0x0 Value: 0x0 Addend: 0 isPCRel: 1 MachoType: 1 Size: 4
Resolving relocations Section #​2 0x3000
resolveRelocation Section: 0 LocalAddress: 0xed028 FinalAddress: 0x0 Value: 0x0 Addend: 0 isPCRel: 0 MachoType: 0 Size: 8
RuntimeDyldChecker: Checking 'decode_operand(insn1, 0) = foo - next_pc(insn1)'...
Reading section starting at symbol 'insn1' - SID: 0, Offset: 16, Size: 24
Reading section starting at symbol 'insn1' - SID: 0, Offset: 16, Size: 24
Expression 'decode_operand(insn1, 0) = foo - next_pc(insn1)' is false: 0xffffffffffffffff != 0xffffffffffffffeb
RuntimeDyldChecker: 'decode_operand(insn1, 0) = foo - next_pc(insn1)' FAILED.
RuntimeDyldChecker: Checking 'decode_operand(insn2, 4) = x - next_pc(insn2)'...
Reading section starting at symbol 'insn2' - SID: 0, Offset: 21, Size: 19
Reading section starting at symbol 'insn2' - SID: 0, Offset: 21, Size: 19
Expression 'decode_operand(insn2, 4) = x - next_pc(insn2)' is false: 0x0 != 0xfe5
RuntimeDyldChecker: 'decode_operand(insn2, 4) = x - next_pc(insn2)' FAILED.
RuntimeDyldChecker: Checking '{8}(stub_addr(foo.o, __text, y)) = y'...
RuntimeDyldChecker: '
{8}(stub_addr(foo.o, __text, y)) = y' passed.
RuntimeDyldChecker: Checking 'decode_operand(insn3, 4) = stub_addr(foo.o, __text, y) - next_pc(insn3)'...
Reading section starting at symbol 'insn3' - SID: 0, Offset: 27, Size: 13
Reading section starting at symbol 'insn3' - SID: 0, Offset: 27, Size: 13
Expression 'decode_operand(insn3, 4) = stub_addr(foo.o, __text, y) - next_pc(insn3)' is false: 0x0 != 0x6
RuntimeDyldChecker: 'decode_operand(insn3, 4) = stub_addr(foo.o, __text, y) - next_pc(insn3)' FAILED.
/Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld: error: some checks in '/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s' failed

@lhames
Copy link
Contributor

lhames commented Aug 25, 2014

Oh - something is going very wrong with the addresses that relocations are being applied to:

Resolving relocations Section #​0 0x1000
resolveRelocation Section: 0 LocalAddress: 0xed011 FinalAddress: 0x0 Value: 0x0 Addend:
0 isPCRel: 1 MachoType: 2 Size: 4
Resolving relocations Section #​1 0x2000
resolveRelocation Section: 0 LocalAddress: 0xed017 FinalAddress: 0x0 Value: 0x0 Addend: 0 isPCRel: 1 MachoType: 1 Size: 4
Resolving relocations Section #​2 0x3000
resolveRelocation Section: 0 LocalAddress: 0xed028 FinalAddress: 0x0 Value: 0x0

It looks like all the relocations are being written out to the null pointer. I don't know how that's not just crashing?

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 26, 2014

Here are the same two tests, and their -debug dump (stdout):

% /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=armv7s-apple-ios7.0.0 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/ARM/Output/foo.o
Args: /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=armv7s-apple-ios7.0.0 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/ARM/Output/foo.o
Parse symbols:
emitSection SectionID: 0 Name: __text obj addr: 0x4003570 new addr: 0xed000 DataSize: 24 StubBufSize: 40 Allocate: 64
Offset: 0x0 flags: 0 SID: 0 Type: 4 Name: insn1
Offset: 0x8 flags: 0 SID: 0 Type: 4 Name: nextPC
Offset: 0x4 flags: 0 SID: 0 Type: 4 Name: insn2
Offset: 0xc flags: 0 SID: 0 Type: 4 Name: insn3
Offset: 0x0 flags: 2 SID: 0 Type: 4 Name: bar
Offset: 0x14 flags: 2 SID: 0 Type: 4 Name: foo
Type: 0 Name: baz
emitCommonSection SectionID: 1 new addr: 0xee000 DataSize: 8
Allocating common symbol baz address 0xee000
Parse relocations:
SectionID: 0
resolveRelocation Section: 0 LocalAddress: 0xed00c FinalAddress: 0x0 Value: 0x0 Addend: 0 isPCRel: 1 MachoType: 5 Size: 4
Registering stubs for file 'foo.o', section '__text'
Resolving relocations Section #​0 0x0
----- Contents of section __text before relocations -----
0x00000000: 04 00 00 e3 00 00 40 e3 00 00 8f e0 fb 00 00 01
0x00000000: 1e ff 2f e1 1e ff 2f e1
----- Contents of section __text after relocations -----
0x00000000: 04 00 00 e3 00 00 40 e3 00 00 8f e0 fb 00 00 01
0x00000000: 1e ff 2f e1 1e ff 2f e1
Resolving relocations Section #​1 0x0
----- Contents of section before relocations -----
0x00000000: 00 00 00 00 00 00 00 00
resolveRelocation Section: 0 LocalAddress: 0xed01c FinalAddress: 0x0 Value: 0x0 Addend: -64 isPCRel: 0 MachoType: 0 Size: 4
----- Contents of section after relocations -----
0x00000000: 00 00 00 00 00 00 00 00
RuntimeDyldChecker: Checking 'decode_operand(insn1, 1) = (foo-(nextPC+8))[15:0]'...
Reading section starting at symbol 'insn1' - SID: 0, Offset: 0, Size: 24
0: OPC_ExtractField(25, 3): 1
3: OPC_FilterValue(0, 3020): FAIL: continuing at 3027
3027: OPC_FilterValue(1, 403): PASS: continuing at 3031
3031: OPC_ExtractField(21, 1): 0
3034: OPC_FilterValue(0, 170): PASS: continuing at 3038
3038: OPC_ExtractField(24, 1): 1
3041: OPC_FilterValue(0, 62): FAIL: continuing at 3107
3107: OPC_FilterValue(1, 4551): PASS: continuing at 3111
3111: OPC_ExtractField(22, 2): 0
3114: OPC_FilterValue(0, 32): PASS: continuing at 3118
3118: OPC_ExtractField(20, 1): 0
3121: OPC_FilterValue(0, 8): PASS: continuing at 3125
3125: OPC_CheckPredicate(10): PASS
3129: OPC_Decode: opcode 221, using decoder 49
----- DECODE SUCCESSFUL -----
RuntimeDyldChecker: 'decode_operand(insn1, 1) = (foo-(nextPC+8))[15:0]' passed.
RuntimeDyldChecker: Checking 'decode_operand(insn2, 2) = (foo-(nextPC+8))[31:16]'...
Reading section starting at symbol 'insn2' - SID: 0, Offset: 4, Size: 20
0: OPC_ExtractField(25, 3): 1
3: OPC_FilterValue(0, 3020): FAIL: continuing at 3027
3027: OPC_FilterValue(1, 403): PASS: continuing at 3031
3031: OPC_ExtractField(21, 1): 0
3034: OPC_FilterValue(0, 170): PASS: continuing at 3038
3038: OPC_ExtractField(24, 1): 1
3041: OPC_FilterValue(0, 62): FAIL: continuing at 3107
3107: OPC_FilterValue(1, 4551): PASS: continuing at 3111
3111: OPC_ExtractField(22, 2): 1
3114: OPC_FilterValue(0, 32): FAIL: continuing at 3150
3150: OPC_FilterValue(1, 31): PASS: continuing at 3154
3154: OPC_ExtractField(20, 1): 0
3157: OPC_FilterValue(0, 8): PASS: continuing at 3161
3161: OPC_CheckPredicate(10): PASS
3165: OPC_Decode: opcode 216, using decoder 49
----- DECODE SUCCESSFUL -----
RuntimeDyldChecker: 'decode_operand(insn2, 2) = (foo-(nextPC+8))[31:16]' passed.
RuntimeDyldChecker: Checking '{4}(stub_addr(foo.o, __text, baz)) = 0xe51ff004'...
Error evaluating expression '
{4}(stub_addr(foo.o, __text, baz)) = 0xe51ff004': File 'foo.o' not found. No stubs registered.

RuntimeDyldChecker: '{4}(stub_addr(foo.o, __text, baz)) = 0xe51ff004' FAILED.
RuntimeDyldChecker: Checking '
{4}(stub_addr(foo.o, __text, baz) + 4) = baz'...
Error evaluating expression '*{4}(stub_addr(foo.o, __text, baz) + 4) = baz': File 'foo.o' not found. No stubs registered.

RuntimeDyldChecker: '*{4}(stub_addr(foo.o, __text, baz) + 4) = baz' FAILED.
RuntimeDyldChecker: Checking 'decode_operand(insn3, 0) = stub_addr(foo.o, __text, baz) - (insn3 + 8)'...
Reading section starting at symbol 'insn3' - SID: 0, Offset: 12, Size: 12
0: OPC_ExtractField(25, 3): 0
3: OPC_FilterValue(0, 3020): PASS: continuing at 7
7: OPC_ExtractField(21, 1): 0
10: OPC_FilterValue(0, 1545): PASS: continuing at 14
14: OPC_ExtractField(24, 1): 1
17: OPC_FilterValue(0, 336): FAIL: continuing at 357
357: OPC_FilterValue(1, 7301): PASS: continuing at 361
361: OPC_ExtractField(22, 2): 0
364: OPC_FilterValue(0, 422): PASS: continuing at 368
368: OPC_ExtractField(20, 1): 0
371: OPC_FilterValue(0, 349): PASS: continuing at 375
375: OPC_ExtractField(5, 1): 1
378: OPC_FilterValue(0, 276): FAIL: continuing at 658
658: OPC_FilterValue(1, 801): PASS: continuing at 662
662: OPC_ExtractField(6, 2): 3
665: OPC_FilterValue(1, 19): FAIL: continuing at 688
688: OPC_FilterValue(2, 14): FAIL: continuing at 706
706: OPC_FilterValue(3, 753): PASS: continuing at 710
710: OPC_CheckPredicate(3): PASS
714: OPC_CheckField(4, 1, 0, 743): FieldValue = 1, ExpectedValue = 0: FAIL
1463: OPC_ExtractField(4, 4): 15
1466: OPC_FilterValue(11, 27): FAIL: continuing at 1497
1497: OPC_FilterValue(13, 27): FAIL: continuing at 1528
1528: OPC_FilterValue(15, 6130): PASS: continuing at 1532
1532: OPC_ExtractField(20, 1): 0
1535: OPC_FilterValue(0, 8): PASS: continuing at 1539
1539: OPC_CheckPredicate(3): PASS
1543: OPC_Decode: opcode 426, using decoder 7
----- DECODE SUCCESSFUL -----
Error evaluating expression 'decode_operand(insn3, 0) = stub_addr(foo.o, __text, baz) - (insn3 + 8)': Operand '0' of instruction 'insn3' is not an immediate.
Instruction is:
<MCInst #​426 STRD >
RuntimeDyldChecker: 'decode_operand(insn3, 0) = stub_addr(foo.o, __text, baz) - (insn3 + 8)' FAILED.
/Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld: error: some checks in '/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s' failed


% /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=x86_64-apple-macosx10.9 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/X86/Output/test_x86-64.o
Args: /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=x86_64-apple-macosx10.9 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/X86/Output/test_x86-64.o
Parse symbols:
emitSection SectionID: 0 Name: __text obj addr: 0x40035f0 new addr: 0xed000 DataSize: 40 StubBufSize: 24 Allocate: 64
Offset: 0x10 flags: 0 SID: 0 Type: 4 Name: insn1
Offset: 0x15 flags: 0 SID: 0 Type: 4 Name: insn2
Offset: 0x1b flags: 0 SID: 0 Type: 4 Name: insn3
Offset: 0x0 flags: 2 SID: 0 Type: 4 Name: foo
Offset: 0x10 flags: 2 SID: 0 Type: 4 Name: main
emitSection SectionID: 1 Name: __data obj addr: 0x4003618 new addr: 0xee000 DataSize: 4 StubBufSize: 0 Allocate: 4
Offset: 0x0 flags: 2 SID: 1 Type: 4 Name: x
Type: 0 Name: y
emitCommonSection SectionID: 2 new addr: 0xef000 DataSize: 8
Allocating common symbol y address 0xef000
Parse relocations:
SectionID: 0
resolveRelocation Section: 0 LocalAddress: 0xed01e FinalAddress: 0x0 Value: 0x0 Addend: 0 isPCRel: 1 MachoType: 0 Size: 4
Registering stubs for file 'test_x86-64.o', section '__text'
Symbol 'y' location - SID:0, Offset: 40
Resolving relocations Section #​0 0x0
----- Contents of section __text before relocations -----
0x00000000: c3 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00
0x00000000: e8 00 00 00 00 8b 05 00 00 00 00 48 8b 05 00 00
0x00000000: 00 00 b8 00 00 00 00 c3
resolveRelocation Section: 0 LocalAddress: 0xed011 FinalAddress: 0x0 Value: 0x0 Addend: 0 isPCRel: 1 MachoType: 2 Size: 4
----- Contents of section __text after relocations -----
0x00000000: c3 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00
0x00000000: e8 ff ff ff ff 8b 05 00 00 00 00 48 8b 05 00 00
0x00000000: 00 00 b8 00 00 00 00 c3
Resolving relocations Section #​1 0x0
----- Contents of section __data before relocations -----
0x00000000: 05 00 00 00
resolveRelocation Section: 0 LocalAddress: 0xed017 FinalAddress: 0x0 Value: 0x0 Addend: 0 isPCRel: 1 MachoType: 1 Size: 4
----- Contents of section __data after relocations -----
0x00000000: 05 00 00 00
Resolving relocations Section #​2 0x0
----- Contents of section before relocations -----
0x00000000: 00 00 00 00 00 00 00 00
resolveRelocation Section: 0 LocalAddress: 0xed028 FinalAddress: 0x0 Value: 0x0 Addend: 0 isPCRel: 0 MachoType: 0 Size: 8
----- Contents of section after relocations -----
0x00000000: 00 00 00 00 00 00 00 00
RuntimeDyldChecker: Checking 'decode_operand(insn1, 0) = foo - next_pc(insn1)'...
Reading section starting at symbol 'insn1' - SID: 0, Offset: 16, Size: 24
Reading section starting at symbol 'insn1' - SID: 0, Offset: 16, Size: 24
Expression 'decode_operand(insn1, 0) = foo - next_pc(insn1)' is false: 0xffffffffffffffff != 0xffffffffffffffeb
RuntimeDyldChecker: 'decode_operand(insn1, 0) = foo - next_pc(insn1)' FAILED.
RuntimeDyldChecker: Checking 'decode_operand(insn2, 4) = x - next_pc(insn2)'...
Reading section starting at symbol 'insn2' - SID: 0, Offset: 21, Size: 19
Reading section starting at symbol 'insn2' - SID: 0, Offset: 21, Size: 19
Expression 'decode_operand(insn2, 4) = x - next_pc(insn2)' is false: 0x0 != 0xfe5
RuntimeDyldChecker: 'decode_operand(insn2, 4) = x - next_pc(insn2)' FAILED.
RuntimeDyldChecker: Checking '{8}(stub_addr(test_x86-64.o, __text, y)) = y'...
RuntimeDyldChecker: '
{8}(stub_addr(test_x86-64.o, __text, y)) = y' passed.
RuntimeDyldChecker: Checking 'decode_operand(insn3, 4) = stub_addr(test_x86-64.o, __text, y) - next_pc(insn3)'...
Reading section starting at symbol 'insn3' - SID: 0, Offset: 27, Size: 13
Reading section starting at symbol 'insn3' - SID: 0, Offset: 27, Size: 13
Expression 'decode_operand(insn3, 4) = stub_addr(test_x86-64.o, __text, y) - next_pc(insn3)' is false: 0x0 != 0x6
RuntimeDyldChecker: 'decode_operand(insn3, 4) = stub_addr(test_x86-64.o, __text, y) - next_pc(insn3)' FAILED.
/Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld: error: some checks in '/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s' failed


And I see a new test fail (without -debug):

% /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -triple=i386-apple-macosx10.4 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_i386_DynNoPIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/X86/Output/test_i386.o
Expression 'decode_operand(inst1, 4) = x$non_lazy_ptr - tmp0$pb' is false: 0x0 != 0x1ffb
Expression 'decode_operand(inst2, 0) = bling$stub - next_pc(inst2)' is false: 0xb000000 != 0xfed
/Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld: error: some checks in '/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_i386_DynNoPIC_relocations.s' failed
RTDyld reported an error applying relocations:
Unexpected SECTDIFF relocation addend.

@lhames
Copy link
Contributor

lhames commented Aug 27, 2014

Hi David,

The i386 test case is new - that's why this appears as a new failure.

Looking at the section dumps from last time is a huge help: I can see that the relocations have been applied, they just have the wrong value. I suspect the relocation addend extraction logic - it had not been made endian-aware. I believe I've fixed this in r216567.

Could you see whether this patch improves things?

Thanks for all the support in debugging this one!

  • Lang.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 28, 2014

I cherry picked that, and re-ran with -debug, I don't think it looks any better, addresses are still 0x0.

% /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=armv7s-apple-ios7.0.0 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/ARM/Output/foo.o
Args: /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=armv7s-apple-ios7.0.0 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/ARM/Output/foo.o
Parse symbols:
emitSection SectionID: 0 Name: __text obj addr: 0x4003570 new addr: 0xed000 DataSize: 24 StubBufSize: 40 Allocate: 64
Offset: 0x0 flags: 0 SID: 0 Type: 4 Name: insn1
Offset: 0x8 flags: 0 SID: 0 Type: 4 Name: nextPC
Offset: 0x4 flags: 0 SID: 0 Type: 4 Name: insn2
Offset: 0xc flags: 0 SID: 0 Type: 4 Name: insn3
Offset: 0x0 flags: 2 SID: 0 Type: 4 Name: bar
Offset: 0x14 flags: 2 SID: 0 Type: 4 Name: foo
Type: 0 Name: baz
emitCommonSection SectionID: 1 new addr: 0xee000 DataSize: 8
Allocating common symbol baz address 0xee000
Parse relocations:
SectionID: 0
resolveRelocation Section: 0 LocalAddress: 0xed00c FinalAddress: 0x0 Value: 0x0 Addend: 0 isPCRel: 1 MachoType: 5 Size: 4
Registering stubs for file 'foo.o', section '__text'
Resolving relocations Section #​0 0x0
----- Contents of section __text before relocations -----
0x00000000: 04 00 00 e3 00 00 40 e3 00 00 8f e0 fb 00 00 01
0x00000000: 1e ff 2f e1 1e ff 2f e1
----- Contents of section __text after relocations -----
0x00000000: 04 00 00 e3 00 00 40 e3 00 00 8f e0 fb 00 00 01
0x00000000: 1e ff 2f e1 1e ff 2f e1
Resolving relocations Section #​1 0x0
----- Contents of section before relocations -----
0x00000000: 00 00 00 00 00 00 00 00
resolveRelocation Section: 0 LocalAddress: 0xed01c FinalAddress: 0x0 Value: 0x0 Addend: -64 isPCRel: 0 MachoType: 0 Size: 4
----- Contents of section after relocations -----
0x00000000: 00 00 00 00 00 00 00 00
RuntimeDyldChecker: Checking 'decode_operand(insn1, 1) = (foo-(nextPC+8))[15:0]'...
Reading section starting at symbol 'insn1' - SID: 0, Offset: 0, Size: 24
0: OPC_ExtractField(25, 3): 1
3: OPC_FilterValue(0, 3020): FAIL: continuing at 3027
3027: OPC_FilterValue(1, 403): PASS: continuing at 3031
3031: OPC_ExtractField(21, 1): 0
3034: OPC_FilterValue(0, 170): PASS: continuing at 3038
3038: OPC_ExtractField(24, 1): 1
3041: OPC_FilterValue(0, 62): FAIL: continuing at 3107
3107: OPC_FilterValue(1, 4551): PASS: continuing at 3111
3111: OPC_ExtractField(22, 2): 0
3114: OPC_FilterValue(0, 32): PASS: continuing at 3118
3118: OPC_ExtractField(20, 1): 0
3121: OPC_FilterValue(0, 8): PASS: continuing at 3125
3125: OPC_CheckPredicate(10): PASS
3129: OPC_Decode: opcode 221, using decoder 49
----- DECODE SUCCESSFUL -----
RuntimeDyldChecker: 'decode_operand(insn1, 1) = (foo-(nextPC+8))[15:0]' passed.
RuntimeDyldChecker: Checking 'decode_operand(insn2, 2) = (foo-(nextPC+8))[31:16]'...
Reading section starting at symbol 'insn2' - SID: 0, Offset: 4, Size: 20
0: OPC_ExtractField(25, 3): 1
3: OPC_FilterValue(0, 3020): FAIL: continuing at 3027
3027: OPC_FilterValue(1, 403): PASS: continuing at 3031
3031: OPC_ExtractField(21, 1): 0
3034: OPC_FilterValue(0, 170): PASS: continuing at 3038
3038: OPC_ExtractField(24, 1): 1
3041: OPC_FilterValue(0, 62): FAIL: continuing at 3107
3107: OPC_FilterValue(1, 4551): PASS: continuing at 3111
3111: OPC_ExtractField(22, 2): 1
3114: OPC_FilterValue(0, 32): FAIL: continuing at 3150
3150: OPC_FilterValue(1, 31): PASS: continuing at 3154
3154: OPC_ExtractField(20, 1): 0
3157: OPC_FilterValue(0, 8): PASS: continuing at 3161
3161: OPC_CheckPredicate(10): PASS
3165: OPC_Decode: opcode 216, using decoder 49
----- DECODE SUCCESSFUL -----
RuntimeDyldChecker: 'decode_operand(insn2, 2) = (foo-(nextPC+8))[31:16]' passed.
RuntimeDyldChecker: Checking '{4}(stub_addr(foo.o, __text, baz)) = 0xe51ff004'...
Error evaluating expression '
{4}(stub_addr(foo.o, __text, baz)) = 0xe51ff004': File 'foo.o' not found. No stubs registered.

RuntimeDyldChecker: '{4}(stub_addr(foo.o, __text, baz)) = 0xe51ff004' FAILED.
RuntimeDyldChecker: Checking '
{4}(stub_addr(foo.o, __text, baz) + 4) = baz'...
Error evaluating expression '*{4}(stub_addr(foo.o, __text, baz) + 4) = baz': File 'foo.o' not found. No stubs registered.

RuntimeDyldChecker: '*{4}(stub_addr(foo.o, __text, baz) + 4) = baz' FAILED.
RuntimeDyldChecker: Checking 'decode_operand(insn3, 0) = stub_addr(foo.o, __text, baz) - (insn3 + 8)'...
Reading section starting at symbol 'insn3' - SID: 0, Offset: 12, Size: 12
0: OPC_ExtractField(25, 3): 0
3: OPC_FilterValue(0, 3020): PASS: continuing at 7
7: OPC_ExtractField(21, 1): 0
10: OPC_FilterValue(0, 1545): PASS: continuing at 14
14: OPC_ExtractField(24, 1): 1
17: OPC_FilterValue(0, 336): FAIL: continuing at 357
357: OPC_FilterValue(1, 7301): PASS: continuing at 361
361: OPC_ExtractField(22, 2): 0
364: OPC_FilterValue(0, 422): PASS: continuing at 368
368: OPC_ExtractField(20, 1): 0
371: OPC_FilterValue(0, 349): PASS: continuing at 375
375: OPC_ExtractField(5, 1): 1
378: OPC_FilterValue(0, 276): FAIL: continuing at 658
658: OPC_FilterValue(1, 801): PASS: continuing at 662
662: OPC_ExtractField(6, 2): 3
665: OPC_FilterValue(1, 19): FAIL: continuing at 688
688: OPC_FilterValue(2, 14): FAIL: continuing at 706
706: OPC_FilterValue(3, 753): PASS: continuing at 710
710: OPC_CheckPredicate(3): PASS
714: OPC_CheckField(4, 1, 0, 743): FieldValue = 1, ExpectedValue = 0: FAIL
1463: OPC_ExtractField(4, 4): 15
1466: OPC_FilterValue(11, 27): FAIL: continuing at 1497
1497: OPC_FilterValue(13, 27): FAIL: continuing at 1528
1528: OPC_FilterValue(15, 6130): PASS: continuing at 1532
1532: OPC_ExtractField(20, 1): 0
1535: OPC_FilterValue(0, 8): PASS: continuing at 1539
1539: OPC_CheckPredicate(3): PASS
1543: OPC_Decode: opcode 426, using decoder 7
----- DECODE SUCCESSFUL -----
Error evaluating expression 'decode_operand(insn3, 0) = stub_addr(foo.o, __text, baz) - (insn3 + 8)': Operand '0' of instruction 'insn3' is not an immediate.
Instruction is:
<MCInst #​426 STRD >
RuntimeDyldChecker: 'decode_operand(insn3, 0) = stub_addr(foo.o, __text, baz) - (insn3 + 8)' FAILED.
/Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld: error: some checks in '/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s' failed


% /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=x86_64-apple-macosx10.9 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/X86/Output/test_x86-64.o
Args: /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=x86_64-apple-macosx10.9 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/X86/Output/test_x86-64.o
Parse symbols:
emitSection SectionID: 0 Name: __text obj addr: 0x40035f0 new addr: 0xed000 DataSize: 40 StubBufSize: 24 Allocate: 64
Offset: 0x10 flags: 0 SID: 0 Type: 4 Name: insn1
Offset: 0x15 flags: 0 SID: 0 Type: 4 Name: insn2
Offset: 0x1b flags: 0 SID: 0 Type: 4 Name: insn3
Offset: 0x0 flags: 2 SID: 0 Type: 4 Name: foo
Offset: 0x10 flags: 2 SID: 0 Type: 4 Name: main
emitSection SectionID: 1 Name: __data obj addr: 0x4003618 new addr: 0xee000 DataSize: 4 StubBufSize: 0 Allocate: 4
Offset: 0x0 flags: 2 SID: 1 Type: 4 Name: x
Type: 0 Name: y
emitCommonSection SectionID: 2 new addr: 0xef000 DataSize: 8
Allocating common symbol y address 0xef000
Parse relocations:
SectionID: 0
resolveRelocation Section: 0 LocalAddress: 0xed01e FinalAddress: 0x0 Value: 0x0 Addend: 0 isPCRel: 1 MachoType: 0 Size: 4
Registering stubs for file 'test_x86-64.o', section '__text'
Symbol 'y' location - SID:0, Offset: 40
Resolving relocations Section #​0 0x0
----- Contents of section __text before relocations -----
0x00000000: c3 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00
0x00000000: e8 00 00 00 00 8b 05 00 00 00 00 48 8b 05 00 00
0x00000000: 00 00 b8 00 00 00 00 c3
resolveRelocation Section: 0 LocalAddress: 0xed011 FinalAddress: 0x0 Value: 0x0 Addend: 0 isPCRel: 1 MachoType: 2 Size: 4
----- Contents of section __text after relocations -----
0x00000000: c3 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00
0x00000000: e8 ff ff ff ff 8b 05 00 00 00 00 48 8b 05 00 00
0x00000000: 00 00 b8 00 00 00 00 c3
Resolving relocations Section #​1 0x0
----- Contents of section __data before relocations -----
0x00000000: 05 00 00 00
resolveRelocation Section: 0 LocalAddress: 0xed017 FinalAddress: 0x0 Value: 0x0 Addend: 0 isPCRel: 1 MachoType: 1 Size: 4
----- Contents of section __data after relocations -----
0x00000000: 05 00 00 00
Resolving relocations Section #​2 0x0
----- Contents of section before relocations -----
0x00000000: 00 00 00 00 00 00 00 00
resolveRelocation Section: 0 LocalAddress: 0xed028 FinalAddress: 0x0 Value: 0x0 Addend: 0 isPCRel: 0 MachoType: 0 Size: 8
----- Contents of section after relocations -----
0x00000000: 00 00 00 00 00 00 00 00
RuntimeDyldChecker: Checking 'decode_operand(insn1, 0) = foo - next_pc(insn1)'...
Reading section starting at symbol 'insn1' - SID: 0, Offset: 16, Size: 24
Reading section starting at symbol 'insn1' - SID: 0, Offset: 16, Size: 24
Expression 'decode_operand(insn1, 0) = foo - next_pc(insn1)' is false: 0xffffffffffffffff != 0xffffffffffffffeb
RuntimeDyldChecker: 'decode_operand(insn1, 0) = foo - next_pc(insn1)' FAILED.
RuntimeDyldChecker: Checking 'decode_operand(insn2, 4) = x - next_pc(insn2)'...
Reading section starting at symbol 'insn2' - SID: 0, Offset: 21, Size: 19
Reading section starting at symbol 'insn2' - SID: 0, Offset: 21, Size: 19
Expression 'decode_operand(insn2, 4) = x - next_pc(insn2)' is false: 0x0 != 0xfe5
RuntimeDyldChecker: 'decode_operand(insn2, 4) = x - next_pc(insn2)' FAILED.
RuntimeDyldChecker: Checking '{8}(stub_addr(test_x86-64.o, __text, y)) = y'...
RuntimeDyldChecker: '
{8}(stub_addr(test_x86-64.o, __text, y)) = y' passed.
RuntimeDyldChecker: Checking 'decode_operand(insn3, 4) = stub_addr(test_x86-64.o, __text, y) - next_pc(insn3)'...
Reading section starting at symbol 'insn3' - SID: 0, Offset: 27, Size: 13
Reading section starting at symbol 'insn3' - SID: 0, Offset: 27, Size: 13
Expression 'decode_operand(insn3, 4) = stub_addr(test_x86-64.o, __text, y) - next_pc(insn3)' is false: 0x0 != 0x6
RuntimeDyldChecker: 'decode_operand(insn3, 4) = stub_addr(test_x86-64.o, __text, y) - next_pc(insn3)' FAILED.
/Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld: error: some checks in '/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s' failed


Were there any other related patches besides the one you mentioned? I could always reset and re-merge instead of cherry-pick.

@lhames
Copy link
Contributor

lhames commented Aug 28, 2014

Hi David,

Looks like I was too slack with the format specifiers on some of the debugging output. I've fixed that in r216648.

  • Lang.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Sep 3, 2014

-debug output again for the 3 failing test cases:

% /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=i386-apple-macosx10.4 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_i386_DynNoPIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/X86/Output/test_i386.o
Args: /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=i386-apple-macosx10.4 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_i386_DynNoPIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/X86/Output/test_i386.o
Parse symbols:
emitSection SectionID: 0 Name: __text obj addr: 0x400364c new addr: 0x83000 DataSize: 30 StubBufSize: 0 Allocate: 30
Offset: 0x5 flags: 0 SID: 0 Type: 4 Name: tmp0$pb
Offset: 0x6 flags: 0 SID: 0 Type: 4 Name: inst1
emitSection SectionID: 1 Name: __pointers obj addr: 0x400366f new addr: 0x7fd000 DataSize: 4 StubBufSize: 0 Allocate: 4
Offset: 0x0 flags: 0 SID: 1 Type: 4 Name: x$non_lazy_ptr
Offset: 0xe flags: 0 SID: 0 Type: 4 Name: inst2
emitSection SectionID: 2 Name: __jump_table obj addr: 0x400366a new addr: 0x7fe000 DataSize: 5 StubBufSize: 0 Allocate: 5
Offset: 0x0 flags: 0 SID: 2 Type: 4 Name: bling$stub
Offset: 0x15 flags: 0 SID: 0 Type: 4 Name: inst3
Offset: 0x0 flags: 2 SID: 0 Type: 4 Name: bar
emitSection SectionID: 3 Name: __common obj addr: 0x4003480 new addr: 0x7ff000 DataSize: 8 StubBufSize: 0 Allocate: 8
Offset: 0x0 flags: 2 SID: 3 Type: 4 Name: y
Type: 0 Name: bling
Type: 0 Name: x
emitCommonSection SectionID: 4 new addr: 0x3e96000 DataSize: 16
Allocating common symbol bling address 0x3e96000
Allocating common symbol x address 0x3e96004
Parse relocations:
SectionID: 0
Found SECTDIFF: AddrA: 35, AddrB: 5, Addend: 2161727821137838080, SectionA ID: 1, SectionAOffset: 0, SectionB ID: 0, SectionBOffset: 5
Registering stubs for file 'test_i386.o', section '__text'
Populating __pointers, Section ID 1, 1 entries, 4 bytes each:
x: index 9, PT offset: 0
Resolving relocations Section #​0 0x0
----- Contents of section __text before relocations -----
0x0000000000001000: e8 00 00 00 00 58 8b 80 1e 00 00 00 8b 18 e8 0b
0x0000000000001010: 00 00 00 01 d8 8b 0d 2c 00 00 00 01 c8 c3
resolveRelocation Section: 0 LocalAddress: 0x83008 FinalAddress: 0x0000000000001008 Value: 0x0000000000001000 Addend: -5 isPCRel: 0 MachoType: 4 Size: 4
resolveRelocation Section: 0 LocalAddress: 0x83001 FinalAddress: 0x0000000000001001 Value: 0x0000000000001000 Addend: 5 isPCRel: 1 MachoType: 0 Size: 4
----- Contents of section __text after relocations -----
0x0000000000001000: e8 00 00 00 00 58 8b 80 00 00 00 00 8b 18 e8 0b
0x0000000000001010: 00 00 00 01 d8 8b 0d 2c 00 00 00 01 c8 c3
Resolving relocations Section #​1 0x0
----- Contents of section __pointers before relocations -----
0x0000000000003000: 00 00 00 00
resolveRelocation Section: 0 LocalAddress: 0x83008 FinalAddress: 0x0000000000001008 Value: 0x0000000000003000 Addend: -5 isPCRel: 0 MachoType: 4 Size: 4
----- Contents of section __pointers after relocations -----
0x0000000000003000: 00 00 00 00
Resolving relocations Section #​2 0x0
----- Contents of section __jump_table before relocations -----
0x0000000000002000: e9 f4 f4 f4 f4
resolveRelocation Section: 0 LocalAddress: 0x8300f FinalAddress: 0x000000000000100f Value: 0x0000000000002000 Addend: 47244640245 isPCRel: 1 MachoType: 0 Size: 4
----- Contents of section __jump_table after relocations -----
0x0000000000002000: e9 f4 f4 f4 f4
Resolving relocations Section #​3 0x0
----- Contents of section __common before relocations -----
0x0000000000004000: 00 00 00 00 00 00 00 00
resolveRelocation Section: 0 LocalAddress: 0x83017 FinalAddress: 0x0000000000001017 Value: 0x0000000000004000 Addend: 3170534137668829144 isPCRel: 0 MachoType: 0 Size: 4
----- Contents of section __common after relocations -----
0x0000000000004000: 00 00 00 00 00 00 00 00
Resolving relocations Section #​4 0x0
----- Contents of section before relocations -----
0x0000000000005000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
resolveRelocation Section: 2 LocalAddress: 0x7fe001 FinalAddress: 0x0000000000002001 Value: 0x0000000000005000 Addend: 0 isPCRel: 1 MachoType: 0 Size: 4
resolveRelocation Section: 1 LocalAddress: 0x7fd000 FinalAddress: 0x0000000000003000 Value: 0x0000000000005000 Addend: 4 isPCRel: 0 MachoType: 0 Size: 4
----- Contents of section after relocations -----
0x0000000000005000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
RuntimeDyldChecker: Checking 'decode_operand(inst1, 4) = x$non_lazy_ptr - tmp0$pb'...
Reading section starting at symbol 'inst1' - SID: 0, Offset: 6, Size: 24
Expression 'decode_operand(inst1, 4) = x$non_lazy_ptr - tmp0$pb' is false: 0x0 != 0x1ffb
RuntimeDyldChecker: 'decode_operand(inst1, 4) = x$non_lazy_ptr - tmp0$pb' FAILED.
RuntimeDyldChecker: Checking 'decode_operand(inst2, 0) = bling$stub - next_pc(inst2)'...
Reading section starting at symbol 'inst2' - SID: 0, Offset: 14, Size: 16
Reading section starting at symbol 'inst2' - SID: 0, Offset: 14, Size: 16
Expression 'decode_operand(inst2, 0) = bling$stub - next_pc(inst2)' is false: 0xb != 0xfed
RuntimeDyldChecker: 'decode_operand(inst2, 0) = bling$stub - next_pc(inst2)' FAILED.
/Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld: error: some checks in '/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_i386_DynNoPIC_relocations.s' failed
RTDyld reported an error applying relocations:
Unexpected SECTDIFF relocation addend.


% /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=armv7s-apple-ios7.0.0 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/ARM/Output/foo.o
Args: /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=armv7s-apple-ios7.0.0 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/ARM/Output/foo.o
Parse symbols:
emitSection SectionID: 0 Name: __text obj addr: 0x4003570 new addr: 0x83000 DataSize: 24 StubBufSize: 40 Allocate: 64
Offset: 0x0 flags: 0 SID: 0 Type: 4 Name: insn1
Offset: 0x8 flags: 0 SID: 0 Type: 4 Name: nextPC
Offset: 0x4 flags: 0 SID: 0 Type: 4 Name: insn2
Offset: 0xc flags: 0 SID: 0 Type: 4 Name: insn3
Offset: 0x0 flags: 2 SID: 0 Type: 4 Name: bar
Offset: 0x14 flags: 2 SID: 0 Type: 4 Name: foo
Type: 0 Name: baz
emitCommonSection SectionID: 1 new addr: 0x7fd000 DataSize: 8
Allocating common symbol baz address 0x7fd000
Parse relocations:
SectionID: 0
resolveRelocation Section: 0 LocalAddress: 0x8300c FinalAddress: 0x000000000008300c Value: 0x0000000000083018 Addend: 0 isPCRel: 1 MachoType: 5 Size: 4
Registering stubs for file 'foo.o', section '__text'
Resolving relocations Section #​0 0x0
----- Contents of section __text before relocations -----
0x0000000000001000: 04 00 00 e3 00 00 40 e3 00 00 8f e0 fb 00 00 01
0x0000000000001010: 1e ff 2f e1 1e ff 2f e1
----- Contents of section __text after relocations -----
0x0000000000001000: 04 00 00 e3 00 00 40 e3 00 00 8f e0 fb 00 00 01
0x0000000000001010: 1e ff 2f e1 1e ff 2f e1
Resolving relocations Section #​1 0x0
----- Contents of section before relocations -----
0x0000000000002000: 00 00 00 00 00 00 00 00
resolveRelocation Section: 0 LocalAddress: 0x8301c FinalAddress: 0x000000000000101c Value: 0x0000000000002000 Addend: -64 isPCRel: 0 MachoType: 0 Size: 4
----- Contents of section after relocations -----
0x0000000000002000: 00 00 00 00 00 00 00 00
RuntimeDyldChecker: Checking 'decode_operand(insn1, 1) = (foo-(nextPC+8))[15:0]'...
Reading section starting at symbol 'insn1' - SID: 0, Offset: 0, Size: 24
0: OPC_ExtractField(25, 3): 1
3: OPC_FilterValue(0, 3020): FAIL: continuing at 3027
3027: OPC_FilterValue(1, 403): PASS: continuing at 3031
3031: OPC_ExtractField(21, 1): 0
3034: OPC_FilterValue(0, 170): PASS: continuing at 3038
3038: OPC_ExtractField(24, 1): 1
3041: OPC_FilterValue(0, 62): FAIL: continuing at 3107
3107: OPC_FilterValue(1, 4551): PASS: continuing at 3111
3111: OPC_ExtractField(22, 2): 0
3114: OPC_FilterValue(0, 32): PASS: continuing at 3118
3118: OPC_ExtractField(20, 1): 0
3121: OPC_FilterValue(0, 8): PASS: continuing at 3125
3125: OPC_CheckPredicate(10): PASS
3129: OPC_Decode: opcode 221, using decoder 49
----- DECODE SUCCESSFUL -----
RuntimeDyldChecker: 'decode_operand(insn1, 1) = (foo-(nextPC+8))[15:0]' passed.
RuntimeDyldChecker: Checking 'decode_operand(insn2, 2) = (foo-(nextPC+8))[31:16]'...
Reading section starting at symbol 'insn2' - SID: 0, Offset: 4, Size: 20
0: OPC_ExtractField(25, 3): 1
3: OPC_FilterValue(0, 3020): FAIL: continuing at 3027
3027: OPC_FilterValue(1, 403): PASS: continuing at 3031
3031: OPC_ExtractField(21, 1): 0
3034: OPC_FilterValue(0, 170): PASS: continuing at 3038
3038: OPC_ExtractField(24, 1): 1
3041: OPC_FilterValue(0, 62): FAIL: continuing at 3107
3107: OPC_FilterValue(1, 4551): PASS: continuing at 3111
3111: OPC_ExtractField(22, 2): 1
3114: OPC_FilterValue(0, 32): FAIL: continuing at 3150
3150: OPC_FilterValue(1, 31): PASS: continuing at 3154
3154: OPC_ExtractField(20, 1): 0
3157: OPC_FilterValue(0, 8): PASS: continuing at 3161
3161: OPC_CheckPredicate(10): PASS
3165: OPC_Decode: opcode 216, using decoder 49
----- DECODE SUCCESSFUL -----
RuntimeDyldChecker: 'decode_operand(insn2, 2) = (foo-(nextPC+8))[31:16]' passed.
RuntimeDyldChecker: Checking '{4}(stub_addr(foo.o, __text, baz)) = 0xe51ff004'...
Error evaluating expression '
{4}(stub_addr(foo.o, __text, baz)) = 0xe51ff004': File 'foo.o' not found. No stubs registered.

RuntimeDyldChecker: '{4}(stub_addr(foo.o, __text, baz)) = 0xe51ff004' FAILED.
RuntimeDyldChecker: Checking '
{4}(stub_addr(foo.o, __text, baz) + 4) = baz'...
Error evaluating expression '*{4}(stub_addr(foo.o, __text, baz) + 4) = baz': File 'foo.o' not found. No stubs registered.

RuntimeDyldChecker: '*{4}(stub_addr(foo.o, __text, baz) + 4) = baz' FAILED.
RuntimeDyldChecker: Checking 'decode_operand(insn3, 0) = stub_addr(foo.o, __text, baz) - (insn3 + 8)'...
Reading section starting at symbol 'insn3' - SID: 0, Offset: 12, Size: 12
0: OPC_ExtractField(25, 3): 0
3: OPC_FilterValue(0, 3020): PASS: continuing at 7
7: OPC_ExtractField(21, 1): 0
10: OPC_FilterValue(0, 1545): PASS: continuing at 14
14: OPC_ExtractField(24, 1): 1
17: OPC_FilterValue(0, 336): FAIL: continuing at 357
357: OPC_FilterValue(1, 7301): PASS: continuing at 361
361: OPC_ExtractField(22, 2): 0
364: OPC_FilterValue(0, 422): PASS: continuing at 368
368: OPC_ExtractField(20, 1): 0
371: OPC_FilterValue(0, 349): PASS: continuing at 375
375: OPC_ExtractField(5, 1): 1
378: OPC_FilterValue(0, 276): FAIL: continuing at 658
658: OPC_FilterValue(1, 801): PASS: continuing at 662
662: OPC_ExtractField(6, 2): 3
665: OPC_FilterValue(1, 19): FAIL: continuing at 688
688: OPC_FilterValue(2, 14): FAIL: continuing at 706
706: OPC_FilterValue(3, 753): PASS: continuing at 710
710: OPC_CheckPredicate(3): PASS
714: OPC_CheckField(4, 1, 0, 743): FieldValue = 1, ExpectedValue = 0: FAIL
1463: OPC_ExtractField(4, 4): 15
1466: OPC_FilterValue(11, 27): FAIL: continuing at 1497
1497: OPC_FilterValue(13, 27): FAIL: continuing at 1528
1528: OPC_FilterValue(15, 6130): PASS: continuing at 1532
1532: OPC_ExtractField(20, 1): 0
1535: OPC_FilterValue(0, 8): PASS: continuing at 1539
1539: OPC_CheckPredicate(3): PASS
1543: OPC_Decode: opcode 426, using decoder 7
----- DECODE SUCCESSFUL -----
Error evaluating expression 'decode_operand(insn3, 0) = stub_addr(foo.o, __text, baz) - (insn3 + 8)': Operand '0' of instruction 'insn3' is not an immediate.
Instruction is:
<MCInst #​426 STRD >
RuntimeDyldChecker: 'decode_operand(insn3, 0) = stub_addr(foo.o, __text, baz) - (insn3 + 8)' FAILED.
/Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld: error: some checks in '/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s' failed


% /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=x86_64-apple-macosx10.9 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/X86/Output/test_x86-64.o
Args: /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=x86_64-apple-macosx10.9 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/X86/Output/test_x86-64.o
Parse symbols:
emitSection SectionID: 0 Name: __text obj addr: 0x40035f0 new addr: 0x83000 DataSize: 40 StubBufSize: 24 Allocate: 64
Offset: 0x10 flags: 0 SID: 0 Type: 4 Name: insn1
Offset: 0x15 flags: 0 SID: 0 Type: 4 Name: insn2
Offset: 0x1b flags: 0 SID: 0 Type: 4 Name: insn3
Offset: 0x0 flags: 2 SID: 0 Type: 4 Name: foo
Offset: 0x10 flags: 2 SID: 0 Type: 4 Name: main
emitSection SectionID: 1 Name: __data obj addr: 0x4003618 new addr: 0x7fd000 DataSize: 4 StubBufSize: 0 Allocate: 4
Offset: 0x0 flags: 2 SID: 1 Type: 4 Name: x
Type: 0 Name: y
emitCommonSection SectionID: 2 new addr: 0x7fe000 DataSize: 8
Allocating common symbol y address 0x7fe000
Parse relocations:
SectionID: 0
resolveRelocation Section: 0 LocalAddress: 0x8301e FinalAddress: 0x000000000008301e Value: 0x0000000000083028 Addend: 0 isPCRel: 1 MachoType: 0 Size: 4
Registering stubs for file 'test_x86-64.o', section '__text'
Symbol 'y' location - SID:0, Offset: 40
Resolving relocations Section #​0 0x0
----- Contents of section __text before relocations -----
0x0000000000001000: c3 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00
0x0000000000001010: e8 00 00 00 00 8b 05 00 00 00 00 48 8b 05 00 00
0x0000000000001020: 00 00 b8 00 00 00 00 c3
resolveRelocation Section: 0 LocalAddress: 0x83011 FinalAddress: 0x0000000000001011 Value: 0x0000000000001000 Addend: 0 isPCRel: 1 MachoType: 2 Size: 4
----- Contents of section __text after relocations -----
0x0000000000001000: c3 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00
0x0000000000001010: e8 ff ff ff ff 8b 05 00 00 00 00 48 8b 05 00 00
0x0000000000001020: 00 00 b8 00 00 00 00 c3
Resolving relocations Section #​1 0x0
----- Contents of section __data before relocations -----
0x0000000000002000: 05 00 00 00
resolveRelocation Section: 0 LocalAddress: 0x83017 FinalAddress: 0x0000000000001017 Value: 0x0000000000002000 Addend: 0 isPCRel: 1 MachoType: 1 Size: 4
----- Contents of section __data after relocations -----
0x0000000000002000: 05 00 00 00
Resolving relocations Section #​2 0x0
----- Contents of section before relocations -----
0x0000000000003000: 00 00 00 00 00 00 00 00
resolveRelocation Section: 0 LocalAddress: 0x83028 FinalAddress: 0x0000000000001028 Value: 0x0000000000003000 Addend: 0 isPCRel: 0 MachoType: 0 Size: 8
----- Contents of section after relocations -----
0x0000000000003000: 00 00 00 00 00 00 00 00
RuntimeDyldChecker: Checking 'decode_operand(insn1, 0) = foo - next_pc(insn1)'...
Reading section starting at symbol 'insn1' - SID: 0, Offset: 16, Size: 24
Reading section starting at symbol 'insn1' - SID: 0, Offset: 16, Size: 24
Expression 'decode_operand(insn1, 0) = foo - next_pc(insn1)' is false: 0xffffffffffffffff != 0xffffffffffffffeb
RuntimeDyldChecker: 'decode_operand(insn1, 0) = foo - next_pc(insn1)' FAILED.
RuntimeDyldChecker: Checking 'decode_operand(insn2, 4) = x - next_pc(insn2)'...
Reading section starting at symbol 'insn2' - SID: 0, Offset: 21, Size: 19
Reading section starting at symbol 'insn2' - SID: 0, Offset: 21, Size: 19
Expression 'decode_operand(insn2, 4) = x - next_pc(insn2)' is false: 0x0 != 0xfe5
RuntimeDyldChecker: 'decode_operand(insn2, 4) = x - next_pc(insn2)' FAILED.
RuntimeDyldChecker: Checking '{8}(stub_addr(test_x86-64.o, __text, y)) = y'...
RuntimeDyldChecker: '
{8}(stub_addr(test_x86-64.o, __text, y)) = y' passed.
RuntimeDyldChecker: Checking 'decode_operand(insn3, 4) = stub_addr(test_x86-64.o, __text, y) - next_pc(insn3)'...
Reading section starting at symbol 'insn3' - SID: 0, Offset: 27, Size: 13
Reading section starting at symbol 'insn3' - SID: 0, Offset: 27, Size: 13
Expression 'decode_operand(insn3, 4) = stub_addr(test_x86-64.o, __text, y) - next_pc(insn3)' is false: 0x0 != 0x6
RuntimeDyldChecker: 'decode_operand(insn3, 4) = stub_addr(test_x86-64.o, __text, y) - next_pc(insn3)' FAILED.
/Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld: error: some checks in '/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s' failed

@lhames
Copy link
Contributor

lhames commented Sep 7, 2014

I've just looked at the x86 case. The latest debugging output is a huge help there: The checking infrastructure all looks good, but the relocation value is being applied incorrectly. I tracked that to a bug in RuntimeDyldImpl::writeBytesUnaligned, which I've fixed in r217325.

David - could you let me know if that helps?

@llvmbot
Copy link
Collaborator Author

llvmbot commented Sep 10, 2014

New -debug dumps:

% /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=i386-apple-macosx10.4 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_i386_DynNoPIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/X86/Output/test_i386.o
Args: /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=i386-apple-macosx10.4 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_i386_DynNoPIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/X86/Output/test_i386.o
Parse symbols:
emitSection SectionID: 0 Name: __text obj addr: 0x400364c new addr: 0xff000 DataSize: 30 StubBufSize: 0 Allocate: 30
Offset: 0x5 flags: 0 SID: 0 Type: 4 Name: tmp0$pb
Offset: 0x6 flags: 0 SID: 0 Type: 4 Name: inst1
emitSection SectionID: 1 Name: __pointers obj addr: 0x400366f new addr: 0x287000 DataSize: 4 StubBufSize: 0 Allocate: 4
Offset: 0x0 flags: 0 SID: 1 Type: 4 Name: x$non_lazy_ptr
Offset: 0xe flags: 0 SID: 0 Type: 4 Name: inst2
emitSection SectionID: 2 Name: __jump_table obj addr: 0x400366a new addr: 0x7f8000 DataSize: 5 StubBufSize: 0 Allocate: 5
Offset: 0x0 flags: 0 SID: 2 Type: 4 Name: bling$stub
Offset: 0x15 flags: 0 SID: 0 Type: 4 Name: inst3
Offset: 0x0 flags: 2 SID: 0 Type: 4 Name: bar
emitSection SectionID: 3 Name: __common obj addr: 0x4003480 new addr: 0x7f9000 DataSize: 8 StubBufSize: 0 Allocate: 8
Offset: 0x0 flags: 2 SID: 3 Type: 4 Name: y
Type: 0 Name: bling
Type: 0 Name: x
emitCommonSection SectionID: 4 new addr: 0x7fa000 DataSize: 16
Allocating common symbol bling address 0x7fa000
Allocating common symbol x address 0x7fa004
Parse relocations:
SectionID: 0
Found SECTDIFF: AddrA: 35, AddrB: 5, Addend: 2161727821137838080, SectionA ID: 1, SectionAOffset: 0, SectionB ID: 0, SectionBOffset: 5
Registering stubs for file 'test_i386.o', section '__text'
SectionID: 2
Registering stubs for file 'test_i386.o', section '__jump_table'
SectionID: 1
Registering stubs for file 'test_i386.o', section '__pointers'
SectionID: 3
Registering stubs for file 'test_i386.o', section '__common'
Populating __pointers, Section ID 1, 1 entries, 4 bytes each:
x: index 9, PT offset: 0
Reassigning address for section 0 (__text): 0x0000000000000000 -> 0x0000000000000000
Reassigning address for section 2 (__jump_table): 0x0000000000000000 -> 0x0000000000000000
Reassigning address for section 1 (__pointers): 0x0000000000000000 -> 0x0000000000000000
Reassigning address for section 3 (__common): 0x0000000000000000 -> 0x0000000000000000
Reassigning address for section 4 (): 0x0000000000000000 -> 0x0000000000000000
Resolving relocations Section #​0 0x0
----- Contents of section __text before relocations -----
0x0000000000001000: e8 00 00 00 00 58 8b 80 1e 00 00 00 8b 18 e8 0b
0x0000000000001010: 00 00 00 01 d8 8b 0d 2c 00 00 00 01 c8 c3
resolveRelocation Section: 0 LocalAddress: 0xff008 FinalAddress: 0x0000000000001008 Value: 0x0000000000001000 Addend: -5 isPCRel: 0 MachoType: 4 Size: 4
resolveRelocation Section: 0 LocalAddress: 0xff001 FinalAddress: 0x0000000000001001 Value: 0x0000000000001000 Addend: 5 isPCRel: 1 MachoType: 0 Size: 4
----- Contents of section __text after relocations -----
0x0000000000001000: e8 00 00 00 00 58 8b 80 fb 1f 00 00 8b 18 e8 0b
0x0000000000001010: 00 00 00 01 d8 8b 0d 2c 00 00 00 01 c8 c3
Resolving relocations Section #​1 0x0
----- Contents of section __pointers before relocations -----
0x0000000000003000: 00 00 00 00
resolveRelocation Section: 0 LocalAddress: 0xff008 FinalAddress: 0x0000000000001008 Value: 0x0000000000003000 Addend: -5 isPCRel: 0 MachoType: 4 Size: 4
----- Contents of section __pointers after relocations -----
0x0000000000003000: 00 00 00 00
Resolving relocations Section #​2 0x0
----- Contents of section __jump_table before relocations -----
0x0000000000002000: e9 f4 f4 f4 f4
resolveRelocation Section: 0 LocalAddress: 0xff00f FinalAddress: 0x000000000000100f Value: 0x0000000000002000 Addend: 0 isPCRel: 1 MachoType: 0 Size: 4
----- Contents of section __jump_table after relocations -----
0x0000000000002000: e9 f4 f4 f4 f4
Resolving relocations Section #​3 0x0
----- Contents of section __common before relocations -----
0x0000000000004000: 00 00 00 00 00 00 00 00
resolveRelocation Section: 0 LocalAddress: 0xff017 FinalAddress: 0x0000000000001017 Value: 0x0000000000004000 Addend: 3170534137668829144 isPCRel: 0 MachoType: 0 Size: 4
----- Contents of section __common after relocations -----
0x0000000000004000: 00 00 00 00 00 00 00 00
Resolving relocations Section #​4 0x0
----- Contents of section before relocations -----
0x0000000000005000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
resolveRelocation Section: 2 LocalAddress: 0x7f8001 FinalAddress: 0x0000000000002001 Value: 0x0000000000005000 Addend: 0 isPCRel: 1 MachoType: 0 Size: 4
resolveRelocation Section: 1 LocalAddress: 0x287000 FinalAddress: 0x0000000000003000 Value: 0x0000000000005000 Addend: 4 isPCRel: 0 MachoType: 0 Size: 4
----- Contents of section after relocations -----
0x0000000000005000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
RuntimeDyldChecker: Checking 'decode_operand(inst1, 4) = x$non_lazy_ptr - tmp0$pb'...
Reading section starting at symbol 'inst1' - SID: 0, Offset: 6, Size: 24
RuntimeDyldChecker: 'decode_operand(inst1, 4) = x$non_lazy_ptr - tmp0$pb' passed.
RuntimeDyldChecker: Checking 'decode_operand(inst2, 0) = bling$stub - next_pc(inst2)'...
Reading section starting at symbol 'inst2' - SID: 0, Offset: 14, Size: 16
Reading section starting at symbol 'inst2' - SID: 0, Offset: 14, Size: 16
RuntimeDyldChecker: 'decode_operand(inst2, 0) = bling$stub - next_pc(inst2)' passed.
RTDyld reported an error applying relocations:
Unexpected SECTDIFF relocation addend.


% /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=armv7s-apple-ios7.0.0 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/ARM/Output/foo.o
Args: /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=armv7s-apple-ios7.0.0 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/ARM/Output/foo.o
Parse symbols:
emitSection SectionID: 0 Name: __text obj addr: 0x4003570 new addr: 0xff000 DataSize: 24 StubBufSize: 40 Allocate: 64
Offset: 0x0 flags: 0 SID: 0 Type: 4 Name: insn1
Offset: 0x8 flags: 0 SID: 0 Type: 4 Name: nextPC
Offset: 0x4 flags: 0 SID: 0 Type: 4 Name: insn2
Offset: 0xc flags: 0 SID: 0 Type: 4 Name: insn3
Offset: 0x0 flags: 2 SID: 0 Type: 4 Name: bar
Offset: 0x14 flags: 2 SID: 0 Type: 4 Name: foo
Type: 0 Name: baz
emitCommonSection SectionID: 1 new addr: 0x287000 DataSize: 8
Allocating common symbol baz address 0x287000
Parse relocations:
SectionID: 0
resolveRelocation Section: 0 LocalAddress: 0xff00c FinalAddress: 0x00000000000ff00c Value: 0x00000000000ff018 Addend: 0 isPCRel: 1 MachoType: 5 Size: 4
Registering stubs for file 'foo.o', section '__text'
Reassigning address for section 0 (__text): 0x0000000000000000 -> 0x0000000000000000
Reassigning address for section 1 (): 0x0000000000000000 -> 0x0000000000000000
Resolving relocations Section #​0 0x0
----- Contents of section __text before relocations -----
0x0000000000001000: 04 00 00 e3 00 00 40 e3 00 00 8f e0 fb 00 00 01
0x0000000000001010: 1e ff 2f e1 1e ff 2f e1
----- Contents of section __text after relocations -----
0x0000000000001000: 04 00 00 e3 00 00 40 e3 00 00 8f e0 fb 00 00 01
0x0000000000001010: 1e ff 2f e1 1e ff 2f e1
Resolving relocations Section #​1 0x0
----- Contents of section before relocations -----
0x0000000000002000: 00 00 00 00 00 00 00 00
resolveRelocation Section: 0 LocalAddress: 0xff01c FinalAddress: 0x000000000000101c Value: 0x0000000000002000 Addend: -64 isPCRel: 0 MachoType: 0 Size: 4
----- Contents of section after relocations -----
0x0000000000002000: 00 00 00 00 00 00 00 00
RuntimeDyldChecker: Checking 'decode_operand(insn1, 1) = (foo-(nextPC+8))[15:0]'...
Reading section starting at symbol 'insn1' - SID: 0, Offset: 0, Size: 24
0: OPC_ExtractField(25, 3): 1
3: OPC_FilterValue(0, 3020): FAIL: continuing at 3027
3027: OPC_FilterValue(1, 403): PASS: continuing at 3031
3031: OPC_ExtractField(21, 1): 0
3034: OPC_FilterValue(0, 170): PASS: continuing at 3038
3038: OPC_ExtractField(24, 1): 1
3041: OPC_FilterValue(0, 62): FAIL: continuing at 3107
3107: OPC_FilterValue(1, 4551): PASS: continuing at 3111
3111: OPC_ExtractField(22, 2): 0
3114: OPC_FilterValue(0, 32): PASS: continuing at 3118
3118: OPC_ExtractField(20, 1): 0
3121: OPC_FilterValue(0, 8): PASS: continuing at 3125
3125: OPC_CheckPredicate(10): PASS
3129: OPC_Decode: opcode 221, using decoder 49
----- DECODE SUCCESSFUL -----
RuntimeDyldChecker: 'decode_operand(insn1, 1) = (foo-(nextPC+8))[15:0]' passed.
RuntimeDyldChecker: Checking 'decode_operand(insn2, 2) = (foo-(nextPC+8))[31:16]'...
Reading section starting at symbol 'insn2' - SID: 0, Offset: 4, Size: 20
0: OPC_ExtractField(25, 3): 1
3: OPC_FilterValue(0, 3020): FAIL: continuing at 3027
3027: OPC_FilterValue(1, 403): PASS: continuing at 3031
3031: OPC_ExtractField(21, 1): 0
3034: OPC_FilterValue(0, 170): PASS: continuing at 3038
3038: OPC_ExtractField(24, 1): 1
3041: OPC_FilterValue(0, 62): FAIL: continuing at 3107
3107: OPC_FilterValue(1, 4551): PASS: continuing at 3111
3111: OPC_ExtractField(22, 2): 1
3114: OPC_FilterValue(0, 32): FAIL: continuing at 3150
3150: OPC_FilterValue(1, 31): PASS: continuing at 3154
3154: OPC_ExtractField(20, 1): 0
3157: OPC_FilterValue(0, 8): PASS: continuing at 3161
3161: OPC_CheckPredicate(10): PASS
3165: OPC_Decode: opcode 216, using decoder 49
----- DECODE SUCCESSFUL -----
RuntimeDyldChecker: 'decode_operand(insn2, 2) = (foo-(nextPC+8))[31:16]' passed.
RuntimeDyldChecker: Checking '{4}(stub_addr(foo.o, __text, baz)) = 0xe51ff004'...
Error evaluating expression '
{4}(stub_addr(foo.o, __text, baz)) = 0xe51ff004': Symbol 'baz' not found.

RuntimeDyldChecker: '{4}(stub_addr(foo.o, __text, baz)) = 0xe51ff004' FAILED.
RuntimeDyldChecker: Checking '
{4}(stub_addr(foo.o, __text, baz) + 4) = baz'...
Error evaluating expression '*{4}(stub_addr(foo.o, __text, baz) + 4) = baz': Symbol 'baz' not found.

RuntimeDyldChecker: '*{4}(stub_addr(foo.o, __text, baz) + 4) = baz' FAILED.
RuntimeDyldChecker: Checking 'decode_operand(insn3, 0) = stub_addr(foo.o, __text, baz) - (insn3 + 8)'...
Reading section starting at symbol 'insn3' - SID: 0, Offset: 12, Size: 12
0: OPC_ExtractField(25, 3): 0
3: OPC_FilterValue(0, 3020): PASS: continuing at 7
7: OPC_ExtractField(21, 1): 0
10: OPC_FilterValue(0, 1545): PASS: continuing at 14
14: OPC_ExtractField(24, 1): 1
17: OPC_FilterValue(0, 336): FAIL: continuing at 357
357: OPC_FilterValue(1, 7301): PASS: continuing at 361
361: OPC_ExtractField(22, 2): 0
364: OPC_FilterValue(0, 422): PASS: continuing at 368
368: OPC_ExtractField(20, 1): 0
371: OPC_FilterValue(0, 349): PASS: continuing at 375
375: OPC_ExtractField(5, 1): 1
378: OPC_FilterValue(0, 276): FAIL: continuing at 658
658: OPC_FilterValue(1, 801): PASS: continuing at 662
662: OPC_ExtractField(6, 2): 3
665: OPC_FilterValue(1, 19): FAIL: continuing at 688
688: OPC_FilterValue(2, 14): FAIL: continuing at 706
706: OPC_FilterValue(3, 753): PASS: continuing at 710
710: OPC_CheckPredicate(3): PASS
714: OPC_CheckField(4, 1, 0, 743): FieldValue = 1, ExpectedValue = 0: FAIL
1463: OPC_ExtractField(4, 4): 15
1466: OPC_FilterValue(11, 27): FAIL: continuing at 1497
1497: OPC_FilterValue(13, 27): FAIL: continuing at 1528
1528: OPC_FilterValue(15, 6130): PASS: continuing at 1532
1532: OPC_ExtractField(20, 1): 0
1535: OPC_FilterValue(0, 8): PASS: continuing at 1539
1539: OPC_CheckPredicate(3): PASS
1543: OPC_Decode: opcode 426, using decoder 7
----- DECODE SUCCESSFUL -----
Error evaluating expression 'decode_operand(insn3, 0) = stub_addr(foo.o, __text, baz) - (insn3 + 8)': Operand '0' of instruction 'insn3' is not an immediate.
Instruction is:
<MCInst #​426 STRD >
RuntimeDyldChecker: 'decode_operand(insn3, 0) = stub_addr(foo.o, __text, baz) - (insn3 + 8)' FAILED.
/Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld: error: some checks in '/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s' failed


% /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -triple=i386-apple-macosx10.4 -verify -map-section MachO_i386_eh_frame.o,__text=0x2000 -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_i386_eh_frame.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/X86/Output/MachO_i386_eh_frame.o
Stack dump:
0. Program arguments: /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -triple=i386-apple-macosx10.4 -verify -map-section MachO_i386_eh_frame.o,__text=0x2000 -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_i386_eh_frame.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/X86/Output/MachO_i386_eh_frame.o
Segmentation fault


@lhames
Copy link
Contributor

lhames commented Sep 10, 2014

So the good news is that it looks like X86-64 is now passing. Unfortunately i386 and ARM are still failing. I'll look at i386 next.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Oct 28, 2014

Here's what today's failure on the x86_64 test looks like:

FAIL: LLVM :: ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s (3 of 5)
******************** TEST 'LLVM :: ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s' FAILED ********************
Script:

gtimeout 1m /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-mc -triple=armv7s-apple-ios7.0.0 -relocation-model=pic -filetype=obj -o /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/ARM/Output/foo.o /Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s
gtimeout 1m /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=armv7s-apple-ios7.0.0 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/ARM/Output/foo.o

Exit Code: 1

Command Output (stderr):

Args: /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=armv7s-apple-ios7.0.0 -verify -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/ARM/Output/foo.o
Parse symbols:
emitSection SectionID: 0 Name: __text obj addr: 0x4802db4 new addr: 0xe9000 DataSize: 24 StubBufSize: 48 Allocate: 72
Offset: 0x0 flags: 0 SID: 0 Type: 4 Name: insn1
emitSection SectionID: 1 Name: __nl_symbol_ptr obj addr: 0x4802dcc new addr: 0xea000 DataSize: 4 StubBufSize: 0 Allocate: 4
Offset: 0x0 flags: 0 SID: 1 Type: 4 Name: foo$non_lazy_ptr
Offset: 0x8 flags: 0 SID: 0 Type: 4 Name: nextPC
Offset: 0x4 flags: 0 SID: 0 Type: 4 Name: insn2
Offset: 0xc flags: 0 SID: 0 Type: 4 Name: insn3
Offset: 0x10 flags: 0 SID: 0 Type: 4 Name: insn4
Offset: 0x0 flags: 2 SID: 0 Type: 4 Name: bar
Type: 0 Name: aaa
Type: 0 Name: baz
Type: 0 Name: foo
emitCommonSection SectionID: 2 new addr: 0xeb000 DataSize: 24
Allocating common symbol aaa address 0xeb000
Allocating common symbol baz address 0xeb004
Allocating common symbol foo address 0xeb008
Parse relocations:
SectionID: 0
resolveRelocation Section: 0 LocalAddress: 0xe9010 FinalAddress: 0x00000000000e9010 Value: 0x00000000000e9018 Addend: 0 isPCRel: 1 MachoType: 5 Size: 4
resolveRelocation Section: 0 LocalAddress: 0xe900c FinalAddress: 0x00000000000e900c Value: 0x00000000000e9020 Addend: 0 isPCRel: 1 MachoType: 5 Size: 4
Found SECTDIFF: AddrA: 24, AddrB: 8, Addend: 4294967288, SectionA ID: 1, SectionAOffset: 0, SectionB ID: 0, SectionBOffset: 8
Found SECTDIFF: AddrA: 24, AddrB: 8, Addend: 4294967280, SectionA ID: 1, SectionAOffset: 0, SectionB ID: 0, SectionBOffset: 8
Registering stubs for file 'foo.o', section '__text'
SectionID: 1
Registering stubs for file 'foo.o', section '__nl_symbol_ptr'
Populating pointer table section __nl_symbol_ptr, Section ID 1, 1 entries, 4 bytes each:
foo: index 9, PT offset: 0
Reassigning address for section 0 (__text): 0x00000000000e9000 -> 0x0000000000001000
Reassigning address for section 1 (__nl_symbol_ptr): 0x00000000000ea000 -> 0x0000000000002000
Reassigning address for section 2 (): 0x00000000000eb000 -> 0x0000000000003000
Resolving relocations Section #​0 0x0
----- Contents of section __text before relocations -----
0x0000000000001000: 08 00 00 e3 00 00 40 e3 00 10 80 e0 fb 00 00 03
0x0000000000001010: fa 00 00 00 1e ff 2f e1
resolveRelocation Section: 0 LocalAddress: 0xe901c FinalAddress: 0x000000000000101c Value: 0x0000000000001000 Addend: -60 isPCRel: 0 MachoType: 0 Size: 4
resolveRelocation Section: 0 LocalAddress: 0xe9004 FinalAddress: 0x0000000000001004 Value: 0x0000000000001000 Addend: 4294967280 isPCRel: 0 MachoType: 9 Size: 2
resolveRelocation Section: 0 LocalAddress: 0xe9000 FinalAddress: 0x0000000000001000 Value: 0x0000000000001000 Addend: 4294967272 isPCRel: 0 MachoType: 9 Size: 1
----- Contents of section __text after relocations -----
0x0000000000001000: 08 00 0f e8 00 00 40 00 00 10 80 e0 fb 00 00 03
0x0000000000001010: fa 00 00 00 1e ff 2f e1
Resolving relocations Section #​1 0x0
----- Contents of section __nl_symbol_ptr before relocations -----
0x0000000000002000: 00 00 00 00
resolveRelocation Section: 0 LocalAddress: 0xe9004 FinalAddress: 0x0000000000001004 Value: 0x0000000000002000 Addend: 4294967280 isPCRel: 0 MachoType: 9 Size: 2
resolveRelocation Section: 0 LocalAddress: 0xe9000 FinalAddress: 0x0000000000001000 Value: 0x0000000000002000 Addend: 4294967272 isPCRel: 0 MachoType: 9 Size: 1
----- Contents of section __nl_symbol_ptr after relocations -----
0x0000000000002000: 00 00 00 00
Resolving relocations Section #​2 0x0
----- Contents of section before relocations -----
0x0000000000003000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0000000000003010: 00 00 00 00 00 00 00 00
resolveRelocation Section: 0 LocalAddress: 0xe9024 FinalAddress: 0x0000000000001024 Value: 0x0000000000003000 Addend: -60 isPCRel: 0 MachoType: 0 Size: 4
resolveRelocation Section: 1 LocalAddress: 0xea000 FinalAddress: 0x0000000000002000 Value: 0x0000000000003000 Addend: 8 isPCRel: 0 MachoType: 0 Size: 4
----- Contents of section after relocations -----
0x0000000000003000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0000000000003010: 00 00 00 00 00 00 00 00
RuntimeDyldChecker: Checking 'decode_operand(insn1, 1) = (foo$non_lazy_ptr-(nextPC+8))[15:0]'...
Reading section starting at symbol 'insn1' - SID: 0, Offset: 0, Size: 24
0: OPC_ExtractField(25, 3): 4
3: OPC_FilterValue(0, 3020): FAIL: continuing at 3027
3027: OPC_FilterValue(1, 403): FAIL: continuing at 3434
3434: OPC_FilterValue(2, 416): FAIL: continuing at 3854
3854: OPC_FilterValue(3, 2348): FAIL: continuing at 6206
6206: OPC_FilterValue(4, 731): PASS: continuing at 6210
6210: OPC_ExtractField(20, 5): 0
6213: OPC_FilterValue(0, 8): PASS: continuing at 6217
6217: OPC_CheckPredicate(0): PASS
6221: OPC_Decode: opcode 407, using decoder 80
----- DECODE SUCCESSFUL -----
Expression 'decode_operand(insn1, 1) = (foo$non_lazy_ptr-(nextPC+8))[15:0]' is false: 0xe != 0xff0
RuntimeDyldChecker: 'decode_operand(insn1, 1) = (foo$non_lazy_ptr-(nextPC+8))[15:0]' FAILED.
RuntimeDyldChecker: Checking 'decode_operand(insn2, 2) = (foo$non_lazy_ptr-(nextPC+8))[31:16]'...
Reading section starting at symbol 'insn2' - SID: 0, Offset: 4, Size: 20
0: OPC_ExtractField(25, 3): 0
3: OPC_FilterValue(0, 3020): PASS: continuing at 7
7: OPC_ExtractField(21, 1): 0
10: OPC_FilterValue(0, 1545): PASS: continuing at 14
14: OPC_ExtractField(24, 1): 0
17: OPC_FilterValue(0, 336): PASS: continuing at 21
21: OPC_ExtractField(4, 1): 0
24: OPC_FilterValue(0, 103): PASS: continuing at 28
28: OPC_ExtractField(22, 2): 1
31: OPC_FilterValue(0, 20): FAIL: continuing at 55
55: OPC_FilterValue(1, 22): PASS: continuing at 59
59: OPC_CheckPredicate(0): PASS
63: OPC_CheckField(5, 1, 0, 4): FieldValue = 0, ExpectedValue = 0: PASS
69: OPC_Decode: opcode 456, using decoder 0
----- DECODE SUCCESSFUL -----
Error evaluating expression 'decode_operand(insn2, 2) = (foo$non_lazy_ptr-(nextPC+8))[31:16]': Operand '2' of instruction 'insn2' is not an immediate.
Instruction is:
<MCInst #​456 SUBrr >
RuntimeDyldChecker: 'decode_operand(insn2, 2) = (foo$non_lazy_ptr-(nextPC+8))[31:16]' FAILED.
RuntimeDyldChecker: Checking '{4}(stub_addr(foo.o, __text, baz)) = 0xe51ff004'...
Error evaluating expression '
{4}(stub_addr(foo.o, __text, baz)) = 0xe51ff004': Stub for symbol 'baz' not found. If 'baz' is an internal symbol this may indicate that the stub target offset is being computed incorrectly.

RuntimeDyldChecker: '{4}(stub_addr(foo.o, __text, baz)) = 0xe51ff004' FAILED.
RuntimeDyldChecker: Checking '
{4}(stub_addr(foo.o, __text, baz) + 4) = baz'...
Error evaluating expression '*{4}(stub_addr(foo.o, __text, baz) + 4) = baz': Stub for symbol 'baz' not found. If 'baz' is an internal symbol this may indicate that the stub target offset is being computed incorrectly.

RuntimeDyldChecker: '{4}(stub_addr(foo.o, __text, baz) + 4) = baz' FAILED.
RuntimeDyldChecker: Checking 'decode_operand(insn3, 0) = stub_addr(foo.o, __text, baz) - (insn3 + 8)'...
Reading section starting at symbol 'insn3' - SID: 0, Offset: 12, Size: 12
0: OPC_ExtractField(25, 3): 1
3: OPC_FilterValue(0, 3020): FAIL: continuing at 3027
3027: OPC_FilterValue(1, 403): PASS: continuing at 3031
3031: OPC_ExtractField(21, 1): 0
3034: OPC_FilterValue(0, 170): PASS: continuing at 3038
3038: OPC_ExtractField(24, 1): 1
3041: OPC_FilterValue(0, 62): FAIL: continuing at 3107
3107: OPC_FilterValue(1, 4551): PASS: continuing at 3111
3111: OPC_ExtractField(22, 2): 0
3114: OPC_FilterValue(0, 32): PASS: continuing at 3118
3118: OPC_ExtractField(20, 1): 0
3121: OPC_FilterValue(0, 8): PASS: continuing at 3125
3125: OPC_CheckPredicate(10): PASS
3129: OPC_Decode: opcode 221, using decoder 49
----- DECODE SUCCESSFUL -----
Error evaluating expression 'decode_operand(insn3, 0) = stub_addr(foo.o, __text, baz) - (insn3 + 8)': Operand '0' of instruction 'insn3' is not an immediate.
Instruction is:
<MCInst #​221 MOVi16 >
RuntimeDyldChecker: 'decode_operand(insn3, 0) = stub_addr(foo.o, __text, baz) - (insn3 + 8)' FAILED.
RuntimeDyldChecker: Checking '
{4}(stub_addr(foo.o, __text, bar) + 4) = bar'...
Error evaluating expression '*{4}(stub_addr(foo.o, __text, bar) + 4) = bar': Stub for symbol 'bar' not found. If 'bar' is an internal symbol this may indicate that the stub target offset is being computed incorrectly.

RuntimeDyldChecker: '{4}(stub_addr(foo.o, __text, bar) + 4) = bar' FAILED.
RuntimeDyldChecker: Checking '
{4}foo$non_lazy_ptr = foo'...
RuntimeDyldChecker: '*{4}foo$non_lazy_ptr = foo' passed.
/Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld: error: some checks in '/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s' failed

Doesn't look like it's working yet.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Oct 28, 2014

er, I meant ARM

@llvmbot
Copy link
Collaborator Author

llvmbot commented Nov 14, 2014

Still on powerpc-darwin8, built with clang-3.4.2:
Just tested a recent merge from trunk, and the ARM test case now works (yay!), just one problem remains (crash):

FAIL: LLVM :: ExecutionEngine/RuntimeDyld/X86/MachO_i386_eh_frame.s (6486 of 11816)
******************** TEST 'LLVM :: ExecutionEngine/RuntimeDyld/X86/MachO_i386_eh_frame.s' FAILED ********************
Script:

gtimeout 1m /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-mc -triple=i386-apple-macosx10.4 -relocation-model=dynamic-no-pic -filetype=obj -o /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/X86/Output/MachO_i386_eh_frame.o /Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_i386_eh_frame.s
gtimeout 1m /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -triple=i386-apple-macosx10.4 -verify -map-section MachO_i386_eh_frame.o,__text=0x2000 -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_i386_eh_frame.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/X86/Output/MachO_i386_eh_frame.o

Exit Code: 139

Command Output (stderr):

Stack dump:
0. Program arguments: /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -triple=i386-apple-macosx10.4 -verify -map-section MachO_i386_eh_frame.o,__text=0x2000 -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_i386_eh_frame.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/X86/Output/MachO_i386_eh_frame.o

With -debug on the above test case, I see:
Args: /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=i386-apple-macosx10.4 -verify -map-section MachO_i386_eh_frame.o,__text=0x2000 -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_i386_eh_frame.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/X86/Output/MachO_i386_eh_frame.o
Parse symbols:
emitSection SectionID: 0 Name: __text obj addr: 0x4802dc4 new addr: 0x3e000 DataSize: 25 StubBufSize: 0 Allocate: 25
Offset: 0x0 flags: 2 SID: 0 Type: 4 Name: bar
Offset: 0x10 flags: 2 SID: 0 Type: 4 Name: main
Parse relocations:
SectionID: 0
Registering stubs for file 'MachO_i386_eh_frame.o', section '__text'
emitSection SectionID: 1 Name: __eh_frame obj addr: 0x4802de0 new addr: 0x3f000 DataSize: 52 StubBufSize: 0 Allocate: 52
SectionID: 1
Registering stubs for file 'MachO_i386_eh_frame.o', section '__eh_frame'
Reassigning address for section 0 (__text): 0x000000000003e000 -> 0x0000000000002000
Reassigning address for section 1 (__eh_frame): 0x000000000003f000 -> 0x0000000000001000
Resolving relocations Section #​0 0x0
----- Contents of section __text before relocations -----
0x0000000000002000: c3 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00
0x0000000000002010: 55 89 e5 5d e9 e7 ff ff ff
resolveRelocation Section: 0 LocalAddress: 0x3e015 FinalAddress: 0x0000000000002015 Value: 0x0000000000002000 Addend: 4294967296 isPCRel: 1 MachoType: 0 Size: 4
----- Contents of section __text after relocations -----
0x0000000000002000: c3 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00
0x0000000000002010: 55 89 e5 5d e9 e7 ff ff ff
Resolving relocations Section #​1 0x0
----- Contents of section __eh_frame before relocations -----
0x0000000000001000: 14 00 00 00 00 00 00 00 03 7a 52 00 01 7c 08 01
0x0000000000001010: 10 0c 05 04 88 01 00 00 18 00 00 00 1c 00 00 00
0x0000000000001020: d4 ff ff ff 09 00 00 00 00 41 0e 08 84 02 42 0d
0x0000000000001030: 04 00 00 00
----- Contents of section __eh_frame after relocations -----
0x0000000000001000: 14 00 00 00 00 00 00 00 03 7a 52 00 01 7c 08 01
0x0000000000001010: 10 0c 05 04 88 01 00 00 18 00 00 00 1c 00 00 00
0x0000000000001020: d4 ff ff ff 09 00 00 00 00 41 0e 08 84 02 42 0d
0x0000000000001030: 04 00 00 00
Processing FDE: Delta for text: 4294963172, Delta for EH: 0
Processing FDE: Delta for text: 4294963172, Delta for EH: 0
Stack dump:
0. Program arguments: /Users/fang/local/src/LLVM-svn/clang34-stage1-build/./bin/llvm-rtdyld -debug -triple=i386-apple-macosx10.4 -verify -map-section MachO_i386_eh_frame.o,__text=0x2000 -check=/Volumes/Isolde/sources/LLVM-svn/llvm.git/test/ExecutionEngine/RuntimeDyld/X86/MachO_i386_eh_frame.s /Volumes/Isolde/builds/LLVM/clang34-stage1-build/test/ExecutionEngine/RuntimeDyld/X86/Output/MachO_i386_eh_frame.o

GDB shows:
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x1403f004
0x019bfb54 in _ZN4llvmL10processFDEEPKcb ()
(gdb) where
#​0 0x019bfb54 in _ZN4llvmL10processFDEEPKcb ()
#​1 0x019bfb00 in llvm::RTDyldMemoryManager::registerEHFrames ()
#​2 0x01c038bc in llvm::RuntimeDyldMachOCRTPBasellvm::RuntimeDyldMachOI386::registerEHFrames ()
#​3 0x01b5aea8 in llvm::RuntimeDyld::registerEHFrames ()
#​4 0x0000d3e4 in _ZL13linkAndVerifyv ()
#​5 0x0000a45c in main ()

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 9, 2021
@arsenm
Copy link
Contributor

arsenm commented Aug 15, 2023

Old build issue

@arsenm arsenm closed this as not planned Won't fix, can't repro, duplicate, stale Aug 15, 2023
@EugeneZelenko EugeneZelenko added the obsolete Issues with old (unsupported) versions of LLVM label Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla build-problem obsolete Issues with old (unsupported) versions of LLVM
Projects
None yet
Development

No branches or pull requests

4 participants