diff mbox series

[AArch64,07/11] Link static libgcc after shared libgcc for -shared-libgcc

Message ID 20180926050355.32746-8-richard.henderson@linaro.org
State New
Headers show
Series LSE atomics out-of-line | expand

Commit Message

Richard Henderson Sept. 26, 2018, 5:03 a.m. UTC
From: Richard Henderson <richard.henderson@linaro.org>

We are about to introduce symbols to libgcc.a that will
not be present in libgcc_s.so.  Most symbols will be
resolved from the shared library first, and only the new
symbols will be pulled from the static library.

	* gcc.c (init_gcc_specs): Include static_name after shared_name.
---
 gcc/gcc.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Joseph Myers Sept. 26, 2018, 4:49 p.m. UTC | #1
On Tue, 25 Sep 2018, rth7680@gmail.com wrote:

> From: Richard Henderson <richard.henderson@linaro.org>
> 
> We are about to introduce symbols to libgcc.a that will
> not be present in libgcc_s.so.  Most symbols will be
> resolved from the shared library first, and only the new
> symbols will be pulled from the static library.

Configurations with this property should be using libgcc's 
config/t-slibgcc-libgcc to make libgcc_s.so into a linker script.  Unless 
you have a configuration needing this but not supporting linker scripts, I 
wouldn't expect driver changes to be needed.

The linker script looks like:

/* GNU ld script
   Use the shared library, but some functions are only in
   the static library.  */
GROUP ( libgcc_s.so.1 -lgcc )
Richard Henderson Sept. 26, 2018, 4:55 p.m. UTC | #2
On 9/26/18 9:49 AM, Joseph Myers wrote:
> On Tue, 25 Sep 2018, rth7680@gmail.com wrote:
> 
>> From: Richard Henderson <richard.henderson@linaro.org>
>>
>> We are about to introduce symbols to libgcc.a that will
>> not be present in libgcc_s.so.  Most symbols will be
>> resolved from the shared library first, and only the new
>> symbols will be pulled from the static library.
> 
> Configurations with this property should be using libgcc's 
> config/t-slibgcc-libgcc to make libgcc_s.so into a linker script.  Unless 
> you have a configuration needing this but not supporting linker scripts, I 
> wouldn't expect driver changes to be needed.
> 
> The linker script looks like:
> 
> /* GNU ld script
>    Use the shared library, but some functions are only in
>    the static library.  */
> GROUP ( libgcc_s.so.1 -lgcc )

Ah.  I had been surprised that we didn't already support this
form of linking, and missed this config fragment.  Will fix.


r~
diff mbox series

Patch

diff --git a/gcc/gcc.c b/gcc/gcc.c
index 264204d7b37..4a7ca691122 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1676,9 +1676,8 @@  init_gcc_specs (struct obstack *obstack, const char *shared_name,
 		static_name, " " LD_AS_NEEDED_OPTION " ",
 		shared_name, " " LD_NO_AS_NEEDED_OPTION
 		"}"
-		"%{shared-libgcc:",
-		shared_name, "%{!shared: ", static_name, "}"
-		"}}"
+		"%{shared-libgcc:", shared_name, " ", static_name, "}"
+		"}"
 #else
   buf = concat ("%{static|static-libgcc:", static_name, " ", eh_name, "}"
 		"%{!static:%{!static-libgcc:"
@@ -1688,11 +1687,11 @@  init_gcc_specs (struct obstack *obstack, const char *shared_name,
 		"}"
 #ifdef LINK_EH_SPEC
 		"%{shared:"
-		"%{shared-libgcc:", shared_name, "}"
+		"%{shared-libgcc:", shared_name, " ", static_name, "}"
 		"%{!shared-libgcc:", static_name, "}"
 		"}"
 #else
-		"%{shared:", shared_name, "}"
+		"%{shared:", shared_name, " ", static_name, "}"
 #endif
 #endif
 		"}}", NULL);