This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

Re: Wrong dynamic-linker used on Solaris 7/x86


Hi Phil,

> >So, we have one vote for and one against it.  Who can make a
> >decision? 
> 
> Nick's the binutils head honcho; I guess he ought to decide.

Who's also been asleep at the wheel for the last week.  Or at least it 
feel that way.  Sorry, guys, it is end-of-quarter hell over here at
the moment.

Anyway - my opinion is that we ought to do both things, ie support -I
as an alias for --dynamic-linker and set the default dynamic linker
for Solaris environments to be ld.so.1.  That way GNU ld can be used
as a drop in replacement for Solaris ld, and I think that this is a
worthy goal.

So here is Alexandre's patch supplemented with a patch to lexsup.c to
add -I.  I have applied this patch.

Cheers
        Nick


2001-05-22  Alexandre Oliva  <aoliva@redhat.com>

	* emulparams/elf_i386_ldso.sh: New, copied from elf_i386.sh.
	(ELF_INTERPRETER_NAME): Define it.
	* emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Use
	it.
	* configure.tgt (targ_emul, targ_extra_emuls)
	[i[3456]86-*-solaris2*, i[3456]86-*-solaris*]: Use elf_i386_ldso
	as primary, elf_i386 as extra.
	* Makefile.am (ALL_EMULATIONS): Added eelf_i386_ldso.o.
	(eelf_i386_ldso.c): New rule.
	* Makefile.in: Rebuilt.

2001-05-22  Nick Clifton  <nickc@redhat.com>

	* lexsup.c (ld_options):  Allow -I to be an alias for
	--dynamic-linker.  This is for Solaris compatibility.
	* ld.texinfo: Document that -I can be used.
	* ld.1: Regenerate.

Index: Makefile.am
===================================================================
RCS file: /cvs/src/src/ld/Makefile.am,v
retrieving revision 1.59
diff -p -r1.59 Makefile.am
*** Makefile.am	2001/05/14 16:55:23	1.59
--- Makefile.am	2001/05/22 13:49:17
*************** ALL_EMULATIONS = \
*** 162,167 ****
--- 162,168 ----
  	eelf_i386.o \
  	eelf_i386_be.o \
  	eelf_i386_chaos.o \
+       eelf_i386_ldso.o \
  	eelf_s390.o \
  	egld960.o \
  	egld960coff.o \
*************** eelf_i386_be.c: $(srcdir)/emulparams/elf
*** 537,542 ****
--- 538,546 ----
  eelf_i386_chaos.c: $(srcdir)/emulparams/elf_i386_chaos.sh \
    $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
  	${GENSCRIPTS} elf_i386_chaos "$(tdir_elf_i386_chaos)"
+ eelf_i386_ldso.c: $(srcdir)/emulparams/elf_i386_ldso.sh \
+   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ 	${GENSCRIPTS} elf_i386_ldso "$(tdir_elf_i386_ldso)"
  eelf_s390.c: $(srcdir)/emulparams/elf_s390.sh \
    $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
  	${GENSCRIPTS} elf_s390 "$(tdir_elf_s390)"

Index: configure.tgt
===================================================================
RCS file: /cvs/src/src/ld/configure.tgt,v
retrieving revision 1.53
diff -p -r1.53 configure.tgt
*** configure.tgt	2001/05/02 18:14:30	1.53
--- configure.tgt	2001/05/22 13:49:23
*************** x86_64-*-linux-gnu*)	targ_emul=elf_x86_6
*** 144,152 ****
  			tdir_i386linux=${targ_alias}aout
  			;;
  i[3456]86-*-sysv[45]*)	targ_emul=elf_i386 ;;
! i[3456]86-*-solaris2*)	targ_emul=elf_i386 ;;
  i[3456]86-*-unixware)	targ_emul=elf_i386 ;;
! i[3456]86-*-solaris*)	targ_emul=elf_i386 ;;
  i[3456]86-*-netbsd*)	targ_emul=i386nbsd ;;
  i[3456]86-*-netware)	targ_emul=i386nw ;;
  i[3456]86-*-elf*)	targ_emul=elf_i386 ;;
--- 144,156 ----
  			tdir_i386linux=${targ_alias}aout
  			;;
  i[3456]86-*-sysv[45]*)	targ_emul=elf_i386 ;;
! i[3456]86-*-solaris2*)  targ_emul=elf_i386_ldso
!                         targ_extra_emuls="elf_i386"
!                         ;;
  i[3456]86-*-unixware)	targ_emul=elf_i386 ;;
! i[3456]86-*-solaris*)   targ_emul=elf_i386_ldso
!                         targ_extra_emuls="elf_i386"
!                         ;;
  i[3456]86-*-netbsd*)	targ_emul=i386nbsd ;;
  i[3456]86-*-netware)	targ_emul=i386nw ;;
  i[3456]86-*-elf*)	targ_emul=elf_i386 ;;

