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]

RFC: Rename --add-needed to --copy-dt-needed-entries


Hi Guys,

  In Fedora-land we are thinking about adding --no-add-needed to the
  gcc command line when building all of the packages in order to force
  the packages to specifically mention all the dynamic libraries that
  they need.  As a prologue to this it has been suggested that it
  would be a good idea to rename the --add-needed option to something
  else as it is confusingly similar to the --as-needed option.

  So attached is a patch to rename --add-needed to
  --copy-dt-needed-entries.  (Of course --add-needed is still supported
  as a deprecated option).  The patch also updates the linker
  documentation to mention the affect of the --copy-dt-needed-entries
  option on the resolution of symbols in dynamic libraries.  (It is
  this effect which we anticipate will be the biggest hurdle to the
  acceptance of --no-copy-dt-needed-entries in Fedora-land).

  Any comments or criticisms ?

Cheers
  Nick

ld/ChangeLog
2009-10-28  Nick Clifton  <nickc@redhat.com>

	* lexsup.c: Rename --add-needed to --copy-dt-needed-entries.
	* ldlang.h (struct lang_input_statement_struct): Rename add_needed
	to add_DT_NEEDED_for_dynamic.  Rename as_needed to
	add_DT_NEEDED_for_regular.
	* ldlang.c: Likewise.
	* ldlang.h: Likewise.
	* ldlang.c: Use the new variable names.
	* ldgram.y: Likewise.
	* emultempl/elf32.em: Likewise.
	* ld.texinfo: Document the renamed option.  Also mention its
	affect on the resolution of dynamic symbols.
	* NEWS: Mention the changed option name.

Index: ld/NEWS
===================================================================
RCS file: /cvs/src/src/ld/NEWS,v
retrieving revision 1.110
diff -c -3 -p -r1.110 NEWS
*** ld/NEWS	23 Oct 2009 11:40:16 -0000	1.110
--- ld/NEWS	28 Oct 2009 17:03:00 -0000
***************
*** 1,5 ****
--- 1,8 ----
  -*- text -*-
  
+ * --add-needed renamed to --copy-dt-needed-entries in order to avoid confusion
+   with --as-needed option.
+ 
  * Extend .def file syntax by '== <ID>' for imports and exports. This allows
    to alias the import/export table name written in PE image.
  
Index: ld/ld.texinfo
===================================================================
RCS file: /cvs/src/src/ld/ld.texinfo,v
retrieving revision 1.252
diff -c -3 -p -r1.252 ld.texinfo
*** ld/ld.texinfo	23 Oct 2009 11:40:17 -0000	1.252
--- ld/ld.texinfo	28 Oct 2009 17:03:04 -0000
*************** restore the old behaviour.
*** 1132,1158 ****
  @item --as-needed
  @itemx --no-as-needed
  This option affects ELF DT_NEEDED tags for dynamic libraries mentioned
! on the command line after the @option{--as-needed} option.  Normally,
  the linker will add a DT_NEEDED tag for each dynamic library mentioned
  on the command line, regardless of whether the library is actually
! needed.  @option{--as-needed} causes a DT_NEEDED tag to only be emitted
! for a library that satisfies a symbol reference from regular objects
! which is undefined at the point that the library was linked, or, if
! the library is not found in the DT_NEEDED lists of other libraries
! linked up to that point, a reference from another dynamic library.
  @option{--no-as-needed} restores the default behaviour.
  
  @kindex --add-needed
  @kindex --no-add-needed
  @item --add-needed
  @itemx --no-add-needed
! This option affects the treatment of dynamic libraries from ELF
! DT_NEEDED tags in dynamic libraries mentioned on the command line after
! the @option{--no-add-needed} option.  Normally, the linker will add
! a DT_NEEDED tag for each dynamic library from DT_NEEDED tags.
! @option{--no-add-needed} causes DT_NEEDED tags will never be emitted
! for those libraries from DT_NEEDED tags. @option{--add-needed} restores
! the default behaviour.
  
  @kindex -assert @var{keyword}
  @item -assert @var{keyword}
--- 1132,1155 ----
  @item --as-needed
  @itemx --no-as-needed
  This option affects ELF DT_NEEDED tags for dynamic libraries mentioned
! on the command line after the @option{--as-needed} option.  Normally
  the linker will add a DT_NEEDED tag for each dynamic library mentioned
  on the command line, regardless of whether the library is actually
