From 5b2990a6ff77d8026258fc51c5767e9ee0662f1a Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Mon, 20 Dec 2021 10:12:50 -0800 Subject: [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) --- lld/ELF/Arch/PPC.cpp | 3 +++ 1 file changed, 3 insertions(+) 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: -- cgit v1.2.1