Skip to content

Commit

Permalink
Ensure libgcc_s unwinder is always used on 64-bit Solaris 10+/x86 (PR…
Browse files Browse the repository at this point in the history
… target/59788)

	gcc:
	PR target/59788
	* config/sol2.h (LINK_LIBGCC_MAPFILE_SPEC): Define.
	(LINK_SPEC): Use it for -shared, -shared-libgcc.

	libgcc:
	PR target/59788
	* config/t-slibgcc-sld (libgcc-unwind.map): New target.
	(install-libgcc-unwind-map-forbuild): New target.
	(all): Depend on install-libgcc-unwind-map-forbuild.
	(install-libgcc-unwind-map): New target.
	(install): Depend on install-libgcc-unwind-map.

	gcc/testsuite:
	PR target/59788
	* g++.dg/eh/unwind-direct.C: New test.

	toplevel:
	PR target/59788
	* ltmain.sh (opt_duplicate_compiler_generated_deps): Enable on
	*solaris2*.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207454 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
ro committed Feb 4, 2014
1 parent 743164d commit 48118d0
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 2 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2014-02-04 Rainer Orth <[email protected]>

PR target/59788
* ltmain.sh (opt_duplicate_compiler_generated_deps): Enable on
*solaris2*.

2014-01-21 John David Anglin <[email protected]>

* MAINTAINERS: Update my email address.
Expand Down
6 changes: 6 additions & 0 deletions gcc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2014-02-04 Rainer Orth <[email protected]>

PR target/59788
* config/sol2.h (LINK_LIBGCC_MAPFILE_SPEC): Define.
(LINK_SPEC): Use it for -shared, -shared-libgcc.

2014-02-03 Jan Hubicka <[email protected]>

PR ipa/59882
Expand Down
11 changes: 10 additions & 1 deletion gcc/config/sol2.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,21 @@ along with GCC; see the file COPYING3. If not see
#define RDYNAMIC_SPEC "--export-dynamic"
#endif

#ifndef USE_GLD
/* With Sun ld, use mapfile to enforce direct binding to libgcc_s unwinder. */
#define LINK_LIBGCC_MAPFILE_SPEC \
"%{shared|shared-libgcc:-M %slibgcc-unwind.map}"
#else
/* GNU ld doesn't support direct binding. */
#define LINK_LIBGCC_MAPFILE_SPEC ""
#endif

#undef LINK_SPEC
#define LINK_SPEC \
"%{h*} %{v:-V} \
%{!shared:%{!static:%{rdynamic: " RDYNAMIC_SPEC "}}} \
%{static:-dn -Bstatic} \
%{shared:-G -dy %{!mimpure-text:-z text}} \
%{shared:-G -dy %{!mimpure-text:-z text}} " LINK_LIBGCC_MAPFILE_SPEC " \
%{symbolic:-Bsymbolic -G -dy -z text} \
%(link_arch) \
%{Qy:} %{!Qn:-Qy}"
Expand Down
5 changes: 5 additions & 0 deletions gcc/testsuite/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2014-02-04 Rainer Orth <[email protected]>

PR target/59788
* g++.dg/eh/unwind-direct.C: New test.

2014-02-04 Uros Bizjak <[email protected]>

* lib/tsan-dg.exp (tsan_init): Set trivial testcase
Expand Down
15 changes: 15 additions & 0 deletions gcc/testsuite/g++.dg/eh/unwind-direct.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// PR target/59788
// { dg-do run { target { *-*-solaris2* && { ! gld } } } }
// { dg-options "-Wl,-Bdirect" }

#include <stdexcept>

int
main(void)
{
try
{ throw std::runtime_error( "Catch me if you can!"); }
catch(...)
{ return 0; }
return 1;
}
9 changes: 9 additions & 0 deletions libgcc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
2014-02-04 Rainer Orth <[email protected]>

PR target/59788
* config/t-slibgcc-sld (libgcc-unwind.map): New target.
(install-libgcc-unwind-map-forbuild): New target.
(all): Depend on install-libgcc-unwind-map-forbuild.
(install-libgcc-unwind-map): New target.
(install): Depend on install-libgcc-unwind-map.

2014-02-02 Sandra Loosemore <[email protected]>

* config/nios2/crti.S (_init): Initialize GOT pointer from
Expand Down
23 changes: 23 additions & 0 deletions libgcc/config/t-slibgcc-sld
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,26 @@

SHLIB_LDFLAGS = -Wl,-h,$(SHLIB_SONAME) -Wl,-z,text -Wl,-z,defs \
-Wl,-M,$(SHLIB_MAP)

# Linker mapfile to enforce direct binding to libgcc_s unwinder
# (PR target/59788).
libgcc-unwind.map: libgcc-std.ver
@(echo "{"; \
for f in `grep _Unwind_ $< | sort`; do \
echo " $$f = EXTERN DIRECT;"; \
done; \
echo "};" ) > $@

# Copy libgcc-unwind.map to the place where gcc will look for it at build-time.
install-libgcc-unwind-map-forbuild: libgcc-unwind.map
dest=$(gcc_objdir)/tmp$$$$-$<; \
cp $< $$dest; \
chmod a+r $$dest; \
sh $(srcdir)/../move-if-change $$dest $(gcc_objdir)/$<

all: install-libgcc-unwind-map-forbuild

install-libgcc-unwind-map: libgcc-unwind.map
$(INSTALL_DATA) $< $(DESTDIR)$(slibdir)

install: install-libgcc-unwind-map
2 changes: 1 addition & 1 deletion ltmain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ func_enable_tag ()


case $host in
*cygwin* | *mingw* | *pw32* | *cegcc*)
*cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* )
# don't eliminate duplications in $postdeps and $predeps
opt_duplicate_compiler_generated_deps=:
;;
Expand Down

0 comments on commit 48118d0

Please sign in to comment.