* [build] Default to DWARF 4 on Solaris if linker supports CIEv3
@ 2013-03-19 12:34 Rainer Orth
2013-03-21 11:59 ` Rainer Orth
0 siblings, 1 reply; 2+ messages in thread
From: Rainer Orth @ 2013-03-19 12:34 UTC (permalink / raw)
To: gcc-patches; +Cc: Paolo Bonzini
[-- Attachment #1: Type: text/plain, Size: 871 bytes --]
As described in
Don't use DWARF 4 on Solaris
http://gcc.gnu.org/ml/gcc-patches/2012-05/msg00445.html
the Solaris linker couldn't handle CIEv3 in .eh_frame, so we defaulted
to DWARF 2 on Solaris in any configuration (Sun or GNU ld). This has
changed in Solaris 11.1, where the necessary support was added. The
following patch checks for this and defaults to DWARF 4 if either a
sufficiently recent Sun ld or GNU ld >= 2.16 is used.
Bootstrapped without regressions on i386-pc-solaris2.11 (Solaris 11.1)
with Sun ld and gld 2.23.1, and on i386-pc-solaris2.10 with Sun ld.
Ok for mainline?
Rainer
2013-03-18 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* configure.ac (gcc_cv_ld_eh_frame_ciev3): New test.
* configure: Regenerate.
* config.in: Regenerate.
* config/sol2.c (solaris_override_options): Only enforce DWARF 2
if !HAVE_LD_EH_FRAME_CIEV3.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: sol2-dwarf4.patch --]
[-- Type: text/x-patch, Size: 2375 bytes --]
# HG changeset patch
# Parent 3a306dae3cef5064a01f87c8a575de5e630d3412
Default to DWARF 4 on Solaris if linker supports CIEv3
diff --git a/gcc/config/sol2.c b/gcc/config/sol2.c
--- a/gcc/config/sol2.c
+++ b/gcc/config/sol2.c
@@ -286,8 +286,8 @@ solaris_file_end (void)
void
solaris_override_options (void)
{
- /* Don't emit DWARF3/4 unless specifically selected. Solaris ld cannot
- handle CIE version 3 in .eh_frame. */
- if (!global_options_set.x_dwarf_version)
+ /* Older versions of Solaris ld cannot handle CIE version 3 in .eh_frame.
+ Don't emit DWARF3/4 unless specifically selected if so. */
+ if (!HAVE_LD_EH_FRAME_CIEV3 && !global_options_set.x_dwarf_version)
dwarf_version = 2;
}
diff --git a/gcc/configure.ac b/gcc/configure.ac
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -4335,6 +4335,42 @@ if test x"$gcc_cv_ld_eh_frame_hdr" = xye
fi
AC_MSG_RESULT($gcc_cv_ld_eh_frame_hdr)
+AC_MSG_CHECKING(linker CIEv3 in .eh_frame support)
+gcc_cv_ld_eh_frame_ciev3=no
+if test $in_tree_ld = yes ; then
+ if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2 \
+ && test $in_tree_ld_is_elf = yes; then
+ gcc_cv_ld_eh_frame_ciev3=yes
+ fi
+elif test x$gcc_cv_ld != x; then
+ if echo "$ld_ver" | grep GNU > /dev/null; then
+ gcc_cv_ld_eh_frame_ciev3=yes
+ if test 0"$ld_date" -lt 20040513; then
+ if test -n "$ld_date"; then
+ # If there was date string, but was earlier than 2004-05-13, fail
+ gcc_cv_ld_eh_frame_ciev3=no
+ elif test "$ld_vers_major" -lt 2; then
+ gcc_cv_ld_eh_frame_ciev3=no
+ elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 16; then
+ gcc_cv_ld_eh_frame_ciev3=no
+ fi
+ fi
+ else
+ case "$target" in
+ *-*-solaris2*)
+ # Sun ld added support for CIE v3 in .eh_frame in Solaris 11.1.
+ if test "$ld_vers_major" -gt 1 || test "$ld_vers_minor" -ge 2324; then
+ gcc_cv_ld_eh_frame_ciev3=yes
+ fi
+ ;;
+ esac
+ fi
+fi
+AC_DEFINE_UNQUOTED(HAVE_LD_EH_FRAME_CIEV3,
+ [`if test x"$gcc_cv_ld_eh_frame_ciev3" = xyes; then echo 1; else echo 0; fi`],
+ [Define 0/1 if your linker supports CIE v3 in .eh_frame.])
+AC_MSG_RESULT($gcc_cv_ld_eh_frame_ciev3)
+
AC_MSG_CHECKING(linker position independent executable support)
gcc_cv_ld_pie=no
if test $in_tree_ld = yes ; then
[-- Attachment #3: Type: text/plain, Size: 143 bytes --]
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [build] Default to DWARF 4 on Solaris if linker supports CIEv3
2013-03-19 12:34 [build] Default to DWARF 4 on Solaris if linker supports CIEv3 Rainer Orth
@ 2013-03-21 11:59 ` Rainer Orth
0 siblings, 0 replies; 2+ messages in thread
From: Rainer Orth @ 2013-03-21 11:59 UTC (permalink / raw)
To: gcc-patches; +Cc: Paolo Bonzini
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
> As described in
>
> Don't use DWARF 4 on Solaris
> http://gcc.gnu.org/ml/gcc-patches/2012-05/msg00445.html
>
> the Solaris linker couldn't handle CIEv3 in .eh_frame, so we defaulted
> to DWARF 2 on Solaris in any configuration (Sun or GNU ld). This has
> changed in Solaris 11.1, where the necessary support was added. The
> following patch checks for this and defaults to DWARF 4 if either a
> sufficiently recent Sun ld or GNU ld >= 2.16 is used.
>
> Bootstrapped without regressions on i386-pc-solaris2.11 (Solaris 11.1)
> with Sun ld and gld 2.23.1, and on i386-pc-solaris2.10 with Sun ld.
Given that there were no comments and the patch is purely
Solaris-specific, I've applied it to mainline now.
Rainer
> 2013-03-18 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
>
> * configure.ac (gcc_cv_ld_eh_frame_ciev3): New test.
> * configure: Regenerate.
> * config.in: Regenerate.
> * config/sol2.c (solaris_override_options): Only enforce DWARF 2
> if !HAVE_LD_EH_FRAME_CIEV3.
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-03-21 11:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-19 12:34 [build] Default to DWARF 4 on Solaris if linker supports CIEv3 Rainer Orth
2013-03-21 11:59 ` Rainer Orth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).