mailing list of musl libc
 help / color / mirror / code / Atom feed
* musl-gcc wrapper patch
@ 2015-03-11 21:32 Szabolcs Nagy
  2015-03-11 22:19 ` Rich Felker
  0 siblings, 1 reply; 2+ messages in thread
From: Szabolcs Nagy @ 2015-03-11 21:32 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 283 bytes --]

i assume the most common expectation is that the installed
musl-gcc tool uses the same compiler as the musl build was
using

at least this is what i would want for cross compilation

i guess this breaks if relative path or multiple words were
used (cc with args) in $(CC)

comments?

[-- Attachment #2: 0001-fix-the-musl-gcc-wrapper-to-call-the-gcc-used-for-th.patch --]
[-- Type: text/x-diff, Size: 1130 bytes --]

From 081ea4fb4042ba5584a77f3ea492845fffa9a203 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Wed, 11 Mar 2015 21:10:50 +0000
Subject: [PATCH] fix the musl-gcc wrapper to call the gcc used for the musl
 build

In case of a cross build of musl, musl-gcc should call the cross
compiler by default so it is easy to use the wrapper for cross
compilation against the newly built libc.

The REALGCC option is still there if one needs to use a different gcc.
CC consisting of multiple words is not supported (eg CC='gcc -m32').
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 8cc3de8..c87ed1c 100644
--- a/Makefile
+++ b/Makefile
@@ -144,7 +144,7 @@ lib/musl-gcc.specs: tools/musl-gcc.specs.sh config.mak
 	sh $< "$(includedir)" "$(libdir)" "$(LDSO_PATHNAME)" > $@
 
 tools/musl-gcc: config.mak
-	printf '#!/bin/sh\nexec "$${REALGCC:-gcc}" "$$@" -specs "%s/musl-gcc.specs"\n' "$(libdir)" > $@
+	printf '#!/bin/sh\nexec "$${REALGCC:-%s}" "$$@" -specs "%s/musl-gcc.specs"\n' "$(CC)" "$(libdir)" > $@
 	chmod +x $@
 
 $(DESTDIR)$(bindir)/%: tools/%
-- 
2.3.2


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

* Re: musl-gcc wrapper patch
  2015-03-11 21:32 musl-gcc wrapper patch Szabolcs Nagy
@ 2015-03-11 22:19 ` Rich Felker
  0 siblings, 0 replies; 2+ messages in thread
From: Rich Felker @ 2015-03-11 22:19 UTC (permalink / raw)
  To: musl

On Wed, Mar 11, 2015 at 10:32:08PM +0100, Szabolcs Nagy wrote:
> i assume the most common expectation is that the installed
> musl-gcc tool uses the same compiler as the musl build was
> using
> 
> at least this is what i would want for cross compilation
> 
> i guess this breaks if relative path or multiple words were
> used (cc with args) in $(CC)
> 
> comments?
> [...]
>  tools/musl-gcc: config.mak
> -	printf '#!/bin/sh\nexec "$${REALGCC:-gcc}" "$$@" -specs "%s/musl-gcc.specs"\n' "$(libdir)" > $@
> +	printf '#!/bin/sh\nexec "$${REALGCC:-%s}" "$$@" -specs "%s/musl-gcc.specs"\n' "$(CC)" "$(libdir)" > $@
>  	chmod +x $@

Since $CC can contain multiple shell words (e.g. a -m32 or similar)
perhaps we should remove the double-quotes around the expansion of
$REALGCC? Unfortunately this makes for a trade-off between supporting
'standard' usage of $CC and supporting pathnames containing
whitespace. Any opinions on the matter? Any ways to avoid the
tradeoff? Overall I'm in favor of this change anyway but I'd like to
avoid having any negative impact.

Rich


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

end of thread, other threads:[~2015-03-11 22:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-11 21:32 musl-gcc wrapper patch Szabolcs Nagy
2015-03-11 22:19 ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).