Skip to content

Commit c89e9d6

Browse files
brad0zmodem
authored andcommitted
Change the default target CPU for OpenBSD/i386 to i586
(cherry picked from commit cd5ab56)
1 parent a3e8436 commit c89e9d6

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

clang/lib/Driver/ToolChains/Arch/X86.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ const char *x86::getX86TargetCPU(const ArgList &Args,
9393
return "x86-64";
9494

9595
switch (Triple.getOS()) {
96-
case llvm::Triple::FreeBSD:
97-
return "i686";
9896
case llvm::Triple::NetBSD:
99-
case llvm::Triple::OpenBSD:
10097
return "i486";
10198
case llvm::Triple::Haiku:
99+
case llvm::Triple::OpenBSD:
102100
return "i586";
101+
case llvm::Triple::FreeBSD:
102+
return "i686";
103103
default:
104104
// Fallback to p4.
105105
return "pentium4";

clang/test/Driver/openbsd.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
// CHECK-PG: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd"
1515
// CHECK-PG: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-nopie" "-o" "a.out" "{{.*}}gcrt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lcompiler_rt" "-lpthread_p" "-lc_p" "-lcompiler_rt" "{{.*}}crtend.o"
1616

17+
// Check CPU type for i386
18+
// RUN: %clang -target i386-unknown-openbsd -### -c %s 2>&1 \
19+
// RUN: | FileCheck -check-prefix=CHECK-i386-CPU %s
20+
// CHECK-i386-CPU: "-target-cpu" "i586"
21+
1722
// Check CPU type for MIPS64
1823
// RUN: %clang -target mips64-unknown-openbsd -### -c %s 2>&1 \
1924
// RUN: | FileCheck -check-prefix=CHECK-MIPS64-CPU %s

0 commit comments

Comments
 (0)