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] using --with-sysroot for native builds


currently the --sysroot option for ld is only available if binutils is configured --with-sysroot=<...>. My use case for using sysroots for native builds is having multiple chroots for different releases of an OS available for testing, and not having to install a new compiler/linker in the chroot itself. This basically works when configuring --with-sysroot=/, but then libraries are searched in // instead of /.

The following patch makes the --sysroot option available to ld independently of the configure option (making ld.bfd and ld.gold consistent), and avoids the extra slash prefix.

Matthias

	* configure.in: Special case --with-sysroot=/.
	* ldmain.c (main): Always accept --sysroot.

--- a/ld/configure.in
+++ b/ld/configure.in
@@ -38,7 +38,9 @@
  *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
  esac
 
+ if test "x$TARGET_SYSTEM_ROOT" != x/; then
  TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
+ fi
  use_sysroot=yes
 
  if test "x$prefix" = xNONE; then
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -214,8 +214,8 @@
     {
       if (*TARGET_SYSTEM_ROOT == 0)
 	{
-	  einfo ("%P%F: this linker was not configured to use sysroots\n");
 	  ld_sysroot = "";
+	  ld_canon_sysroot = "";
 	}
       else
 	ld_canon_sysroot = lrealpath (ld_sysroot);

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