From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/475 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: New gcc wrapper, take 3 Date: Wed, 21 Sep 2011 16:41:04 -0400 Message-ID: <20110921204104.GH132@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="kvUQC+jR9YzypDnK" X-Trace: dough.gmane.org 1316638000 21738 80.91.229.12 (21 Sep 2011 20:46:40 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 21 Sep 2011 20:46:40 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-476-gllmg-musl=m.gmane.org@lists.openwall.com Wed Sep 21 22:46:36 2011 Return-path: Envelope-to: gllmg-musl@lo.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by lo.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1R6Tgi-0002kT-NI for gllmg-musl@lo.gmane.org; Wed, 21 Sep 2011 22:46:36 +0200 Original-Received: (qmail 21999 invoked by uid 550); 21 Sep 2011 20:46:36 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 21991 invoked from network); 21 Sep 2011 20:46:36 -0000 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:475 Archived-At: --kvUQC+jR9YzypDnK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --kvUQC+jR9YzypDnK Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=my-musl-gcc #!/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" --kvUQC+jR9YzypDnK--