[llvm] r214211 - [MCJIT] Make the RuntimeDyldChecker stub_addr builtin use file names rather than

Lang Hames lhames at gmail.com
Tue Jul 29 13:40:37 PDT 2014


Author: lhames
Date: Tue Jul 29 15:40:37 2014
New Revision: 214211

URL: http://llvm.org/viewvc/llvm-project?rev=214211&view=rev
Log:
[MCJIT] Make the RuntimeDyldChecker stub_addr builtin use file names rather than
full paths for its first argument.

This allows us to remove the annoying sed lines in the test cases, and write
direct references to file names in stub_addr calls (rather than <filename>
placeholders).


Modified:
    llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp
    llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCheckerImpl.h
    llvm/trunk/test/ExecutionEngine/RuntimeDyld/AArch64/MachO_ARM64_relocations.s
    llvm/trunk/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s

Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp?rev=214211&r1=214210&r2=214211&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp Tue Jul 29 15:40:37 2014
@@ -13,6 +13,7 @@
 #include "llvm/MC/MCDisassembler.h"
 #include "llvm/MC/MCInst.h"
 #include "llvm/Support/StringRefMemoryObject.h"
+#include "llvm/Support/Path.h"
 #include "RuntimeDyldCheckerImpl.h"
 #include "RuntimeDyldImpl.h"
 #include <cctype>
@@ -772,8 +773,9 @@ RuntimeDyldCheckerImpl::getSubsectionSta
 }
 
 void RuntimeDyldCheckerImpl::registerStubMap(
-    StringRef FileName, unsigned SectionID,
+    StringRef FilePath, unsigned SectionID,
     const RuntimeDyldImpl::StubMap &RTDyldStubs) {
+  StringRef FileName = sys::path::filename(FilePath);
   const SectionEntry &Section = getRTDyld().Sections[SectionID];
   StringRef SectionName = Section.Name;
   for (auto &StubMapEntry : RTDyldStubs) {

Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCheckerImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCheckerImpl.h?rev=214211&r1=214210&r2=214211&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCheckerImpl.h (original)
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCheckerImpl.h Tue Jul 29 15:40:37 2014
@@ -34,7 +34,7 @@ private:
   uint64_t getSymbolLinkerAddr(StringRef Symbol) const;
   uint64_t getSymbolRemoteAddr(StringRef Symbol) const;
   uint64_t readMemoryAtAddr(uint64_t Addr, unsigned Size) const;
-  std::pair<uint64_t, std::string> getStubAddrFor(StringRef FileName,
+  std::pair<uint64_t, std::string> getStubAddrFor(StringRef FilePath,
                                                   StringRef SectionName,
                                                   StringRef Symbol,
                                                   bool IsInsideLoad) const;

Modified: llvm/trunk/test/ExecutionEngine/RuntimeDyld/AArch64/MachO_ARM64_relocations.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/RuntimeDyld/AArch64/MachO_ARM64_relocations.s?rev=214211&r1=214210&r2=214211&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/RuntimeDyld/AArch64/MachO_ARM64_relocations.s (original)
+++ llvm/trunk/test/ExecutionEngine/RuntimeDyld/AArch64/MachO_ARM64_relocations.s Tue Jul 29 15:40:37 2014
@@ -1,6 +1,5 @@
 # RUN: llvm-mc -triple=arm64-apple-ios7.0.0 -code-model=small -relocation-model=pic -filetype=obj -o %T/foo.o %s
-# RUN: sed "s,<filename>,%/T/foo.o,g" %s > %T/foo.s
-# RUN: llvm-rtdyld -triple=arm64-apple-ios7.0.0 -verify -check=%T/foo.s %/T/foo.o
+# RUN: llvm-rtdyld -triple=arm64-apple-ios7.0.0 -verify -check=%s %/T/foo.o
 
     .section  __TEXT,__text,regular,pure_instructions
     .ios_version_min 7, 0
@@ -39,15 +38,14 @@ ldr1:
     ldr  x0, [x0, _ptr at PAGEOFF]
     ret
 
-
 # Test ARM64_RELOC_GOT_LOAD_PAGE21 and ARM64_RELOC_GOT_LOAD_PAGEOFF12
 # relocation. adrp encodes the PC-relative page (4 KiB) difference between the
 # adrp instruction and the GOT entry for ptr. ldr encodes the offset of the GOT
 # entry within the page. The ldr instruction perfroms an implicit shift on the
 # encoded immediate (imm<<3).
-# rtdyld-check:  *{8}(stub_addr(<filename>, __text, _ptr)) = _ptr
-# rtdyld-check:  decode_operand(adrp2, 1) = (stub_addr(<filename>, __text, _ptr)[32:12] - adrp2[32:12])
-# rtdyld-check:  decode_operand(ldr2, 2) = stub_addr(<filename>, __text, _ptr)[11:3]
+# rtdyld-check:  *{8}(stub_addr(foo.o, __text, _ptr)) = _ptr
+# rtdyld-check:  decode_operand(adrp2, 1) = (stub_addr(foo.o, __text, _ptr)[32:12] - adrp2[32:12])
+# rtdyld-check:  decode_operand(ldr2, 2) = stub_addr(foo.o, __text, _ptr)[11:3]
     .globl  _test_adrp_ldr
     .align  2
 _test_got_adrp_ldr:

Modified: llvm/trunk/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s?rev=214211&r1=214210&r2=214211&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s (original)
+++ llvm/trunk/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s Tue Jul 29 15:40:37 2014
@@ -1,6 +1,5 @@
 # RUN: llvm-mc -triple=x86_64-apple-macosx10.9 -relocation-model=pic -filetype=obj -o %T/foo.o %s
-# RUN: sed "s,<filename>,%/T/foo.o,g" %s > %T/foo.s
-# RUN: llvm-rtdyld -triple=x86_64-apple-macosx10.9 -verify -check=%T/foo.s %/T/foo.o
+# RUN: llvm-rtdyld -triple=x86_64-apple-macosx10.9 -verify -check=%s %/T/foo.o
 
         .section	__TEXT,__text,regular,pure_instructions
 	.globl	foo
@@ -24,8 +23,8 @@ insn2:
 # Test PC-rel GOT relocation.
 # Verify both the contents of the GOT entry for y, and that the movq instruction
 # references the correct GOT entry address:
-# rtdyld-check: *{8}(stub_addr(<filename>, __text, y)) = y
-# rtdyld-check: decode_operand(insn3, 4) = stub_addr(<filename>, __text, y) - next_pc(insn3)
+# rtdyld-check: *{8}(stub_addr(foo.o, __text, y)) = y
+# rtdyld-check: decode_operand(insn3, 4) = stub_addr(foo.o, __text, y) - next_pc(insn3)
 insn3:
         movq	y at GOTPCREL(%rip), %rax
 





More information about the llvm-commits mailing list