This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

whole-archive with linker script


The behavior of --whole-archive for archive input files in a linker script does not match the behavior on the command line. For example:

$ gcc -c foo.c -fpic
$ ar rc libfooS.a foo.o
$ ld -shared -o libshared.so --whole-archive libfooS.a --no-whole-archive
$ nm libshared.so | grep foo
0000014c T foo
$ cat libs.txt
INPUT(libfoo.a)
$ ld -shared -o libshared.so --whole-archive libs.txt --no-whole-archive
$ nm libshared.so | grep foo


2009-10-12 Ryan Mansfield <rmansfield@qnx.com>


        * ldlang.c (load_symbols): Use same --whole-archive as the one
        specified for ENTRY.

*** ldlang.c    9 Oct 2009 05:19:37 -0000       1.323
--- ldlang.c    13 Oct 2009 17:08:37 -0000
*************** load_symbols (lang_input_statement_type
*** 2592,2598 ****
      {
        bfd_error_type err;
        bfd_boolean save_ldlang_sysrooted_script;
!       bfd_boolean save_as_needed, save_add_needed;

err = bfd_get_error ();

--- 2592,2598 ----
      {
        bfd_error_type err;
        bfd_boolean save_ldlang_sysrooted_script;
!       bfd_boolean save_as_needed, save_add_needed, save_whole_archive;

err = bfd_get_error ();

*************** load_symbols (lang_input_statement_type
*** 2627,2632 ****
--- 2627,2634 ----
        as_needed = entry->as_needed;
        save_add_needed = add_needed;
        add_needed = entry->add_needed;
+       save_whole_archive = whole_archive;
+       whole_archive = entry->whole_archive;

        ldfile_assumed_script = TRUE;
        parser_input = input_script;
*************** load_symbols (lang_input_statement_type
*** 2639,2644 ****
--- 2641,2647 ----
        ldlang_sysrooted_script = save_ldlang_sysrooted_script;
        as_needed = save_as_needed;
        add_needed = save_add_needed;
+       whole_archive = save_whole_archive;
        pop_stat_ptr ();

return TRUE;

OK?

Regards,

Ryan Mansfield


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]