Patchwork Use -lgcc in libgcc_so linker script

login
register
mail settings
Submitter Andreas Schwab
Date Sept. 9, 2012, 7:29 p.m.
Message ID <m2ipbn3shl.fsf@igel.home>
Download mbox | patch
Permalink /patch/182646/
State New
Headers show

Comments

Andreas Schwab - Sept. 9, 2012, 7:29 p.m.
The libgcc_s.so linker script (as used by targets using
t-slibgcc-libgcc) refers to libgcc.a, which causes the linker to search
in cwd first, where it might find a completely unrelated libgcc.a
(eg. while building a cross gcc).  Use -lgcc instead so that it is
searched on the library path.

Andreas.

	PR target/46191
	* config/t-slibgcc-libgcc (SHLIB_MAKE_SOLINK): Use -lgcc instead
	of libgcc.a.

---
 libgcc/config/t-slibgcc-libgcc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Ian Taylor - Sept. 10, 2012, 7:19 p.m.
On Sun, Sep 9, 2012 at 12:29 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
>
>         PR target/46191
>         * config/t-slibgcc-libgcc (SHLIB_MAKE_SOLINK): Use -lgcc instead
>         of libgcc.a.

This is OK.

Thanks.

Ian

Patch

diff --git a/libgcc/config/t-slibgcc-libgcc b/libgcc/config/t-slibgcc-libgcc
index ec36b27..0668226 100644
--- a/libgcc/config/t-slibgcc-libgcc
+++ b/libgcc/config/t-slibgcc-libgcc
@@ -25,7 +25,7 @@  SHLIB_MAKE_SOLINK = \
 	(echo "/* GNU ld script"; \
 	 echo "   Use the shared library, but some functions are only in"; \
 	 echo "   the static library.  */"; \
-	 echo "GROUP ( $(SHLIB_SONAME) libgcc.a )" \
+	 echo "GROUP ( $(SHLIB_SONAME) -lgcc )" \
 	) > $(SHLIB_DIR)/$(SHLIB_SOLINK)
 SHLIB_INSTALL_SOLINK = \
 	$(INSTALL_DATA) $(SHLIB_DIR)/$(SHLIB_SOLINK) \