mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Fixing gcc paths for musl
Date: Sat, 27 Jul 2013 20:48:46 -0400	[thread overview]
Message-ID: <20130728004846.GA25530@brightrain.aerifal.cx> (raw)

[-- 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

                 reply	other threads:[~2013-07-28  0:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130728004846.GA25530@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).