Skip to content

Commit ee7601a

Browse files
committed
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. ------------------------------------------------------------------------ llvm-svn: 369654
1 parent 79c1eb9 commit ee7601a

File tree

9 files changed

+30
-18
lines changed

9 files changed

+30
-18
lines changed

llvm/lib/Target/TargetMachine.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ bool TargetMachine::shouldAssumeDSOLocal(const Module &M,
140140
// don't assume the variables to be DSO local unless we actually know
141141
// that for sure. This only has to be done for variables; for functions
142142
// the linker can insert thunks for calling functions from another DLL.
143-
if (TT.isWindowsGNUEnvironment() && GV && GV->isDeclarationForLinker() &&
144-
isa<GlobalVariable>(GV))
143+
if (TT.isWindowsGNUEnvironment() && TT.isOSBinFormatCOFF() && GV &&
144+
GV->isDeclarationForLinker() && isa<GlobalVariable>(GV))
145145
return false;
146146

147147
// On COFF, don't mark 'extern_weak' symbols as DSO local. If these symbols
@@ -154,7 +154,9 @@ bool TargetMachine::shouldAssumeDSOLocal(const Module &M,
154154
// Make an exception for windows OS in the triple: Some firmware builds use
155155
// *-win32-macho triples. This (accidentally?) produced windows relocations
156156
// without GOT tables in older clang versions; Keep this behaviour.
157-
if (TT.isOSBinFormatCOFF() || (TT.isOSWindows() && TT.isOSBinFormatMachO()))
157+
// Some JIT users use *-win32-elf triples; these shouldn't use GOT tables
158+
// either.
159+
if (TT.isOSBinFormatCOFF() || TT.isOSWindows())
158160
return true;
159161

160162
// Most PIC code sequences that assume that a symbol is local cannot

llvm/lib/Target/X86/X86Subtarget.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ unsigned char X86Subtarget::classifyGlobalReference(const GlobalValue *GV,
146146
return X86II::MO_DLLIMPORT;
147147
return X86II::MO_COFFSTUB;
148148
}
149+
// Some JIT users use *-win32-elf triples; these shouldn't use GOT tables.
150+
if (isOSWindows())
151+
return X86II::MO_NO_FLAG;
149152

150153
if (is64Bit()) {
151154
// ELF supports a large, truly PIC code model with non-PC relative GOT

llvm/test/CodeGen/AMDGPU/propagate-attributes-bitcast-function.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: llc -march=amdgcn -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
1+
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
22

33
; GCN: foo1:
44
; v_cndmask_b32_e64 v0, 0, 1, vcc_lo{{$}}

llvm/test/CodeGen/AMDGPU/propagate-attributes-clone.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -O1 < %s | FileCheck -check-prefix=OPT %s
2-
; RUN: llc -march=amdgcn -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefix=LLC %s
2+
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefix=LLC %s
33

44
; OPT: declare void @foo4() local_unnamed_addr #0
55
; OPT: define internal fastcc void @foo3.2() unnamed_addr #1

llvm/test/CodeGen/AMDGPU/propagate-attributes-single-set.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -O1 < %s | FileCheck -check-prefix=OPT %s
2-
; RUN: llc -march=amdgcn -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefix=LLC %s
2+
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefix=LLC %s
33

44
; OPT: declare void @foo4() local_unnamed_addr #0
55
; OPT: define void @foo3() local_unnamed_addr #1

llvm/test/CodeGen/Hexagon/pic-jt-big.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: llc -march=hexagon -relocation-model=pic < %s | FileCheck %s
1+
; RUN: llc -mtriple=hexagon-unknown-elf -relocation-model=pic < %s | FileCheck %s
22

33
; CHECK: r{{[0-9]+}} = add({{pc|PC}},##.LJTI{{[0-9_]+}}@PCREL)
44
; CHECK: r{{[0-9]+}} = memw(r{{[0-9]}}+##g0@GOT

llvm/test/CodeGen/Hexagon/pic-sdata.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
; RUN: llc -march=hexagon -hexagon-small-data-threshold=8 -relocation-model=static < %s | FileCheck --check-prefixes=CHECK,STATIC %s
2-
; RUN: llc -march=hexagon -hexagon-small-data-threshold=8 -relocation-model=pic < %s | FileCheck --check-prefixes=CHECK,PIC %s
1+
; RUN: llc -mtriple=hexagon-unknown-elf -hexagon-small-data-threshold=8 -relocation-model=static < %s | FileCheck --check-prefixes=CHECK,STATIC %s
2+
; RUN: llc -mtriple=hexagon-unknown-elf -hexagon-small-data-threshold=8 -relocation-model=pic < %s | FileCheck --check-prefixes=CHECK,PIC %s
33

44
; If a global has a specified section, it should probably be placed in that
55
; section, but with PIC any accesses to globals in small data should still

llvm/test/CodeGen/SPARC/tls.ll

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
; RUN: llc <%s -march=sparc -relocation-model=static | FileCheck %s --check-prefix=v8abs
2-
; RUN: llc <%s -march=sparcv9 -relocation-model=static | FileCheck %s --check-prefix=v9abs
3-
; RUN: llc <%s -march=sparc -relocation-model=pic | FileCheck %s --check-prefix=pic
4-
; RUN: llc <%s -march=sparcv9 -relocation-model=pic | FileCheck %s --check-prefix=pic
5-
6-
; RUN: llc <%s -march=sparc -relocation-model=static -filetype=obj | llvm-readobj -r --symbols | FileCheck %s --check-prefix=v8abs-obj
7-
; RUN: llc <%s -march=sparcv9 -relocation-model=static -filetype=obj | llvm-readobj -r --symbols | FileCheck %s --check-prefix=v9abs-obj
8-
; RUN: llc <%s -march=sparc -relocation-model=pic -filetype=obj | llvm-readobj -r --symbols | FileCheck %s --check-prefix=pic-obj
9-
; RUN: llc <%s -march=sparcv9 -relocation-model=pic -filetype=obj | llvm-readobj -r --symbols | FileCheck %s --check-prefix=pic-obj
1+
; RUN: llc <%s -mtriple=sparc-unknown-linux -relocation-model=static | FileCheck %s --check-prefix=v8abs
2+
; RUN: llc <%s -mtriple=sparcv9-unknown-linux -relocation-model=static | FileCheck %s --check-prefix=v9abs
3+
; RUN: llc <%s -mtriple=sparc-unknown-linux -relocation-model=pic | FileCheck %s --check-prefix=pic
4+
; RUN: llc <%s -mtriple=sparcv9-unknown-linux -relocation-model=pic | FileCheck %s --check-prefix=pic
5+
6+
; RUN: llc <%s -mtriple=sparc-unknown-linux -relocation-model=static -filetype=obj | llvm-readobj -r --symbols | FileCheck %s --check-prefix=v8abs-obj
7+
; RUN: llc <%s -mtriple=sparcv9-unknown-linux -relocation-model=static -filetype=obj | llvm-readobj -r --symbols | FileCheck %s --check-prefix=v9abs-obj
8+
; RUN: llc <%s -mtriple=sparc-unknown-linux -relocation-model=pic -filetype=obj | llvm-readobj -r --symbols | FileCheck %s --check-prefix=pic-obj
9+
; RUN: llc <%s -mtriple=sparcv9-unknown-linux -relocation-model=pic -filetype=obj | llvm-readobj -r --symbols | FileCheck %s --check-prefix=pic-obj
1010

1111
@local_symbol = internal thread_local global i32 0
1212
@extern_symbol = external thread_local global i32

llvm/test/CodeGen/X86/mingw-refptr.ll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; RUN: llc < %s -mtriple=x86_64-w64-mingw32 | FileCheck %s -check-prefix=CHECK-X64
22
; RUN: llc < %s -mtriple=i686-w64-mingw32 | FileCheck %s -check-prefix=CHECK-X86
3+
; RUN: llc < %s -mtriple=i686-w64-mingw32-none-elf | FileCheck %s -check-prefix=CHECK-X86-ELF
34

45
@var = external local_unnamed_addr global i32, align 4
56
@dsolocalvar = external dso_local local_unnamed_addr global i32, align 4
@@ -16,6 +17,9 @@ define dso_local i32 @getVar() {
1617
; CHECK-X86: movl .refptr._var, %eax
1718
; CHECK-X86: movl (%eax), %eax
1819
; CHECK-X86: retl
20+
; CHECK-X86-ELF-LABEL: getVar:
21+
; CHECK-X86-ELF: movl var, %eax
22+
; CHECK-X86-ELF: retl
1923
entry:
2024
%0 = load i32, i32* @var, align 4
2125
ret i32 %0
@@ -66,6 +70,9 @@ define dso_local i32 @getExtVar() {
6670
; CHECK-X86: movl __imp__extvar, %eax
6771
; CHECK-X86: movl (%eax), %eax
6872
; CHECK-X86: retl
73+
; CHECK-X86-ELF-LABEL: getExtVar:
74+
; CHECK-X86-ELF: movl extvar, %eax
75+
; CHECK-X86-ELF: retl
6976
entry:
7077
%0 = load i32, i32* @extvar, align 4
7178
ret i32 %0

0 commit comments

Comments
 (0)