From 7c213a7017111e195f58fbec041a0593551f95c5 Mon Sep 17 00:00:00 2001
From: Basile Desloges <basile.desloges@cea.fr>
Date: Wed, 7 Apr 2021 11:51:43 +0200
Subject: [PATCH] [eacsl] Deactivate PIE in debug mode

When the executable is linked with PIE, it is not possible for E-ACSL
to produce an accurate backtrace. This commit deactivate PIE if
e-acsl-gcc.sh compiles in debug mode.
---
 src/plugins/e-acsl/scripts/e-acsl-gcc.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/plugins/e-acsl/scripts/e-acsl-gcc.sh b/src/plugins/e-acsl/scripts/e-acsl-gcc.sh
index 45d8ddb1222..d0cbd0bb708 100755
--- a/src/plugins/e-acsl/scripts/e-acsl-gcc.sh
+++ b/src/plugins/e-acsl/scripts/e-acsl-gcc.sh
@@ -803,8 +803,10 @@ fi
 # compilation
 if [ -n "$OPTION_RT_DEBUG" ]; then
   OPT_CFLAGS="-g3 -O0 -fno-omit-frame-pointer"
+  OPT_LDFLAGS="-no-pie"
 else
   OPT_CFLAGS="-g -O2"
+  OPT_LDFLAGS=""
 fi
 
 # Gcc and related flags
@@ -837,7 +839,8 @@ if [ "`basename $CC`" = 'clang' ]; then
 fi
 
 CPPFLAGS="$OPTION_CPPFLAGS"
-LDFLAGS="$OPTION_LDFLAGS"
+LDFLAGS="$OPTION_LDFLAGS
+  $OPT_LDFLAGS"
 
 # Dlmalloc
 if [ -n "$OPTION_WITH_DLMALLOC" ]; then
-- 
GitLab