From 35e093ffbf8243399c3d817290ba8ae9e4f359a0 Mon Sep 17 00:00:00 2001
From: Erik Verbruggen <erik.verbruggen@digia.com>
Date: Tue, 7 Jan 2014 12:58:24 +0100
Subject: [PATCH] Pass PIC/PIE options to gcc when asking for defines.

These influence the __PIC__ and __PIE__ macros.

Change-Id: I7938a897584f49b6e1c4d66c6e69ec7adccf2ad6
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
---
 src/plugins/projectexplorer/gcctoolchain.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp
index f3dbef6285d..11de8e27f29 100644
--- a/src/plugins/projectexplorer/gcctoolchain.cpp
+++ b/src/plugins/projectexplorer/gcctoolchain.cpp
@@ -403,7 +403,9 @@ QByteArray GccToolChain::predefinedMacros(const QStringList &cxxflags) const
                 || a.startsWith(QLatin1String("-specs="))
                 || a == QLatin1String("-ansi") || a == QLatin1String("-undef")
                 || a.startsWith(QLatin1String("-D")) || a.startsWith(QLatin1String("-U"))
-                || a == QLatin1String("-fopenmp") || a == QLatin1String("-Wno-deprecated"))
+                || a == QLatin1String("-fopenmp") || a == QLatin1String("-Wno-deprecated")
+                || a == QLatin1String("-fPIC") || a == QLatin1String("-fpic")
+                || a == QLatin1String("-fPIE") || a == QLatin1String("-fpie"))
             arguments << a;
     }
     macros = gccPredefinedMacros(m_compilerCommand, reinterpretOptions(arguments),
-- 
GitLab