Index: ld.texinfo
===================================================================
RCS file: /cvs/src/src/ld/ld.texinfo,v
retrieving revision 1.38
diff -p -r1.38 ld.texinfo
*** ld.texinfo	2001/04/13 02:22:23	1.38
--- ld.texinfo	2001/05/22 13:49:34
*************** demangle by default unless the environme
*** 966,971 ****
--- 966,972 ----
  is set.  These options may be used to override the default.
  
  @cindex dynamic linker, from command line
+ @kindex -I@var{file}
  @kindex --dynamic-linker @var{file}
  @item --dynamic-linker @var{file}
  Set the name of the dynamic linker.  This is only meaningful when

Index: lexsup.c
===================================================================
RCS file: /cvs/src/src/ld/lexsup.c,v
retrieving revision 1.33
diff -p -r1.33 lexsup.c
*** lexsup.c	2001/05/02 16:42:55	1.33
--- lexsup.c	2001/05/22 13:49:38
*************** static const struct ld_option ld_options
*** 201,206 ****
--- 201,208 ----
        TWO_DASHES },
    { {"soname", required_argument, NULL, OPTION_SONAME},
        'h', N_("FILENAME"), N_("Set internal name of shared library"), ONE_DASH },
+   { {"dynamic-linker", required_argument, NULL, OPTION_DYNAMIC_LINKER},
+       'I', N_("PROGRAM"), N_("Set the dynamic linker to use"), TWO_DASHES },
    { {"library", required_argument, NULL, 'l'},
        'l', N_("LIBNAME"), N_("Search for library LIBNAME"), TWO_DASHES },
    { {"library-path", required_argument, NULL, 'L'},
*************** static const struct ld_option ld_options
*** 290,297 ****
        '\0', N_("SYMBOL=EXPRESSION"), N_("Define a symbol"), TWO_DASHES },
    { {"demangle", optional_argument, NULL, OPTION_DEMANGLE},
        '\0', N_("[=STYLE]"), N_("Demangle symbol names [using STYLE]"), TWO_DASHES },
-   { {"dynamic-linker", required_argument, NULL, OPTION_DYNAMIC_LINKER},
-       '\0', N_("PROGRAM"), N_("Set the dynamic linker to use"), TWO_DASHES },
    { {"embedded-relocs", no_argument, NULL, OPTION_EMBEDDED_RELOCS},
        '\0', NULL, N_("Generate embedded relocs"), TWO_DASHES},
    { {"fini", required_argument, NULL, OPTION_FINI},
--- 292,297 ----
*************** parse_args (argc, argv)
*** 651,656 ****
--- 651,657 ----
  	      cplus_demangle_set_style (style);
  	    }
  	  break;
+ 	case 'I':		/* Used on Solaris.  */
  	case OPTION_DYNAMIC_LINKER:
  	  command_line.interpreter = optarg;
  	  break;

Index: emulparams/elf_i386_ldso.sh
===================================================================
RCS file: elf_i386_ldso.sh
diff -N elf_i386_ldso.sh
*** /dev/null	Tue May  5 13:32:27 1998
--- elf_i386_ldso.sh	Tue May 22 06:49:38 2001
***************
*** 0 ****
--- 1,11 ----
+ SCRIPT_NAME=elf
+ OUTPUT_FORMAT="elf32-i386"
+ TEXT_START_ADDR=0x08048000
+ MAXPAGESIZE=0x1000
+ NONPAGED_TEXT_START_ADDR=0x08048000
+ ARCH=i386
+ MACHINE=
+ NOP=0x9090
+ TEMPLATE_NAME=elf32
+ GENERATE_SHLIB_SCRIPT=yes
+ ELF_INTERPRETER_NAME=\"/usr/lib/ld.so.1\"
Index: emultempl/elf32.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/elf32.em,v
retrieving revision 1.45
diff -p -r1.45 elf32.em
*** elf32.em	2001/05/03 06:26:26	1.45
--- elf32.em	2001/05/22 13:49:38
*************** gld${EMULATION_NAME}_before_allocation (
*** 817,822 ****
--- 817,830 ----
  	  &link_info, &sinterp, lang_elf_version_info)))
      einfo ("%P%F: failed to set dynamic section sizes: %E\n");
  
+ ${ELF_INTERPRETER_NAME+"
+   if (sinterp != NULL)
+     {
+       sinterp->contents = ${ELF_INTERPRETER_NAME};
+       sinterp->_raw_size = strlen (sinterp->contents) + 1;
+     }
+ 
+ "}
    /* Let the user override the dynamic linker we are using.  */
    if (command_line.interpreter != NULL
        && sinterp != NULL)

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