! needed or not.  @option{--as-needed} causes a DT_NEEDED tag to only be
! emitted for a library that satisfies an undefined symbol reference
! from a regular object file or, if the library is not found in the
! DT_NEEDED lists of other libraries linked up to that point, an
! undefined symbol reference from another dynamic library.
  @option{--no-as-needed} restores the default behaviour.
  
  @kindex --add-needed
  @kindex --no-add-needed
  @item --add-needed
  @itemx --no-add-needed
! These two options have been deprecated because of the similarity of
! their names to the @option{--as-needed} and @option{--no-as-needed}
! options.  They have been replaced by @option{--copy-dt-needed-entries}
! and @option{--no-copy-dt-needed-entries}.
  
  @kindex -assert @var{keyword}
  @item -assert @var{keyword}
*************** Section overlap is not usually checked f
*** 1253,1258 ****
--- 1250,1278 ----
  force checking in that case by using the @option{--check-sections}
  option.
  
+ @kindex --copy-dt-needed-entries
+ @kindex --no-copy-dt-needed-entries
+ @item --copy-dt-needed-entries
+ @itemx --no-copy-dt-needed-entries
+ This option affects the treatment of dynamic libraries referred to 
+ by DT_NEEDED tags @emph{inside} ELF dynamic libraries mentioned on the
+ command line.  Normally the linker will add a DT_NEEDED tag to the
+ output binary for each library mentioned in a DT_NEEDED tag in an
+ input dynamic library.  With @option{--no-copy-dt-needed-entries}
+ specified on the command line however any dynamic libraries that
+ follow it will have their DT_NEEDED entries ignored.  The default
+ behaviour can be restored with @option{--copy-dt-needed-entries}.
+ 
+ This option also has an effect on the resolution of symbols in dynamic
+ libraries.  With the default setting dynamic libraries mentioned on
+ the command line will be recursively searched, following their
+ DT_NEEDED tags to other libraries, in order to resolve symbols
+ required by the output binary.  With
+ @option{--no-copy-dt-needed-entries} specified however the searching
+ of dynamic libraries that follow it will stop with the dynamic
+ library itself.  No DT_NEEDED links will be traversed to resolve
+ symbols.
+ 
  @cindex cross reference table
  @kindex --cref
  @item --cref
Index: ld/ldgram.y
===================================================================
RCS file: /cvs/src/src/ld/ldgram.y,v
retrieving revision 1.60
diff -c -3 -p -r1.60 ldgram.y
*** ld/ldgram.y	2 Sep 2009 07:25:35 -0000	1.60
--- ld/ldgram.y	28 Oct 2009 17:03:04 -0000
*************** input_list:
*** 378,394 ****
  		{ lang_add_input_file($2,lang_input_file_is_l_enum,
  				 (char *)NULL); }
  	|	AS_NEEDED '('
! 		  { $<integer>$ = as_needed; as_needed = TRUE; }
  		     input_list ')'
! 		  { as_needed = $<integer>3; }
  	|	input_list ',' AS_NEEDED '('
! 		  { $<integer>$ = as_needed; as_needed = TRUE; }
  		     input_list ')'
! 		  { as_needed = $<integer>5; }
  	|	input_list AS_NEEDED '('
! 		  { $<integer>$ = as_needed; as_needed = TRUE; }
  		     input_list ')'
! 		  { as_needed = $<integer>4; }
  	;
  
  sections:
--- 378,394 ----
  		{ lang_add_input_file($2,lang_input_file_is_l_enum,
  				 (char *)NULL); }
  	|	AS_NEEDED '('
! 		  { $<integer>$ = add_DT_NEEDED_for_regular; add_DT_NEEDED_for_regular = TRUE; }
  		     input_list ')'
! 		  { add_DT_NEEDED_for_regular = $<integer>3; }
  	|	input_list ',' AS_NEEDED '('
! 		  { $<integer>$ = add_DT_NEEDED_for_regular; add_DT_NEEDED_for_regular = TRUE; }
  		     input_list ')'
! 		  { add_DT_NEEDED_for_regular = $<integer>5; }
  	|	input_list AS_NEEDED '('
! 		  { $<integer>$ = add_DT_NEEDED_for_regular; add_DT_NEEDED_for_regular = TRUE; }
  		     input_list ')'
