[clang] 1e56821 - [Linux] Hack around Linux/sparc <bits/stdio-ldbl.h>
Rainer Orth via cfe-commits
cfe-commits at lists.llvm.org
Sat Sep 10 00:38:25 PDT 2022
Author: Rainer Orth
Date: 2022-09-10T09:37:35+02:00
New Revision: 1e56821bac02a5d3c6249bbf3ef43b8b569d2551
URL: https://github.com/llvm/llvm-project/commit/1e56821bac02a5d3c6249bbf3ef43b8b569d2551
DIFF: https://github.com/llvm/llvm-project/commit/1e56821bac02a5d3c6249bbf3ef43b8b569d2551.diff
LOG: [Linux] Hack around Linux/sparc <bits/stdio-ldbl.h>
I've been using this hack to work around the Linux/sparc64 compile failure
described in Issue #47994
<https://github.com/llvm/llvm-project/issues/47994>, especially since the
underlying glibc PR build/27558
<https://sourceware.org/bugzilla/show_bug.cgi?id=27558> doesn't seem to be
making progress and some fix is required to have LLVM build on
`sparc64-unknown-linux-gnu` at all, as evidenced on the buildbot.
Tested on `sparc64-unknown-linux-gnu`.
Differential Revision: https://reviews.llvm.org/D133405
Added:
Modified:
clang/lib/Basic/Targets/OSTargets.h
clang/test/Preprocessor/init.c
Removed:
################################################################################
diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h
index 54e66b5bd9e1f..c75f7d9fbafeb 100644
--- a/clang/lib/Basic/Targets/OSTargets.h
+++ b/clang/lib/Basic/Targets/OSTargets.h
@@ -388,6 +388,9 @@ class LLVM_LIBRARY_VISIBILITY LinuxTargetInfo : public OSTargetInfo<Target> {
} else {
Builder.defineMacro("__gnu_linux__");
}
+ // Work around Issue #47994 until glibc PR build/27558 is fixed.
+ if (Triple.isSPARC())
+ Builder.defineMacro("__NO_INLINE__");
if (Opts.POSIXThreads)
Builder.defineMacro("_REENTRANT");
if (Opts.CPlusPlus)
diff --git a/clang/test/Preprocessor/init.c b/clang/test/Preprocessor/init.c
index e3a24824ff190..028f3448f8bda 100644
--- a/clang/test/Preprocessor/init.c
+++ b/clang/test/Preprocessor/init.c
@@ -874,6 +874,9 @@
// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 -triple=sparc-none-none < /dev/null | FileCheck -match-full-lines -check-prefix SPARC -check-prefix SPARC-DEFAULT %s
// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 -triple=sparc-rtems-elf < /dev/null | FileCheck -match-full-lines -check-prefix SPARC -check-prefix SPARC-DEFAULT %s
+// Check that clang defines __NO_INLINE__ unconditionally (even at -O) to
+// work around Issue #47994.
+// RUN: %clang_cc1 -E -dM -triple=sparc-unknown-linux-gnu -O < /dev/null | FileCheck -match-full-lines -check-prefix SPARC-LINUX %s
// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 -triple=sparc-none-netbsd < /dev/null | FileCheck -match-full-lines -check-prefix SPARC -check-prefix SPARC-NETOPENBSD %s
// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -fgnuc-version=4.2.1 -triple=sparc-none-none < /dev/null | FileCheck -match-full-lines -check-prefix SPARC -check-prefix SPARC-DEFAULT -check-prefix SPARC-DEFAULT-CXX %s
//
@@ -997,6 +1000,7 @@
// SPARC:#define __LONG_LONG_MAX__ 9223372036854775807LL
// SPARC:#define __LONG_MAX__ 2147483647L
// SPARC-NOT:#define __LP64__
+// SPARC-LINUX:#define __NO_INLINE__ 1
// SPARC:#define __POINTER_WIDTH__ 32
// SPARC-DEFAULT:#define __PTRDIFF_TYPE__ int
// SPARC-NETOPENBSD:#define __PTRDIFF_TYPE__ long int
@@ -1380,6 +1384,11 @@
// SPARCV9:#define __SIZEOF_POINTER__ 8
// SPARCV9:#define __UINTPTR_TYPE__ long unsigned int
//
+// Check that clang defines __NO_INLINE__ unconditionally (even at -O) to
+// work around Issue #47994.
+// RUN: %clang_cc1 -E -dM -triple=sparc64-unknown-linux-gnu -O < /dev/null | FileCheck -match-full-lines -check-prefix SPARC64-LINUX %s
+// SPARC64-LINUX:#define __NO_INLINE__ 1
+//
// RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc64-none-openbsd < /dev/null | FileCheck -match-full-lines -check-prefix SPARC64-OBSD %s
// SPARC64-OBSD:#define __INT64_TYPE__ long long int
// SPARC64-OBSD:#define __INTMAX_C_SUFFIX__ LL
More information about the cfe-commits
mailing list