public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [patch RFC] --as-needed and --add-needed for linker script
@ 2006-04-07  0:40 Kaz Kojima
  2006-04-07  6:44 ` Alan Modra
  0 siblings, 1 reply; 2+ messages in thread
From: Kaz Kojima @ 2006-04-07  0:40 UTC (permalink / raw)
  To: binutils

Hi,

With the current ld, --as-needed seems not work for linker
scripts:
  http://sourceware.org/ml/binutils/2006-03/msg00356.html

It seems that --add-needed also doesn't work for the linker
scripts.  How does the attached patch look?  It sets the global
as_needed and add_needed flags to their corresponding fields
for the linker script while that script is processing.
It's tested on i686-pc-linux-gnu and sh4-unknown-linux-gnu
with no new failures.

Regards,
	kaz
--
ld/ChangeLog
2006-04-06  Kaz Kojima  <kkojima@rr.iij4u.or.jp>

	* ldlang.c (load_symbols): Set as_needed and add_needed according
	to the corresponding script's fields while processing it.

diff -uprN ORIG/src/ld/ldlang.c LOCAL/src/ld/ldlang.c
--- ORIG/src/ld/ldlang.c	2006-04-04 17:52:21.000000000 +0900
+++ LOCAL/src/ld/ldlang.c	2006-04-06 10:18:42.000000000 +0900
@@ -2323,6 +2323,7 @@ load_symbols (lang_input_statement_type 
       lang_statement_list_type *hold;
       bfd_boolean bad_load = TRUE;
       bfd_boolean save_ldlang_sysrooted_script;
+      bfd_boolean save_as_needed, save_add_needed;
 
       err = bfd_get_error ();
 
@@ -2356,6 +2357,10 @@ load_symbols (lang_input_statement_type 
       stat_ptr = place;
       save_ldlang_sysrooted_script = ldlang_sysrooted_script;
       ldlang_sysrooted_script = entry->sysrooted;
+      save_as_needed = as_needed;
+      as_needed = entry->as_needed;
+      save_add_needed = add_needed;
+      add_needed = entry->add_needed;
 
       ldfile_assumed_script = TRUE;
       parser_input = input_script;
@@ -2366,6 +2371,8 @@ load_symbols (lang_input_statement_type 
       ldfile_assumed_script = FALSE;
 
       ldlang_sysrooted_script = save_ldlang_sysrooted_script;
+      as_needed = save_as_needed;
+      add_needed = save_add_needed;
       stat_ptr = hold;
 
       return ! bad_load;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch RFC] --as-needed and --add-needed for linker script
  2006-04-07  0:40 [patch RFC] --as-needed and --add-needed for linker script Kaz Kojima
@ 2006-04-07  6:44 ` Alan Modra
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2006-04-07  6:44 UTC (permalink / raw)
  To: Kaz Kojima; +Cc: binutils

On Fri, Apr 07, 2006 at 08:35:17AM +0900, Kaz Kojima wrote:
> 	* ldlang.c (load_symbols): Set as_needed and add_needed according
> 	to the corresponding script's fields while processing it.

OK.  Looks good to me.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-04-07  6:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-07  0:40 [patch RFC] --as-needed and --add-needed for linker script Kaz Kojima
2006-04-07  6:44 ` Alan Modra

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).