summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2021-12-20 10:12:50 -0800
committerTom Stellard <tstellar@redhat.com>2021-12-20 22:18:21 -0800
commit5b2990a6ff77d8026258fc51c5767e9ee0662f1a (patch)
treedb4ad3f82e1dae06c98cf53113c6916e2b7b922a
parentbdd28a2a138f0a6db356233a6fe65f49e0016769 (diff)
downloadllvm-5b2990a6ff77d8026258fc51c5767e9ee0662f1a.tar.gz
[ELF] #undef PPC to support GCC powerpc32 build
GCC's powerpc32 port predefines `PPC` as a macro in GNU C++ mode in some configurations (Linux, FreeBSD, and some others. See `builtin_define_std ("PPC"); ` in gcc/config/rs6000). ``` % powerpc-linux-gnu-g++ -E -dM -xc++ /dev/null -o - | grep -w PPC #define PPC 1 ``` Fixes https://bugs.gentoo.org/829599 Reviewed By: thesamesam Differential Revision: https://reviews.llvm.org/D116017 (cherry picked from commit bee5bc9075a44ae74f57a956ebe6d7ce7aa7524b)
-rw-r--r--lld/ELF/Arch/PPC.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lld/ELF/Arch/PPC.cpp b/lld/ELF/Arch/PPC.cpp
index aaecef6ee94f..d9334d5bf853 100644
--- a/lld/ELF/Arch/PPC.cpp
+++ b/lld/ELF/Arch/PPC.cpp
@@ -20,6 +20,9 @@ using namespace llvm::ELF;
using namespace lld;
using namespace lld::elf;
+// Undefine the macro predefined by GCC powerpc32.
+#undef PPC
+
namespace {
class PPC final : public TargetInfo {
public: