From: Isaac Dunham <idunham@lavabit.com>
To: musl@lists.openwall.com
Subject: Re: gcc segfault at src/mman/mlockall.c
Date: Wed, 16 May 2012 23:07:16 -0700 [thread overview]
Message-ID: <20120516230716.11df4881@newbook> (raw)
In-Reply-To: <20120516220457.GU17860@port70.net>
On Thu, 17 May 2012 00:04:57 +0200
Szabolcs Nagy <nsz@port70.net> wrote:
> i'm not sure what is a glibc->musl cross-compiler
Built on glibc, targets musl (similar to musl-gcc, though a strict
cross-compiler is a little more complex)
> i used something like the following to compile with pcc using musl
> libc
> MUSL=/path/to/musl
> PCC=`pcc -v foobar.o 2>&1 |sed -n 's,.*
> \([^ ]*\)/lib/crtbegin.o.*,\1,p'`
>
> x.o: x.c
> pcc $(CFLAGS) -nostdinc -isystem $(MUSL)/include -isystem
> $(PCC)/include -c -o $@ $< x-static1: x.o
> ld -X -d -e _start -Bstatic -o $@ $< $(LDFLAGS)
> $(MUSL)/lib/crti.o $(MUSL)/lib/crt1.o \ $(PCC)/lib/crtbegin.o
> $(PCC)/lib/crtend.o $(MUSL)/lib/crtn.o -L$(MUSL)/lib -lc -L$(PCC)/lib
> -lpcc x-static2: x.o pcc -static -nostdlib -o $@ $< $(LDFLAGS)
> $(MUSL)/lib/crti.o $(MUSL)/lib/crt1.o \ $(PCC)/lib/crtbegin.o
> $(PCC)/lib/crtend.o $(MUSL)/lib/crtn.o -L$(MUSL)/lib -lc -L$(PCC)/lib
> -lpcc x-dynamic1: x.o ld -X -d -e _start
> -dynamic-linker /lib/ld-musl-i386.so.1 -o $@ $< $(LDFLAGS)
> $(MUSL)/lib/crti.o $(MUSL)/lib/crt1.o \ $(PCC)/lib/crtbegin.o
> $(PCC)/lib/crtend.o $(MUSL)/lib/crtn.o -L$(MUSL)/lib -lc -L$(PCC)/lib
> -lpcc x-dynamic2: x.o pcc -nostdlib
> -Wl,-dynamic-linker,/lib/ld-musl-i386.so.1 -o $@ $< $(LDFLAGS)
> $(MUSL)/lib/crti.o $(MUSL)/lib/crt1.o \ $(PCC)/lib/crtbegin.o
> $(PCC)/lib/crtend.o $(MUSL)/lib/crtn.o -L$(MUSL)/lib -lc -L$(PCC)/lib
> -lpcc
For static, I can do it about like so (shell):
# Pass 1: headers
pcc $@ -nostdinc -isystem $MUSL/include -isystem $PCC/include
# Pass 2: linking executables
STARTOBJ="$MUSL/lib/crti.o $MUSL/lib/crt1.o $PCC/lib/crtbegin.o"
ENDOBJ="$PCC/lib/crtend.o $MUSL/lib/crtn.o -L$MUSL/lib -lc -L$PCC/lib \
-lpcc"
pcc -nostdlib -static $STARTOBJ $@ $ENDOBJ
Thanks!
Isaac Dunham
next prev parent reply other threads:[~2012-05-17 6:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-15 16:35 Isaac Dunham
2012-05-15 16:42 ` Isaac Dunham
2012-05-15 19:21 ` Szabolcs Nagy
2012-05-15 19:30 ` Szabolcs Nagy
2012-05-16 18:53 ` Isaac Dunham
2012-05-16 22:04 ` Szabolcs Nagy
2012-05-17 6:07 ` Isaac Dunham [this message]
2012-05-18 14:58 ` Jens Staal
2012-05-18 17:21 ` Christian Neukirchen
2012-05-18 18:43 ` Jens Staal
2012-05-18 18:51 ` Kurt H Maier
2012-05-18 22:58 ` Rich Felker
2012-05-18 23:13 ` Kurt H Maier
2012-05-19 0:45 ` Isaac Dunham
2012-05-19 0:56 ` Rich Felker
2012-05-19 18:45 ` noXCUse, userspace options Isaac Dunham
2012-05-24 6:16 ` noXCUse grep Isaac Dunham
2012-05-19 21:26 ` gcc segfault at src/mman/mlockall.c Christian Neukirchen
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=20120516230716.11df4881@newbook \
--to=idunham@lavabit.com \
--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).