This is the mail archive of the binutils@sources.redhat.com 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]

PATCH: --sysroot-suffix


This patch adds a --sysroot-suffix option to ld.  

The scenario in which this is useful is as follows.  Suppose that you
have built a single cross compiler (say, for MIPS), but two versions of
GLIBC (installed, in, say, "eb" and "el" subdirectories of prefix).
It's insufficient just to provide appropriate -L options because the
linker has to be able to resolve linker scripts that contain absolute
paths correctly.  The --sysroot-suffix option to the linker
complements the SYSROOT_SUFFIX_SPEC already in GCC.

OK to commit?

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com


2005-01-16  Mark Mitchell  <mark@codesourcery.com>

	* ldmain.c (main): Add spport --sysroot-suffix option.
	* ld.texinfo: Document --sysroot-suffix.

*** ./ld.texinfo	Mon Nov 15 15:21:27 2004
--- /home/mitchell/scratch/wrs-linux/src/binutils-20041119/ld/ld.texinfo	Sun Jan 16 18:48:49 2005
***************
*** 793,798 ****
--- 793,807 ----
  @itemx --strip-debug
  Omit debugger symbol information (but not all symbols) from the output file.
  
+ @kindex --sysroot-suffix @var{suffix}
+ @cindex subdirectory of the sysroot, specifying
+ @item --sysroot-suffix @var{suffix}
+ This option can be used to specify that a subdirectory of the usual
+ sysroot prefix should be used as the sysroot prefix.  For example, if
+ '/opt/binutils' is the normal system root, and the suffix specified is
+ '/bigendian', then the sysroot becomes '/opt/binutils/bigendian'.  If
+ present, this option must be the first option on the command-line.
+ 
  @kindex -t
  @kindex --trace
  @cindex input files, displaying
Only in /home/mitchell/scratch/wrs-linux/src/binutils-20041119/ld: ld.texinfo~
diff -c -r ./ldmain.c /home/mitchell/scratch/wrs-linux/src/binutils-20041119/ld/ldmain.c
*** ./ldmain.c	Mon Nov 15 15:21:27 2004
--- /home/mitchell/scratch/wrs-linux/src/binutils-20041119/ld/ldmain.c	Fri Jan 14 15:38:27 2005
***************
*** 237,246 ****
  
    if (! ld_sysroot)
  #endif
!     ld_sysroot = TARGET_SYSTEM_ROOT;
  
    if (ld_sysroot && *ld_sysroot)
!     ld_canon_sysroot = lrealpath (ld_sysroot);
  
    if (ld_canon_sysroot)
      ld_canon_sysroot_len = strlen (ld_canon_sysroot);
--- 237,271 ----
  
    if (! ld_sysroot)
  #endif
!     ld_sysroot = xstrdup (TARGET_SYSTEM_ROOT);
  
    if (ld_sysroot && *ld_sysroot)
!     {
!       char *ld_sysroot_suffix = NULL;
! 
!       if (argc > 1 && strcmp (argv[1], "--sysroot-suffix") == 0)
! 	{
! 	  if (argc < 3)
! 	    {
! 	      einfo (_("--sysroot-suffix requires argument"));
! 	      xexit (1);
! 	    }
! 	  ld_sysroot_suffix = argv[2];
! 	  argc -= 2;
! 	  argv += 2;
! 	}
! 
!       if (ld_sysroot_suffix)
! 	{
! 	  size_t sysroot_len = strlen (ld_sysroot);
! 	  ld_sysroot = xrealloc (ld_sysroot,
! 				 sysroot_len
! 				 + strlen (ld_sysroot_suffix)
! 				 + 1 /* '\0' */);
! 	  strcpy (ld_sysroot + sysroot_len, ld_sysroot_suffix);
! 	}
!       ld_canon_sysroot = lrealpath (ld_sysroot);
!     }
  
    if (ld_canon_sysroot)
      ld_canon_sysroot_len = strlen (ld_canon_sysroot);


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