! 		  { add_DT_NEEDED_for_regular = $<integer>4; }
  	;
  
  sections:
Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.324
diff -c -3 -p -r1.324 ldlang.c
*** ld/ldlang.c	14 Oct 2009 01:48:53 -0000	1.324
--- ld/ldlang.c	28 Oct 2009 17:03:07 -0000
*************** new_afile (const char *name,
*** 1056,1063 ****
    p->next_real_file = NULL;
    p->next = NULL;
    p->dynamic = config.dynamic_link;
!   p->add_needed = add_needed;
!   p->as_needed = as_needed;
    p->whole_archive = whole_archive;
    p->loaded = FALSE;
    lang_statement_append (&input_file_chain,
--- 1056,1063 ----
    p->next_real_file = NULL;
    p->next = NULL;
    p->dynamic = config.dynamic_link;
!   p->add_DT_NEEDED_for_dynamic = add_DT_NEEDED_for_dynamic;
!   p->add_DT_NEEDED_for_regular = add_DT_NEEDED_for_regular;
    p->whole_archive = whole_archive;
    p->loaded = FALSE;
    lang_statement_append (&input_file_chain,
*************** 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, save_whole_archive;
  
        err = bfd_get_error ();
  
--- 2592,2600 ----
      {
        bfd_error_type err;
        bfd_boolean save_ldlang_sysrooted_script;
!       bfd_boolean save_add_DT_NEEDED_for_regular;
!       bfd_boolean save_add_DT_NEEDED_for_dynamic;
!       bfd_boolean save_whole_archive;
  
        err = bfd_get_error ();
  
*************** load_symbols (lang_input_statement_type 
*** 2623,2632 ****
        push_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;
        save_whole_archive = whole_archive;
        whole_archive = entry->whole_archive;
  
--- 2625,2634 ----
        push_stat_ptr (place);
        save_ldlang_sysrooted_script = ldlang_sysrooted_script;
        ldlang_sysrooted_script = entry->sysrooted;
!       save_add_DT_NEEDED_for_regular = add_DT_NEEDED_for_regular;
!       add_DT_NEEDED_for_regular = entry->add_DT_NEEDED_for_regular;
!       save_add_DT_NEEDED_for_dynamic = add_DT_NEEDED_for_dynamic;
!       add_DT_NEEDED_for_dynamic = entry->add_DT_NEEDED_for_dynamic;
        save_whole_archive = whole_archive;
        whole_archive = entry->whole_archive;
  
*************** load_symbols (lang_input_statement_type 
*** 2639,2646 ****
        ldfile_assumed_script = FALSE;
  
        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 ();
  
--- 2641,2648 ----
        ldfile_assumed_script = FALSE;
  
        ldlang_sysrooted_script = save_ldlang_sysrooted_script;
!       add_DT_NEEDED_for_regular = save_add_DT_NEEDED_for_regular;
!       add_DT_NEEDED_for_dynamic = save_add_DT_NEEDED_for_dynamic;
        whole_archive = save_whole_archive;
        pop_stat_ptr ();
  
Index: ld/ldlang.h
===================================================================
RCS file: /cvs/src/src/ld/ldlang.h,v
retrieving revision 1.86
diff -c -3 -p -r1.86 ldlang.h
*** ld/ldlang.h	11 Sep 2009 15:27:35 -0000	1.86
--- ld/ldlang.h	28 Oct 2009 17:03:07 -0000
*************** typedef struct lang_input_statement_stru
*** 270,280 ****
  
    /* Whether DT_NEEDED tags should be added for dynamic libraries in
       DT_NEEDED tags from this entry.  */
!   unsigned int add_needed : 1;
  
    /* Whether this entry should cause a DT_NEEDED tag only when
       satisfying references from regular files, or always.  */
!   unsigned int as_needed : 1;
  
    /* Whether to include the entire contents of an archive.  */
    unsigned int whole_archive : 1;
--- 270,280 ----
  
    /* Whether DT_NEEDED tags should be added for dynamic libraries in
       DT_NEEDED tags from this entry.  */
!   unsigned int add_DT_NEEDED_for_dynamic : 1;
  
    /* Whether this entry should cause a DT_NEEDED tag only when
       satisfying references from regular files, or always.  */
!   unsigned int add_DT_NEEDED_for_regular : 1;
  
    /* Whether to include the entire contents of an archive.  */
    unsigned int whole_archive : 1;
Index: ld/ldmain.c
===================================================================
RCS file: /cvs/src/src/ld/ldmain.c,v
retrieving revision 1.139
diff -c -3 -p -r1.139 ldmain.c
*** ld/ldmain.c	11 Sep 2009 15:27:35 -0000	1.139
--- ld/ldmain.c	28 Oct 2009 17:03:08 -0000
*************** bfd_boolean version_printed;
*** 93,105 ****
  /* Nonzero means link in every member of an archive.  */
  bfd_boolean whole_archive;
  
! /* Nonzero means create DT_NEEDED entries only if a dynamic library
!    actually satisfies some reference in a regular object.  */
! bfd_boolean as_needed;
! 
! /* Nonzero means never create DT_NEEDED entries for dynamic libraries
!    in DT_NEEDED tags.  */
! bfd_boolean add_needed = TRUE;
  
  /* TRUE if we should demangle symbol names.  */
  bfd_boolean demangling;
--- 93,106 ----
  /* Nonzero means link in every member of an archive.  */
  bfd_boolean whole_archive;
  
! /* True means only create DT_NEEDED entries for dynamic libraries
!    if they actually satisfy some reference in a regular object.  */
! bfd_boolean add_DT_NEEDED_for_regular;
! 
! /* True means create DT_NEEDED entries for dynamic libraries that
!    are DT_NEEDED by dynamic libraries specifically mentioned on
!    the command line.  */
! bfd_boolean add_DT_NEEDED_for_dynamic;
  
  /* TRUE if we should demangle symbol names.  */
  bfd_boolean demangling;
Index: ld/ldmain.h
===================================================================
RCS file: /cvs/src/src/ld/ldmain.h,v
retrieving revision 1.15
diff -c -3 -p -r1.15 ldmain.h
*** ld/ldmain.h	15 Feb 2008 03:35:53 -0000	1.15
--- ld/ldmain.h	28 Oct 2009 17:03:08 -0000
***************
*** 1,6 ****
  /* ldmain.h -
     Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2002, 2003, 2004,
!    2005, 2007, 2008 Free Software Foundation, Inc.
  
     This file is part of the GNU Binutils.
  
--- 1,6 ----
  /* ldmain.h -
     Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2002, 2003, 2004,
!    2005, 2007, 2008, 2009 Free Software Foundation, Inc.
  
     This file is part of the GNU Binutils.
  
*************** extern bfd_boolean trace_files;
*** 34,41 ****
  extern bfd_boolean trace_file_tries;
  extern bfd_boolean version_printed;
  extern bfd_boolean whole_archive;
! extern bfd_boolean as_needed;
! extern bfd_boolean add_needed;
  extern bfd_boolean demangling;
  extern int g_switch_value;
  extern const char *output_filename;
--- 34,41 ----
  extern bfd_boolean trace_file_tries;
  extern bfd_boolean version_printed;
  extern bfd_boolean whole_archive;
! extern bfd_boolean add_DT_NEEDED_for_regular;
! extern bfd_boolean add_DT_NEEDED_for_dynamic;
  extern bfd_boolean demangling;
  extern int g_switch_value;
  extern const char *output_filename;
Index: ld/lexsup.c
===================================================================
RCS file: /cvs/src/src/ld/lexsup.c,v
retrieving revision 1.115
diff -c -3 -p -r1.115 lexsup.c
*** ld/lexsup.c	13 Sep 2009 07:19:18 -0000	1.115
--- ld/lexsup.c	28 Oct 2009 17:03:08 -0000
*************** enum option_values
*** 125,134 ****
    OPTION_SPLIT_BY_RELOC,
    OPTION_SPLIT_BY_FILE ,
    OPTION_WHOLE_ARCHIVE,
!   OPTION_ADD_NEEDED,
!   OPTION_NO_ADD_NEEDED,
!   OPTION_AS_NEEDED,
!   OPTION_NO_AS_NEEDED,
    OPTION_WRAP,
    OPTION_FORCE_EXE_SUFFIX,
    OPTION_GC_SECTIONS,
--- 125,134 ----
    OPTION_SPLIT_BY_RELOC,
    OPTION_SPLIT_BY_FILE ,
    OPTION_WHOLE_ARCHIVE,
!   OPTION_ADD_DT_NEEDED_FOR_DYNAMIC,
!   OPTION_NO_ADD_DT_NEEDED_FOR_DYNAMIC,
!   OPTION_ADD_DT_NEEDED_FOR_REGULAR,
!   OPTION_NO_ADD_DT_NEEDED_FOR_REGULAR,
    OPTION_WRAP,
    OPTION_FORCE_EXE_SUFFIX,
    OPTION_GC_SECTIONS,
*************** static const struct ld_option ld_options
*** 333,351 ****
       OPTION_NO_ACCEPT_UNKNOWN_INPUT_ARCH},
      '\0', NULL, N_("Reject input files whose architecture is unknown"),
      TWO_DASHES },
!   { {"add-needed", no_argument, NULL, OPTION_ADD_NEEDED},
!     '\0', NULL, N_("Set DT_NEEDED tags for DT_NEEDED entries in\n"
! 		   "                                following dynamic libs"),
!     TWO_DASHES },
!   { {"no-add-needed", no_argument, NULL, OPTION_NO_ADD_NEEDED},
!     '\0', NULL, N_("Do not set DT_NEEDED tags for DT_NEEDED entries\n"
! 		   "                                in following dynamic libs"),
!     TWO_DASHES },
!   { {"as-needed", no_argument, NULL, OPTION_AS_NEEDED},
      '\0', NULL, N_("Only set DT_NEEDED for following dynamic libs if used"),
      TWO_DASHES },
!   { {"no-as-needed", no_argument, NULL, OPTION_NO_AS_NEEDED},
!     '\0', NULL, N_("Always set DT_NEEDED for following dynamic libs"),
      TWO_DASHES },
    { {"assert", required_argument, NULL, OPTION_ASSERT},
      '\0', N_("KEYWORD"), N_("Ignored for SunOS compatibility"), ONE_DASH },
--- 333,354 ----
       OPTION_NO_ACCEPT_UNKNOWN_INPUT_ARCH},
      '\0', NULL, N_("Reject input files whose architecture is unknown"),
      TWO_DASHES },
! 
!   /* The next two options are deprecated because of their similarity to
!      --as-needed and --no-as-needed.  They have been replaced by
!      --resolve-implicit-dynamic-symbols and
!      --no-resolve-implicit-dynamic-symbols.  */
!   { {"add-needed", no_argument, NULL, OPTION_ADD_DT_NEEDED_FOR_DYNAMIC},
!     '\0', NULL, NULL, NO_HELP },
!   { {"no-add-needed", no_argument, NULL, OPTION_NO_ADD_DT_NEEDED_FOR_DYNAMIC},
!     '\0', NULL, NULL, NO_HELP },
! 
!   { {"as-needed", no_argument, NULL, OPTION_ADD_DT_NEEDED_FOR_REGULAR},
      '\0', NULL, N_("Only set DT_NEEDED for following dynamic libs if used"),
      TWO_DASHES },
!   { {"no-as-needed", no_argument, NULL, OPTION_NO_ADD_DT_NEEDED_FOR_REGULAR},
!     '\0', NULL, N_("Always set DT_NEEDED for dynamic libraries mentioned on\n"
! 		   "                                the command line"),
      TWO_DASHES },
    { {"assert", required_argument, NULL, OPTION_ASSERT},
      '\0', N_("KEYWORD"), N_("Ignored for SunOS compatibility"), ONE_DASH },
*************** static const struct ld_option ld_options
*** 373,378 ****
--- 376,390 ----
    { {"no-check-sections", no_argument, NULL, OPTION_NO_CHECK_SECTIONS},
      '\0', NULL, N_("Do not check section addresses for overlaps"),
      TWO_DASHES },
+   { {"copy-dt-needed-entries", no_argument, NULL,
+      OPTION_ADD_DT_NEEDED_FOR_DYNAMIC},
+     '\0', NULL, N_("Copy DT_NEEDED links mentioned inside DSOs that follow"),
+     TWO_DASHES },
+   { {"no-copy-dt-needed-entries", no_argument, NULL,
+      OPTION_NO_ADD_DT_NEEDED_FOR_DYNAMIC},
+     '\0', NULL, N_("Do not copy DT_NEEDED links mentioned inside DSOs that follow"),
+     TWO_DASHES },
+ 
    { {"cref", no_argument, NULL, OPTION_CREF},
      '\0', NULL, N_("Output cross reference table"), TWO_DASHES },
    { {"defsym", required_argument, NULL, OPTION_DEFSYM},
*************** parse_args (unsigned argc, char **argv)
*** 1379,1395 ****
  	case OPTION_WHOLE_ARCHIVE:
  	  whole_archive = TRUE;
  	  break;
! 	case OPTION_ADD_NEEDED:
! 	  add_needed = TRUE;
  	  break;
! 	case OPTION_NO_ADD_NEEDED:
! 	  add_needed = FALSE;
  	  break;
! 	case OPTION_AS_NEEDED:
! 	  as_needed = TRUE;
  	  break;
! 	case OPTION_NO_AS_NEEDED:
! 	  as_needed = FALSE;
  	  break;
  	case OPTION_WRAP:
  	  add_wrap (optarg);
--- 1391,1407 ----
  	case OPTION_WHOLE_ARCHIVE:
  	  whole_archive = TRUE;
  	  break;
! 	case OPTION_ADD_DT_NEEDED_FOR_DYNAMIC:
! 	  add_DT_NEEDED_for_dynamic = TRUE;
  	  break;
! 	case OPTION_NO_ADD_DT_NEEDED_FOR_DYNAMIC:
! 	  add_DT_NEEDED_for_dynamic = FALSE;
  	  break;
! 	case OPTION_ADD_DT_NEEDED_FOR_REGULAR:
! 	  add_DT_NEEDED_for_regular = TRUE;
  	  break;
! 	case OPTION_NO_ADD_DT_NEEDED_FOR_REGULAR:
! 	  add_DT_NEEDED_for_regular = FALSE;
  	  break;
  	case OPTION_WRAP:
  	  add_wrap (optarg);
Index: ld/emultempl/elf32.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/elf32.em,v
retrieving revision 1.205
diff -c -3 -p -r1.205 elf32.em
*** ld/emultempl/elf32.em	23 Oct 2009 01:21:12 -0000	1.205
--- ld/emultempl/elf32.em	28 Oct 2009 17:03:09 -0000
*************** fi
*** 110,116 ****
  
  if test x"$LDEMUL_RECOGNIZED_FILE" != xgld"${EMULATION_NAME}"_load_symbols; then
  fragment <<EOF
! /* Handle as_needed DT_NEEDED.  */
  
  static bfd_boolean
  gld${EMULATION_NAME}_load_symbols (lang_input_statement_type *entry)
--- 110,116 ----
  
  if test x"$LDEMUL_RECOGNIZED_FILE" != xgld"${EMULATION_NAME}"_load_symbols; then
  fragment <<EOF
! /* Handle the generation of DT_NEEDED tags.  */
  
  static bfd_boolean
  gld${EMULATION_NAME}_load_symbols (lang_input_statement_type *entry)
*************** gld${EMULATION_NAME}_load_symbols (lang_
*** 120,132 ****
    /* Tell the ELF linker that we don't want the output file to have a
       DT_NEEDED entry for this file, unless it is used to resolve
       references in a regular object.  */
!   if (entry->as_needed)
      link_class = DYN_AS_NEEDED;
  
    /* Tell the ELF linker that we don't want the output file to have a
       DT_NEEDED entry for any dynamic library in DT_NEEDED tags from
       this file at all.  */
!   if (!entry->add_needed)
      link_class |= DYN_NO_ADD_NEEDED;
  
    if (entry->just_syms_flag
--- 120,132 ----
    /* Tell the ELF linker that we don't want the output file to have a
       DT_NEEDED entry for this file, unless it is used to resolve
       references in a regular object.  */
!   if (entry->add_DT_NEEDED_for_regular)
      link_class = DYN_AS_NEEDED;
  
    /* Tell the ELF linker that we don't want the output file to have a
       DT_NEEDED entry for any dynamic library in DT_NEEDED tags from
       this file at all.  */
!   if (!entry->add_DT_NEEDED_for_dynamic)
      link_class |= DYN_NO_ADD_NEEDED;
  
    if (entry->just_syms_flag
*************** gld${EMULATION_NAME}_load_symbols (lang_
*** 134,140 ****
      einfo (_("%P%F: --just-symbols may not be used on DSO: %B\n"),
  	   entry->the_bfd);
  
!   if (!link_class
        || (bfd_get_file_flags (entry->the_bfd) & DYNAMIC) == 0)
      return FALSE;
  
--- 134,140 ----
      einfo (_("%P%F: --just-symbols may not be used on DSO: %B\n"),
  	   entry->the_bfd);
  
!   if (link_class == 0
        || (bfd_get_file_flags (entry->the_bfd) & DYNAMIC) == 0)
      return FALSE;
  

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