From f8af5cf600354830d4ccf59732403f0f073eccb9 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 22 Dec 2013 00:04:03 +0000 Subject: Vendor import of llvm release_34 branch r197841 (effectively, 3.4 RC3): https://llvm.org/svn/llvm-project/llvm/branches/release_34@197841 --- test/MC/MachO/ARM/lit.local.cfg | 2 -- test/MC/MachO/bad-darwin-x86_64-32-bit-abs-addr.s | 5 +++ test/MC/MachO/bad-darwin-x86_64-diff-relocs.s | 5 +++ test/MC/MachO/bad-indirect-symbols.s | 5 +++ test/MC/MachO/bss.s | 17 ++++++++++ test/MC/MachO/darwin-x86_64-diff-reloc-assign-2.s | 38 +++++++++++++++++++++++ test/MC/MachO/lit.local.cfg | 2 -- test/MC/MachO/tlv-bss.ll | 33 ++++++++++++++++++++ 8 files changed, 103 insertions(+), 4 deletions(-) create mode 100644 test/MC/MachO/bad-darwin-x86_64-32-bit-abs-addr.s create mode 100644 test/MC/MachO/bad-darwin-x86_64-diff-relocs.s create mode 100644 test/MC/MachO/bad-indirect-symbols.s create mode 100644 test/MC/MachO/bss.s create mode 100644 test/MC/MachO/darwin-x86_64-diff-reloc-assign-2.s create mode 100644 test/MC/MachO/tlv-bss.ll (limited to 'test/MC/MachO') diff --git a/test/MC/MachO/ARM/lit.local.cfg b/test/MC/MachO/ARM/lit.local.cfg index 9f0d39d9217b..8a3ba96497e7 100644 --- a/test/MC/MachO/ARM/lit.local.cfg +++ b/test/MC/MachO/ARM/lit.local.cfg @@ -1,5 +1,3 @@ -config.suffixes = ['.s', '.ll'] - targets = set(config.root.targets_to_build.split()) if not 'ARM' in targets: config.unsupported = True diff --git a/test/MC/MachO/bad-darwin-x86_64-32-bit-abs-addr.s b/test/MC/MachO/bad-darwin-x86_64-32-bit-abs-addr.s new file mode 100644 index 000000000000..5fcd31626025 --- /dev/null +++ b/test/MC/MachO/bad-darwin-x86_64-32-bit-abs-addr.s @@ -0,0 +1,5 @@ +// RUN: not llvm-mc -triple x86_64-apple-darwin10 %s -filetype=obj -o - 2> %t.err > %t +// RUN: FileCheck --check-prefix=CHECK-ERROR < %t.err %s + +mov $_f, %rsi +// CHECK-ERROR: 32-bit absolute addressing is not supported in 64-bit mode diff --git a/test/MC/MachO/bad-darwin-x86_64-diff-relocs.s b/test/MC/MachO/bad-darwin-x86_64-diff-relocs.s new file mode 100644 index 000000000000..1ccebc5124c3 --- /dev/null +++ b/test/MC/MachO/bad-darwin-x86_64-diff-relocs.s @@ -0,0 +1,5 @@ +// RUN: not llvm-mc -triple x86_64-apple-darwin10 %s -filetype=obj -o - 2> %t.err > %t +// RUN: FileCheck --check-prefix=CHECK-ERROR < %t.err %s + +.quad _foo - _bar +// CHECK-ERROR: unsupported relocation with subtraction expression diff --git a/test/MC/MachO/bad-indirect-symbols.s b/test/MC/MachO/bad-indirect-symbols.s new file mode 100644 index 000000000000..7c16e90522c3 --- /dev/null +++ b/test/MC/MachO/bad-indirect-symbols.s @@ -0,0 +1,5 @@ +// RUN: not llvm-mc -triple x86_64-apple-darwin10 %s -filetype=obj -o - 2> %t.err > %t +// RUN: FileCheck --check-prefix=CHECK-ERROR < %t.err %s + +x: .indirect_symbol _y +// CHECK-ERROR: 4:4: error: indirect symbol not in a symbol pointer or stub section diff --git a/test/MC/MachO/bss.s b/test/MC/MachO/bss.s new file mode 100644 index 000000000000..15d490ad5eba --- /dev/null +++ b/test/MC/MachO/bss.s @@ -0,0 +1,17 @@ +// The purpose of this test is to verify that bss sections are emited correctly. + +// RUN: llvm-mc -filetype=obj -triple i686-apple-darwin9 %s | llvm-readobj -s | FileCheck %s +// RUN: llvm-mc -filetype=obj -triple x86_64-apple-darwin9 %s | llvm-readobj -s | FileCheck %s + + .bss + .globl _g0 + .align 4 +_g0: + .long 0 + +// CHECK: Name: __bss (5F 5F 62 73 73 00 00 00 00 00 00 00 00 00 00 00) +// CHECK-NEXT: Segment: __DATA (5F 5F 44 41 54 41 00 00 00 00 00 00 00 00 00 00) +// CHECK-NEXT: Address: 0x0 +// CHECK-NEXT: Size: 0x4 +// CHECK-NEXT: Offset: 0 +// CHECK-NEXT: Alignment: 4 diff --git a/test/MC/MachO/darwin-x86_64-diff-reloc-assign-2.s b/test/MC/MachO/darwin-x86_64-diff-reloc-assign-2.s new file mode 100644 index 000000000000..5d548790a7a9 --- /dev/null +++ b/test/MC/MachO/darwin-x86_64-diff-reloc-assign-2.s @@ -0,0 +1,38 @@ +// RUN: llvm-mc -triple x86_64-apple-darwin9 %s -filetype=obj -o - | macho-dump --dump-section-data | FileCheck %s + +// Test case for rdar://9356266 + +// This tests that this expression does not cause a crash and produces these +// four relocation entries: +// Relocation information (__DATA,__data) 4 entries +// address pcrel length extern type scattered symbolnum/value +// 00000004 False long False SUB False 2 (__DATA,__data) +// 00000004 False long False UNSIGND False 2 (__DATA,__data) +// 00000000 False long False SUB False 2 (__DATA,__data) +// 00000000 False long False UNSIGND False 2 (__DATA,__data) + + .data +L_var1: +L_var2: +// This was working fine + .long L_var2 - L_var1 + + .set L_var3, . + .set L_var4, . +// But this was causing a crash + .long L_var4 - L_var3 + +// CHECK: ('_relocations', [ +// CHECK: # Relocation 0 +// CHECK: (('word-0', 0x4), +// CHECK: ('word-1', 0x54000002)), +// CHECK: # Relocation 1 +// CHECK: (('word-0', 0x4), +// CHECK: ('word-1', 0x4000002)), +// CHECK: # Relocation 2 +// CHECK: (('word-0', 0x0), +// CHECK: ('word-1', 0x54000002)), +// CHECK: # Relocation 3 +// CHECK: (('word-0', 0x0), +// CHECK: ('word-1', 0x4000002)), +// CHECK: ]) diff --git a/test/MC/MachO/lit.local.cfg b/test/MC/MachO/lit.local.cfg index 41a8434f9993..ba763cf03ffc 100644 --- a/test/MC/MachO/lit.local.cfg +++ b/test/MC/MachO/lit.local.cfg @@ -1,5 +1,3 @@ -config.suffixes = ['.s', '.ll'] - targets = set(config.root.targets_to_build.split()) if not 'X86' in targets: config.unsupported = True diff --git a/test/MC/MachO/tlv-bss.ll b/test/MC/MachO/tlv-bss.ll new file mode 100644 index 000000000000..af620f9e3048 --- /dev/null +++ b/test/MC/MachO/tlv-bss.ll @@ -0,0 +1,33 @@ +; RUN: llc -O0 -mtriple=x86_64-apple-darwin12 -filetype=obj -o - %s | macho-dump | FileCheck %s +; Test that we emit weak_odr thread_locals correctly into the thread_bss section +; PR15972 + +; CHECK: __thread_bss +; CHECK: 'size', 8 +; CHECK: 'alignment', 3 +; CHECK: __thread_vars + +; Generated from this C++ source +; template +; struct Tls { +; static __thread void* val; +; }; + +; template __thread void* Tls::val; + +; void* f(int x) { +; return Tls::val; +; } + +@_ZN3TlsIlE3valE = weak_odr thread_local global i8* null, align 8 + +; Function Attrs: nounwind ssp uwtable +define i8* @_Z1fi(i32 %x) #0 { +entry: + %x.addr = alloca i32, align 4 + store i32 %x, i32* %x.addr, align 4 + %0 = load i8** @_ZN3TlsIlE3valE, align 8 + ret i8* %0 +} + +attributes #0 = { nounwind ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } -- cgit v1.2.3