public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PATCH: --sysroot-suffix
@ 2005-01-17  3:22 Mark Mitchell
  2005-01-17  3:38 ` Daniel Jacobowitz
  0 siblings, 1 reply; 23+ messages in thread
From: Mark Mitchell @ 2005-01-17  3:22 UTC (permalink / raw)
  To: binutils


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);

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2005-01-19 15:50 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-17  3:22 PATCH: --sysroot-suffix Mark Mitchell
2005-01-17  3:38 ` Daniel Jacobowitz
2005-01-17  4:04   ` Mark Mitchell
2005-01-17 10:54     ` Richard Sandiford
2005-01-17 11:37       ` Hans-Peter Nilsson
2005-01-17 11:44         ` Richard Sandiford
2005-01-17 14:33           ` Daniel Jacobowitz
2005-01-17 14:47             ` Richard Sandiford
2005-01-17 14:54               ` Daniel Jacobowitz
2005-01-17 16:33               ` Mark Mitchell
2005-01-18 15:54                 ` Richard Sandiford
2005-01-18 16:06                   ` Daniel Jacobowitz
2005-01-18 16:10                     ` Richard Sandiford
2005-01-18 17:03                       ` Daniel Jacobowitz
2005-01-18 17:07                       ` Alexandre Oliva
2005-01-18 17:24                       ` Mark Mitchell
2005-01-18 18:22                         ` Richard Sandiford
2005-01-18 18:26                           ` Mark Mitchell
2005-01-19  2:45                         ` Alan Modra
2005-01-19  5:14                           ` Mark Mitchell
2005-01-19 11:49                           ` Richard Sandiford
2005-01-19 15:50                             ` Mark Mitchell
2005-01-17 19:56               ` Hans-Peter Nilsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).