Patchwork PATCH: PR debug/54568: --eh-frame-hdr should also be enabled for static executable

login
register
mail settings
Submitter H.J. Lu
Date Aug. 7, 2013, 5:58 p.m.
Message ID <CAMe9rOpBYOXOYi7xDQKJmZOmWT7ZN-1DY0qZPwBVUnjKPX+jwQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/265589/
State New
Headers show

Comments

H.J. Lu - Aug. 7, 2013, 5:58 p.m.
On Thu, Sep 13, 2012 at 7:46 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> Hi,
>
> There is no reason why --eh-frame-hdr can't be used with static
> executable on Linux.  This patch enables --eh-frame-hdr for static
> executable on Linux and adds an exception test for static executable.
> Other platforms may also work correctly.  But I can't verify it.
>

It looks like we don't want to use  --eh-frame-hdr for -static for
backward compatibility.  Here is a patch to only use it for Android
where we have no compatibility issue.  OK to install?

Thanks.

H.J.
---
2013-08-07  H.J. Lu  <hongjiu.lu@intel.com>

    PR debug/54568
    * config/gnu-user.h (LINK_EH_SPEC): Renamed to ...
    (GNU_USER_TARGET_LINK_EH_SPEC): This.
    (LINK_EH_SPEC): Defined as GNU_USER_TARGET_LINK_EH_SPEC.
    * config/linux-android.h (ANDROID_LINK_EH_SPEC): New.
    * config/i386/linux-common.h (LINK_EH_SPEC): Likewise.

Patch

diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
index 2c48c18..39e5608 100644
--- a/gcc/config/gnu-user.h
+++ b/gcc/config/gnu-user.h
@@ -90,7 +90,8 @@  see the files COPYING3 and COPYING.RUNTIME respectively.  If n
ot, see
 #define LIB_SPEC GNU_USER_TARGET_LIB_SPEC

 #if defined(HAVE_LD_EH_FRAME_HDR)
-#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+#define GNU_USER_TARGET_LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+#define LINK_EH_SPEC GNU_USER_TARGET_LINK_EH_SPEC
 #endif

 #undef LINK_GCC_C_SEQUENCE_SPEC
diff --git a/gcc/config/i386/linux-common.h b/gcc/config/i386/linux-common.h
index 1e8bf6b..157bf022 100644
--- a/gcc/config/i386/linux-common.h
+++ b/gcc/config/i386/linux-common.h
@@ -37,6 +37,13 @@  along with GCC; see the file COPYING3.  If not see
   LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LINK_SPEC, \
                GNU_USER_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)

+#ifdef GNU_USER_TARGET_LINK_EH_SPEC
+#undef    LINK_EH_SPEC
+#define LINK_EH_SPEC \
+  LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LINK_EH_SPEC, \
+               ANDROID_LINK_EH_SPEC) " "
+#endif
+
 #undef  LIB_SPEC
 #define LIB_SPEC \
   LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LIB_SPEC, \
diff --git a/gcc/config/linux-android.h b/gcc/config/linux-android.h
index 831a19c..6c172ab 100644
--- a/gcc/config/linux-android.h
+++ b/gcc/config/linux-android.h
@@ -40,6 +40,9 @@ 
 #define ANDROID_LINK_SPEC \
   "%{shared: -Bsymbolic}"

+#define ANDROID_LINK_EH_SPEC \
+  "--eh-frame-hdr "
+
 #define ANDROID_CC1_SPEC                        \
   "%{!mglibc:%{!muclibc:%{!mbionic: -mbionic}}} "            \
   "%{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: -fPIC}}}}"