llvm.org GIT mirror llvm / 2fcd2ae
Merging r369426 and r369443: ------------------------------------------------------------------------ r369426 | mstorsjo | 2019-08-20 20:58:05 +0200 (Tue, 20 Aug 2019) | 5 lines [TargetMachine] Don't try to create COFFSTUB references on windows on non-COFF This avoids spurious relocation types for windows/elf targets. Differential Revision: https://reviews.llvm.org/D66401 ------------------------------------------------------------------------ ------------------------------------------------------------------------ r369443 | mstorsjo | 2019-08-20 22:58:02 +0200 (Tue, 20 Aug 2019) | 11 lines [test] Fix tests when run on windows after SVN r369426. NFC. When running tests on windows, invoking "llc -march=<arch>" will implicitly use windows as the target os, making these tests misbehave after this change. Fix the issue by using more specific -mtriple values instead of plain -march in these tests. This should hopefully fix buildbot failures like http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/9816. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_90@369654 91177308-0d34-0410-b5e6-96231b3b80d8 Hans Wennborg 1 year, 3 months ago
9 changed file(s) with 29 addition(s) and 17 deletion(s). Raw diff Collapse all Expand all
139139 // don't assume the variables to be DSO local unless we actually know
140140 // that for sure. This only has to be done for variables; for functions
141141 // the linker can insert thunks for calling functions from another DLL.
142 if (TT.isWindowsGNUEnvironment() && GV && GV->isDeclarationForLinker() &&
143 isa(GV))
142 if (TT.isWindowsGNUEnvironment() && TT.isOSBinFormatCOFF() && GV &&
143 GV->isDeclarationForLinker() && isa(GV))
144144 return false;
145145
146146 // On COFF, don't mark 'extern_weak' symbols as DSO local. If these symbols
153153 // Make an exception for windows OS in the triple: Some firmware builds use
154154 // *-win32-macho triples. This (accidentally?) produced windows relocations
155155 // without GOT tables in older clang versions; Keep this behaviour.
156 if (TT.isOSBinFormatCOFF() || (TT.isOSWindows() && TT.isOSBinFormatMachO()))
156 // Some JIT users use *-win32-elf triples; these shouldn't use GOT tables
157 // either.
158 if (TT.isOSBinFormatCOFF() || TT.isOSWindows())
157159 return true;
158160
159161 // Most PIC code sequences that assume that a symbol is local cannot
145145 return X86II::MO_DLLIMPORT;
146146 return X86II::MO_COFFSTUB;
147147 }
148 // Some JIT users use *-win32-elf triples; these shouldn't use GOT tables.
149 if (isOSWindows())
150 return X86II::MO_NO_FLAG;
148151
149152 if (is64Bit()) {
150153 // ELF supports a large, truly PIC code model with non-PC relative GOT
None ; RUN: llc -march=amdgcn -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
0 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
11
22 ; GCN: foo1:
33 ; v_cndmask_b32_e64 v0, 0, 1, vcc_lo{{$}}
0 ; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -O1 < %s | FileCheck -check-prefix=OPT %s
1 ; RUN: llc -march=amdgcn -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefix=LLC %s
1 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefix=LLC %s
22
33 ; OPT: declare void @foo4() local_unnamed_addr #0
44 ; OPT: define internal fastcc void @foo3.2() unnamed_addr #1
0 ; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -O1 < %s | FileCheck -check-prefix=OPT %s
1 ; RUN: llc -march=amdgcn -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefix=LLC %s
1 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefix=LLC %s
22
33 ; OPT: declare void @foo4() local_unnamed_addr #0
44 ; OPT: define void @foo3() local_unnamed_addr #1
None ; RUN: llc -march=hexagon -relocation-model=pic < %s | FileCheck %s
0 ; RUN: llc -mtriple=hexagon-unknown-elf -relocation-model=pic < %s | FileCheck %s
11
22 ; CHECK: r{{[0-9]+}} = add({{pc|PC}},##.LJTI{{[0-9_]+}}@PCREL)
33 ; CHECK: r{{[0-9]+}} = memw(r{{[0-9]}}+##g0@GOT
None ; RUN: llc -march=hexagon -hexagon-small-data-threshold=8 -relocation-model=static < %s | FileCheck --check-prefixes=CHECK,STATIC %s
1 ; RUN: llc -march=hexagon -hexagon-small-data-threshold=8 -relocation-model=pic < %s | FileCheck --check-prefixes=CHECK,PIC %s
0 ; RUN: llc -mtriple=hexagon-unknown-elf -hexagon-small-data-threshold=8 -relocation-model=static < %s | FileCheck --check-prefixes=CHECK,STATIC %s
1 ; RUN: llc -mtriple=hexagon-unknown-elf -hexagon-small-data-threshold=8 -relocation-model=pic < %s | FileCheck --check-prefixes=CHECK,PIC %s
22
33 ; If a global has a specified section, it should probably be placed in that
44 ; section, but with PIC any accesses to globals in small data should still
None ; RUN: llc <%s -march=sparc -relocation-model=static | FileCheck %s --check-prefix=v8abs
1 ; RUN: llc <%s -march=sparcv9 -relocation-model=static | FileCheck %s --check-prefix=v9abs
2 ; RUN: llc <%s -march=sparc -relocation-model=pic | FileCheck %s --check-prefix=pic
3 ; RUN: llc <%s -march=sparcv9 -relocation-model=pic | FileCheck %s --check-prefix=pic
0 ; RUN: llc <%s -mtriple=sparc-unknown-linux -relocation-model=static | FileCheck %s --check-prefix=v8abs
1 ; RUN: llc <%s -mtriple=sparcv9-unknown-linux -relocation-model=static | FileCheck %s --check-prefix=v9abs
2 ; RUN: llc <%s -mtriple=sparc-unknown-linux -relocation-model=pic | FileCheck %s --check-prefix=pic
3 ; RUN: llc <%s -mtriple=sparcv9-unknown-linux -relocation-model=pic | FileCheck %s --check-prefix=pic
44
5 ; RUN: llc <%s -march=sparc -relocation-model=static -filetype=obj | llvm-readobj -r --symbols | FileCheck %s --check-prefix=v8abs-obj
6 ; RUN: llc <%s -march=sparcv9 -relocation-model=static -filetype=obj | llvm-readobj -r --symbols | FileCheck %s --check-prefix=v9abs-obj
7 ; RUN: llc <%s -march=sparc -relocation-model=pic -filetype=obj | llvm-readobj -r --symbols | FileCheck %s --check-prefix=pic-obj
8 ; RUN: llc <%s -march=sparcv9 -relocation-model=pic -filetype=obj | llvm-readobj -r --symbols | FileCheck %s --check-prefix=pic-obj
5 ; RUN: llc <%s -mtriple=sparc-unknown-linux -relocation-model=static -filetype=obj | llvm-readobj -r --symbols | FileCheck %s --check-prefix=v8abs-obj
6 ; RUN: llc <%s -mtriple=sparcv9-unknown-linux -relocation-model=static -filetype=obj | llvm-readobj -r --symbols | FileCheck %s --check-prefix=v9abs-obj
7 ; RUN: llc <%s -mtriple=sparc-unknown-linux -relocation-model=pic -filetype=obj | llvm-readobj -r --symbols | FileCheck %s --check-prefix=pic-obj
8 ; RUN: llc <%s -mtriple=sparcv9-unknown-linux -relocation-model=pic -filetype=obj | llvm-readobj -r --symbols | FileCheck %s --check-prefix=pic-obj
99
1010 @local_symbol = internal thread_local global i32 0
1111 @extern_symbol = external thread_local global i32
0 ; RUN: llc < %s -mtriple=x86_64-w64-mingw32 | FileCheck %s -check-prefix=CHECK-X64
11 ; RUN: llc < %s -mtriple=i686-w64-mingw32 | FileCheck %s -check-prefix=CHECK-X86
2 ; RUN: llc < %s -mtriple=i686-w64-mingw32-none-elf | FileCheck %s -check-prefix=CHECK-X86-ELF
23
34 @var = external local_unnamed_addr global i32, align 4
45 @dsolocalvar = external dso_local local_unnamed_addr global i32, align 4
1516 ; CHECK-X86: movl .refptr._var, %eax
1617 ; CHECK-X86: movl (%eax), %eax
1718 ; CHECK-X86: retl
19 ; CHECK-X86-ELF-LABEL: getVar:
20 ; CHECK-X86-ELF: movl var, %eax
21 ; CHECK-X86-ELF: retl
1822 entry:
1923 %0 = load i32, i32* @var, align 4
2024 ret i32 %0
6569 ; CHECK-X86: movl __imp__extvar, %eax
6670 ; CHECK-X86: movl (%eax), %eax
6771 ; CHECK-X86: retl
72 ; CHECK-X86-ELF-LABEL: getExtVar:
73 ; CHECK-X86-ELF: movl extvar, %eax
74 ; CHECK-X86-ELF: retl
6875 entry:
6976 %0 = load i32, i32* @extvar, align 4
7077 ret i32 %0