-static -lfoo -dynamic -lbar

H.J. Lu hjl@nynexst.com
Tue May 2 00:05:00 GMT 1995


> 
> 
> >> 
> >
> >I will implement it if noone does and I have the time. First we
> >have to agree on what syntax to use. -Bstatic/-Bdynamic or
> >-static/-dynamic?
> >
> >
> >-- 
> >H.J. Lu
> >NYNEX Science and Technology, Inc.			hjl@nynexst.com
> 
> Thanks...if you understand how gcc is organized  (I looked at this
> in 1.x and saw it was a lot to understand).
> 

gcc/gnu getopt liks to reorder options and I cannot use -dynamic
nor -Bxxxxx. You have to use -Wl,-xxxxxx for the time being.

> This should be trivial...Use -static/-dynamic [does gnu ld understand 
> this?]
> 

No. Use -Bstatic/-Bdynamic.

> (its not trivial to even see if ld works this way ;-( )
> 

Try this one on top of binutils 2.5.2l.11. I have included this
in binutils 2.5.2l.12. You have to use:

# gcc -v foo.o -Wl,-Bstatic -lm -Wl,-Bdynamic 

Please let me know if it works for you. BTW, it may work with
the current snapshot.


-- 
H.J. Lu
NYNEX Science and Technology, Inc.			hjl@nynexst.com
----
RCS file: /home/cvs/gnu/binutils/ld/ldfile.c,v
retrieving revision 1.5
diff -c -r1.5 ldfile.c
*** 1.5	1995/04/27 03:24:16
--- ldfile.c	1995/05/02 06:45:45
***************
*** 183,189 ****
  	   arch != (search_arch_type *) NULL;
  	   arch = arch->next)
  	{
! 	  if (config.dynamic_link)
  	    {
  	      if (ldemul_open_dynamic_archive (arch->name, entry))
  		return;
--- 183,189 ----
  	   arch != (search_arch_type *) NULL;
  	   arch = arch->next)
  	{
! 	  if (entry->dynamic_link)
  	    {
  	      if (ldemul_open_dynamic_archive (arch->name, entry))
  		return;
===================================================================
RCS file: /home/cvs/gnu/binutils/ld/ldlang.h,v
retrieving revision 1.1.1.2
diff -c -r1.1.1.2 ldlang.h
*** 1.1.1.2	1995/02/22 02:02:31
--- ldlang.h	1995/05/02 06:45:45
***************
*** 229,234 ****
--- 229,237 ----
    asection *common_section;
    asection *common_output_section;
    boolean complained;
+ 
+   /* This is used to overwrite the global one. */
+   boolean dynamic_link;
  } lang_input_statement_type;
  
  typedef struct
===================================================================
RCS file: /home/cvs/gnu/binutils/ld/lexsup.c,v
retrieving revision 1.1.1.3
diff -c -r1.1.1.3 lexsup.c
*** 1.1.1.3	1995/03/24 02:20:43
--- lexsup.c	1995/05/02 06:45:45
***************
*** 53,58 ****
--- 53,62 ----
  {
    int ingroup = 0;
  
+   int use_last_link_config = 0;
+   boolean last_is_dynamic_link;
+   lang_input_statement_type * library;
+ 
    /* Starting the short option string with '-' is for programs that
       expect options and other ARGV-elements in any order and that care about
       the ordering of the two.  We describe each non-option ARGV-element
***************
*** 193,201 ****
--- 197,209 ----
  	  break;
  	case OPTION_CALL_SHARED:
  	  config.dynamic_link = true;
+ 	  use_last_link_config = 1;
+ 	  last_is_dynamic_link = true;
  	  break;
  	case OPTION_NON_SHARED:
  	  config.dynamic_link = false;
+ 	  use_last_link_config = 1;
+ 	  last_is_dynamic_link = false;
  	  break;
  	case 'd':
  	  command_line.force_common_definition = true;
***************
*** 245,252 ****
  	  ldfile_add_library_path (optarg, true);
  	  break;
  	case 'l':
! 	  lang_add_input_file (optarg, lang_input_file_is_l_enum,
! 			       (char *) NULL);
  	  break;
  	case 'M':
  	  config.map_filename = "-";
--- 253,263 ----
  	  ldfile_add_library_path (optarg, true);
  	  break;
  	case 'l':
! 	  library = lang_add_input_file (optarg,
! 					 lang_input_file_is_l_enum,
! 					 (char *) NULL);
! 	  library->dynamic_link = use_last_link_config ?
! 		last_is_dynamic_link : config.dynamic_link;
  	  break;
  	case 'M':
  	  config.map_filename = "-";




More information about the Gas2 mailing list