[lld] r248300 - [MachO] Use llvm-readobj in lieu of macho-dump.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 10:31:02 PDT 2015


Author: davide
Date: Tue Sep 22 12:31:01 2015
New Revision: 248300

URL: http://llvm.org/viewvc/llvm-project?rev=248300&view=rev
Log:
[MachO] Use llvm-readobj in lieu of macho-dump.

The latter will be removed from the tree anytime soon.

Modified:
    lld/trunk/test/CMakeLists.txt
    lld/trunk/test/mach-o/arm-interworking.yaml
    lld/trunk/test/mach-o/arm-shims.yaml
    lld/trunk/test/mach-o/image-base.yaml

Modified: lld/trunk/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/CMakeLists.txt?rev=248300&r1=248299&r2=248300&view=diff
==============================================================================
--- lld/trunk/test/CMakeLists.txt (original)
+++ lld/trunk/test/CMakeLists.txt Tue Sep 22 12:31:01 2015
@@ -22,7 +22,7 @@ configure_lit_site_cfg(
 set(LLD_TEST_DEPS
   FileCheck not llvm-ar llvm-as llvm-nm llc
   lld llvm-config llvm-objdump llvm-readobj yaml2obj obj2yaml
-  linker-script-test macho-dump llvm-mc llvm-nm llvm-lib
+  linker-script-test llvm-mc llvm-nm llvm-lib
   )
 if (LLVM_INCLUDE_TESTS)
   set(LLD_TEST_DEPS ${LLD_TEST_DEPS} LLDUnitTests)

Modified: lld/trunk/test/mach-o/arm-interworking.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/mach-o/arm-interworking.yaml?rev=248300&r1=248299&r2=248300&view=diff
==============================================================================
--- lld/trunk/test/mach-o/arm-interworking.yaml (original)
+++ lld/trunk/test/mach-o/arm-interworking.yaml Tue Sep 22 12:31:01 2015
@@ -2,7 +2,7 @@
 # RUN: %p/Inputs/arm-interworking.yaml -o %t  | FileCheck %s \
 # RUN: && lld -flavor darwin -arch armv7 -dylib -print_atoms \
 # RUN:         %p/Inputs/libSystem.yaml %t -o %t2  | FileCheck %s \
-# RUN: && macho-dump --dump-section-data %t2 | FileCheck -check-prefix=CODE %s
+# RUN: && llvm-readobj -s -sd %t2 | FileCheck -check-prefix=CODE %s
 #
 # Test thumb and arm branches round trip through -r.
 # Test bl/blx instructions are fixed up properly.
@@ -210,15 +210,23 @@ undefined-symbols:
 # CHECK:   - name:            _a2
 # CHECK:     scope:           global
 
+# CODE:     Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00)
+# CODE:     Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
+# CODE:     SectionData (
+# CODE:       0000: 00F016E8 C04600F0 1EE8C046 00F01AE8
+# CODE:       0010: FFF7F6FF C046FFF7 F3FFC046 00F006F8
+# CODE:       0020: C04600F0 03F800F0 02F87047 70477047
+# CODE:       0030: FEFFFFEB 020000EB F0FFFFFA FAFFFFFA
+# CODE:       0040: 1EFF2FE1 1EFF2FE1
+# CODE:     )
+
+# CODE:     Name: __data (5F 5F 64 61 74 61 00 00 00 00 00 00 00 00 00 00)
+# CODE:     Segment: __DATA (5F 5F 44 41 54 41 00 00 00 00 00 00 00 00 00 00)
+# CODE:     SectionData (
+# CODE:       0000: E50F0000 E80F0000 B90F0000 E80F0000
+# CODE:     )
 
-# CODE:    (('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
-# CODE:     ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
-# CODE:   ('_section_data', '00f016e8 c04600f0 1ee8c046 00f01ae8 fff7f6ff c046fff7 f3ffc046 00f006f8 c04600f0 03f800f0 02f87047 70477047 feffffeb 020000eb f0fffffa fafffffa 1eff2fe1 1eff2fe1')
 # When we get a good mach-o disassembler the above __text section content check can be change to be symbolic.
-
-# CODE:  (('section_name', '__data\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
-# CODE:    ('segment_name', '__DATA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
-# CODE:  ('_section_data', '{{[0-9a-f]}}{{[13579bdf]}}{{[0-9a-f]+}} {{[0-9a-f]}}{{[02468ade]}}{{[0-9a-f]+}} {{[0-9a-f]}}{{[13579bdf]}}{{[0-9a-f]+}} {{[0-9a-f]}}{{[02468ade]}}{{[0-9a-f]+}}')
 # Verify the low (thumb) bit is set on the first and third pointers but not the second and fourth.
 
 

Modified: lld/trunk/test/mach-o/arm-shims.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/mach-o/arm-shims.yaml?rev=248300&r1=248299&r2=248300&view=diff
==============================================================================
--- lld/trunk/test/mach-o/arm-shims.yaml (original)
+++ lld/trunk/test/mach-o/arm-shims.yaml Tue Sep 22 12:31:01 2015
@@ -1,6 +1,6 @@
 # RUN: lld -flavor darwin -arch armv7 %s %p/Inputs/arm-shims.yaml \
 # RUN: -dylib %p/Inputs/libSystem.yaml -o %t
-# RUN: macho-dump --dump-section-data %t | FileCheck %s
+# RUN: llvm-readobj -s -sd %t | FileCheck %s
 #
 # Test b from arm to thumb or vice versa has shims added.s
 #
@@ -69,10 +69,18 @@ undefined-symbols:
 
 ...
 
-
-# CHECK:    (('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
-# CHECK:     ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
-# CHECK:     ('_section_data', '00bf00f0 10e800f0 19b80000 00f020e3 000000fa 0f0000ea 00bffff7 f8ef00f0 07b80000 00f020e3 f4fffffa 050000ea dff804c0 ff446047 d4ffffff dff804c0 ff446047 e0ffffff 04c09fe5 0cc08fe0 1cff2fe1 adffffff 04c09fe5 0cc08fe0 1cff2fe1 b5ffffff')
+# CHECK:   Section {
+# CHECK:     Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00)
+# CHECK:     Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
+# CHECK:     SectionData (
+# CHECK:       0000: 00BF00F0 10E800F0 19B80000 00F020E3
+# CHECK:       0010: 000000FA 0F0000EA 00BFFFF7 F8EF00F0
+# CHECK:       0020: 07B80000 00F020E3 F4FFFFFA 050000EA
+# CHECK:       0030: DFF804C0 FF446047 D4FFFFFF DFF804C0
+# CHECK:       0040: FF446047 E0FFFFFF 04C09FE5 0CC08FE0
+# CHECK:       0050: 1CFF2FE1 ADFFFFFF 04C09FE5 0CC08FE0
+# CHECK:       0060: 1CFF2FE1 B5FFFFFF
+# CHECK:     )
 
 # When we get a good mach-o disassembler the above __text section content check can be change to be symbolic.
 

Modified: lld/trunk/test/mach-o/image-base.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/mach-o/image-base.yaml?rev=248300&r1=248299&r2=248300&view=diff
==============================================================================
--- lld/trunk/test/mach-o/image-base.yaml (original)
+++ lld/trunk/test/mach-o/image-base.yaml Tue Sep 22 12:31:01 2015
@@ -1,5 +1,5 @@
 # RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.9 %s -o %t -image_base 31415926000 %p/Inputs/libSystem.yaml
-# RUN: macho-dump %t | FileCheck %s
+# RUN: llvm-readobj -macho-segment %t | FileCheck %s
 # RUN: not lld -flavor darwin -arch x86_64 -image_base 0x31415926530 %s >/dev/null 2> %t
 # RUN: FileCheck < %t %s --check-prefix=CHECK-ERROR-MISPAGED
 # RUN: not lld -flavor darwin -arch x86_64 -image_base 1000 %s >/dev/null 2> %t
@@ -13,11 +13,12 @@ defined-atoms:
      scope:           global
      content:         []
 
-  # Unfortunately, llvm-objdump and llvm-readobj are too generic and don't give
-  # us easy access to the MachO segment model, so we have to check the uglier
-  # macho-dump output.
-# CHECK: 'segment_name', '__TEXT
-# CHECK-NEXT: 'vm_addr', 3384796143616
+# CHECK: Segment {
+# CHECK:   Cmd: LC_SEGMENT_64
+# CHECK:   Name: __TEXT
+# CHECK-NEXT:   Size: 152
+# CHECK-NEXT:   vmaddr: 0x31415926000
+# CHECK-NEXT:   vmsize: 0x1000
 
 
 # CHECK-ERROR-MISPAGED: error: image_base must be a multiple of page size (0x1000)




More information about the llvm-commits mailing list