mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: New gcc wrapper, take 3
Date: Wed, 21 Sep 2011 16:41:04 -0400	[thread overview]
Message-ID: <20110921204104.GH132@brightrain.aerifal.cx> (raw)

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

Now updated to use -specs instead of extra wrapping layers with -B in
order to inhibit the default library paths. This version should be
faster, cleaner, and perhaps even more correct than the previous
attempts. I believe some of the other options could also be integrated
into the specs file passed in, and this might make things even cleaner
still.

Please test and let me know if there are problems.

Rich

[-- Attachment #2: my-musl-gcc --]
[-- Type: text/plain, Size: 1162 bytes --]

#!/bin/sh

gcc=gcc
libc_prefix="/usr/local/musl"
ldso_pathname="/lib/ld-musl-i386.so.1"
libc_lib=$libc_prefix/lib
libc_inc=$libc_prefix/include
libc_crt="$libc_lib/crt1.o"
libc_start="$libc_lib/crti.o"
libc_end="$libc_lib/crtn.o"

gcc_inc=$libc_inc
libgcc="$("$gcc" -print-file-name=libgcc.a)"
libgcc=${libgcc%/libgcc.a}

gccver=${libgcc##*/}
gcctarget=${libgcc%/*}
gcctarget=${gcctarget##*/}

case "$gccver" in
2.*|3.*|4.[01]*) ;;
*) nosp=-fno-stack-protector ;;
esac

[ "x$1" = "x-V" ] && { printf "%s: -V not supported\n" "$0" ; exit 1 ; }

for i ; do
case "$skip$i" in
-I|-L) skip=--- ; continue ;;
-[cSE]|-M*) nolink=1 ;;
-*) ;;
*) havefile=1 ;;
esac
skip=
done

[ "$havefile" ] || nolink=1

[ "$nolink" ] || {
tmp_specs=$HOME/.specs.tmp.$$
printf '*link_libgcc:\n\n\n' > "$tmp_specs" || exit 1
set -- -specs="$tmp_specs" "$libc_start" "$libc_crt" "$@" "$libc_end" \
  -Wl,--start-group -lc -lgcc -lgcc_eh -Wl,--end-group \
  -Wl,-dynamic-linker,"$ldso_pathname" -Wl,-nostdlib
}

set -- -std=gnu99 -nostdinc -nostdlib $nosp \
  -isystem "$libc_inc" -isystem "$gcc_inc" "$@" \
  -L"$libc_lib" -L"$libgcc"

"$gcc" "$@"

[ "$tmp_specs" ] && rm -f "$tmp_specs"

             reply	other threads:[~2011-09-21 20:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-21 20:41 Rich Felker [this message]
2011-09-21 21:54 ` Rich Felker

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=20110921204104.GH132@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).