mailing list of musl libc
 help / color / mirror / code / Atom feed
* Fixing gcc paths for musl
@ 2013-07-28  0:48 Rich Felker
  0 siblings, 0 replies; only message in thread
From: Rich Felker @ 2013-07-28  0:48 UTC (permalink / raw)
  To: musl

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

A longstanding issue with using gcc with musl has been that the
gcc installs its own versions of a number of ISO C headers (basically,
the ones for a freestanding implementation) in its own include
directory and puts that ahead of /usr/include in the search path
order. Some people have been solving this by patching those headers
not to conflict with musl so badly, while others (myself included)
have been just deleting the offending headers after installing, but
the real fix is to make gcc aware that it should have a different
search order for musl that searches the libc headers before its own
versions. This allows use of the useful gcc headers (e.g. the ones for
intrinsics) while letting the libc headers override for libc things.

The attached patch (against gcc 4.6.3 but the idea is the same for
other versions) attempts to do this the same was it's done in
gcc/config/openbsd.h and gcc/config/netbsd.h. It's untested and just
to get an idea of what I'd like to do. My hope is that this can be
merged into Gregor's musl-cross gcc patch to make a universal gcc
patch that covers all the issues needed for using gcc with musl, so
that you can just apply it and install.

For reference, musl-cross repo is here:

https://bitbucket.org/GregorR/musl-cross/

Rich

[-- Attachment #2: gcc-path.diff --]
[-- Type: text/plain, Size: 717 bytes --]

--- gcc-4.6.3/gcc/config/linux.h.bak
+++ gcc-4.6.3/gcc/config/linux.h
@@ -102,3 +102,18 @@
 
 /* Whether we have sincos that follows the GNU extension.  */
 #define TARGET_HAS_SINCOS (OPTION_GLIBC || OPTION_BIONIC)
+
+#if DEFAULT_LIBC == LIBC_MUSL
+#undef INCLUDE_DEFAULTS
+#define INCLUDE_DEFAULTS			\
+  {						\
+    { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, 0, 0 }, \
+    { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, 0, 1 }, \
+    { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, 0, 0 }, \
+    { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },	\
+    { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0 },	\
+    { STANDARD_INCLUDE_DIR, 0, 0, 1, 1, 0 },	\
+    { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 },	\
+    { 0, 0, 0, 0, 0, 0 }			\
+  }
+#endif

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-07-28  0:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-28  0:48 Fixing gcc paths for musl 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).