From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/467 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Testing new gcc wrapper script Date: Wed, 21 Sep 2011 01:14:28 -0400 Message-ID: <20110921051428.GC132@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="XsQoSWH+UP9D9v3l" X-Trace: dough.gmane.org 1316582402 19614 80.91.229.12 (21 Sep 2011 05:20:02 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 21 Sep 2011 05:20:02 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-468-gllmg-musl=m.gmane.org@lists.openwall.com Wed Sep 21 07:19:58 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 1R6FDy-000483-BB for gllmg-musl@lo.gmane.org; Wed, 21 Sep 2011 07:19:58 +0200 Original-Received: (qmail 30167 invoked by uid 550); 21 Sep 2011 05:19:57 -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 30154 invoked from network); 21 Sep 2011 05:19:56 -0000 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:467 Archived-At: --XsQoSWH+UP9D9v3l Content-Type: text/plain; charset=us-ascii Content-Disposition: inline The existing gcc wrapper script shipped with musl hasn't been very robust, and it doesn't work with pre-4.4 gcc. I'm testing a new version (attached to this email) and I'd like some feedback on how well it works. Edit the top of the file to choose your installation location, compiler to run, etc. then invoke it just like before. Rich --XsQoSWH+UP9D9v3l Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=my-musl-gcc #!/bin/sh gcc=gcc libc_name=musl 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##*/} collect2="$("$gcc" -print-prog-name=collect2)" wrap_dir=$HOME/.tmp/gcc_wrapper/$libc_name-$gcctarget-$gccver if false && [ -x "$wrap_dir/collect2" ] ; then true else mkdir -p "$wrap_dir" || exit 1 echo '#!/bin/sh first=1 for i ; do [ "$first" ] && { first= ; set -- ; } case "$i" in -L/dev/null) nolibs=1 ;; -L*) [ "$nolibs" ] || set -- "$@" "$i" ;; *) set -- "$@" "$i" ;; esac done exec "'"$collect2"'" "$@"' > "$wrap_dir/collect2.$$" chmod 755 "$wrap_dir/collect2.$$" mv "$wrap_dir/collect2.$$" "$wrap_dir/collect2" fi for i ; do case "$skip$i" in -I|-L) skip=- ; continue ;; -[cSE]|-M*) nolink=1 ;; -*) ;; *) havefile=1 ;; esac skip= done if [ "$nolink" ] ; then exec "$gcc" -std=gnu99 -nostdinc -isystem "$libc_inc" -isystem "$gcc_inc" "$@" exit 1 fi if [ "$havefile" ] ; then exec "$gcc" -B"$wrap_dir" \ -std=gnu99 -nostdinc -nostdlib \ -isystem "$libc_inc" -isystem "$gcc_inc" \ "$libc_start" "$libc_crt" "$@" "$libc_end" \ -L"$libc_lib" -L"$libgcc" -L/dev/null \ -Wl,--start-group -lc -lgcc -Wl,--end-group \ -Wl,-dynamic-linker,"$ldso_pathname" -Wl,-nostdlib exit 1 fi exec "$gcc" -std=gnu99 -nostdinc -nostdlib \ -isystem "$libc_inc" -isystem "$gcc_inc" \ "$@" \ -L"$libc_lib" -L"$libgcc" -L/dev/null \ --XsQoSWH+UP9D9v3l--