diff options
| author | Kevin Enderby <enderby@apple.com> | 2015-02-17 21:35:48 +0000 |
|---|---|---|
| committer | Kevin Enderby <enderby@apple.com> | 2015-02-17 21:35:48 +0000 |
| commit | 578fe5a303b569800f7e0174cad1d937a4dae73f (patch) | |
| tree | 96e9fc4c71ca4f285d0c5afe6869a35cc792791d /llvm/test | |
| parent | 9f61520d40e81d8e88ae332d7548c950d710c8c3 (diff) | |
| download | bcm5719-llvm-578fe5a303b569800f7e0174cad1d937a4dae73f.tar.gz bcm5719-llvm-578fe5a303b569800f7e0174cad1d937a4dae73f.zip | |
Add code to llvm-objdump so the -section option with -macho will dump literal pointer sections
with the Mach-O S_LITERAL_POINTERS section type.
Also fix the printing of the leading addresses for literal sections to be consistent and
not print the 0x prefix. Updated test cases to match.
llvm-svn: 229548
Diffstat (limited to 'llvm/test')
4 files changed, 82 insertions, 14 deletions
diff --git a/llvm/test/tools/llvm-objdump/X86/macho-cstring-dump.test b/llvm/test/tools/llvm-objdump/X86/macho-cstring-dump.test index 869462da233..3dfa4e34b26 100644 --- a/llvm/test/tools/llvm-objdump/X86/macho-cstring-dump.test +++ b/llvm/test/tools/llvm-objdump/X86/macho-cstring-dump.test @@ -1,4 +1,4 @@ RUN: llvm-objdump -m -section __TEXT,__cstring %p/Inputs/hello.obj.macho-x86_64 | FileCheck %s CHECK: Contents of (__TEXT,__cstring) section -CHECK: 0x000000000000003b Hello world\n +CHECK: 000000000000003b Hello world\n diff --git a/llvm/test/tools/llvm-objdump/X86/macho-literal-pointers-i386.test b/llvm/test/tools/llvm-objdump/X86/macho-literal-pointers-i386.test new file mode 100644 index 00000000000..0069668c990 --- /dev/null +++ b/llvm/test/tools/llvm-objdump/X86/macho-literal-pointers-i386.test @@ -0,0 +1,34 @@ +# RUN: llvm-mc < %s -triple i386-apple-darwin -filetype=obj | llvm-objdump -m -section __DATA,__litp - | FileCheck %s + +.cstring +L1: .asciz "Hello world\n" + +.literal4 +.align 2 +L2: .float 4.0 + +.literal8 +.align 3 +L3: .double 8.0 + +.literal16 +.align 4 +L4: .long 0x10000016, 0x20000016, 0x30000016, 0x40000016 + +.const +L5: .asciz "const non-literal string" + +.section __DATA,__litp, literal_pointers +.align 2 +.long L1 +.long L2 +.long L3 +.long L4 +.long L5 + +# CHECK: Contents of (__DATA,__litp) section +# CHECK: 0000004c __TEXT:__cstring:Hello world\n +# CHECK: 00000050 __TEXT:__literal4:0x40800000 +# CHECK: 00000054 __TEXT:__literal8:0x00000000 0x40200000 +# CHECK: 00000058 __TEXT:__literal16:0x10000016 0x20000016 0x30000016 0x40000016 +# CHECK: 0000005c 0x30 (not in a literal section) diff --git a/llvm/test/tools/llvm-objdump/X86/macho-literal-pointers-x86_64.test b/llvm/test/tools/llvm-objdump/X86/macho-literal-pointers-x86_64.test new file mode 100644 index 00000000000..b403b8154de --- /dev/null +++ b/llvm/test/tools/llvm-objdump/X86/macho-literal-pointers-x86_64.test @@ -0,0 +1,34 @@ +# RUN: llvm-mc < %s -triple x86_64-apple-darwin -filetype=obj | llvm-objdump -m -section __DATA,__litp - | FileCheck %s + +.cstring +L1: .asciz "Hello world\n" + +.literal4 +.align 2 +L2: .float 4.0 + +.literal8 +.align 3 +L3: .double 8.0 + +.literal16 +.align 4 +L4: .long 0x10000016, 0x20000016, 0x30000016, 0x40000016 + +.const +L5: .asciz "const non-literal string" + +.section __DATA,__litp, literal_pointers +.align 3 +.quad L1 +.quad L2 +.quad L3 +.quad L4 +.quad L5 + +# CHECK: Contents of (__DATA,__litp) section +# CHECK: 0000000000000050 __TEXT:__cstring:Hello world\n +# CHECK: 0000000000000058 __TEXT:__literal4:0x40800000 +# CHECK: 0000000000000060 __TEXT:__literal8:0x00000000 0x40200000 +# CHECK: 0000000000000068 __TEXT:__literal16:0x10000016 0x20000016 0x30000016 0x40000016 +# CHECK: 0000000000000070 0x30 (not in a literal section) diff --git a/llvm/test/tools/llvm-objdump/X86/macho-literals.test b/llvm/test/tools/llvm-objdump/X86/macho-literals.test index 2acac7d43b6..4824453a976 100644 --- a/llvm/test/tools/llvm-objdump/X86/macho-literals.test +++ b/llvm/test/tools/llvm-objdump/X86/macho-literals.test @@ -11,12 +11,12 @@ .long 0x7f800001 # CHECK-LIT4: Contents of (__TEXT,__literal4) section -# CHECK-LIT4: 0x0000000000000000 0x40200000 -# CHECK-LIT4: 0x0000000000000004 0x41040000 -# CHECK-LIT4: 0x0000000000000008 0x7f800000 -# CHECK-LIT4: 0x000000000000000c 0xff800000 -# CHECK-LIT4: 0x0000000000000010 0x7fc00000 -# CHECK-LIT4: 0x0000000000000014 0x7f800001 +# CHECK-LIT4: 0000000000000000 0x40200000 +# CHECK-LIT4: 0000000000000004 0x41040000 +# CHECK-LIT4: 0000000000000008 0x7f800000 +# CHECK-LIT4: 000000000000000c 0xff800000 +# CHECK-LIT4: 0000000000000010 0x7fc00000 +# CHECK-LIT4: 0000000000000014 0x7f800001 .literal8 .double 2.5 @@ -31,12 +31,12 @@ .long 0x7ff00000 # CHECK-LIT8: Contents of (__TEXT,__literal8) section -# CHECK-LIT8: 0x0000000000000018 0x00000000 0x40040000 -# CHECK-LIT8: 0x0000000000000020 0x00000000 0x40208000 -# CHECK-LIT8: 0x0000000000000028 0x00000000 0x7ff00000 -# CHECK-LIT8: 0x0000000000000030 0x00000000 0xfff00000 -# CHECK-LIT8: 0x0000000000000038 0x00000000 0x7ff80000 -# CHECK-LIT8: 0x0000000000000040 0x00000001 0x7ff00000 +# CHECK-LIT8: 0000000000000018 0x00000000 0x40040000 +# CHECK-LIT8: 0000000000000020 0x00000000 0x40208000 +# CHECK-LIT8: 0000000000000028 0x00000000 0x7ff00000 +# CHECK-LIT8: 0000000000000030 0x00000000 0xfff00000 +# CHECK-LIT8: 0000000000000038 0x00000000 0x7ff80000 +# CHECK-LIT8: 0000000000000040 0x00000001 0x7ff00000 .literal16 .long 1 @@ -45,4 +45,4 @@ .long 4 # CHECK-LIT16: Contents of (__TEXT,__literal16) section -# CHECK-LIT16: 0x0000000000000050 0x00000001 0x00000002 0x00000003 0x00000004 +# CHECK-LIT16: 0000000000000050 0x00000001 0x00000002 0x00000003 0x00000004 |

