mailing list of musl libc
 help / color / mirror / code / Atom feed
* shared musl with PCC as system compiler
@ 2012-10-14  7:15 Isaac Dunham
  2012-10-14 13:38 ` Luca Barbato
  2012-10-14 15:29 ` Rich Felker
  0 siblings, 2 replies; 4+ messages in thread
From: Isaac Dunham @ 2012-10-14  7:15 UTC (permalink / raw)
  To: musl

This is mainly a mix of what I've worked out previously and what Rich and I worked out on IRC. I figured posting it on the list would help those who want to use pcc as compiler...
0. Get today's (Oct 13) git HEAD or later! Otherwise libc.so will be broken.
Get a fairly recent pcc from CVS (the last month should be good enough)
When compiling pcc-libs, use 
make CFLAGS="-fPIC ${OPTFLAGS}"
(otherwise you get textrels in libc.so, which doesn't work)
1. Set LIBCC to -L$(dirname `pcc -print-file-name=libpcc.a`) -lpcc 
#-lpccsoftfloat may be needed for some systems
2. Add 
CFLAGS_ALL_SHARED += -D__PIC__=1
to config.mak (pcc doesn't define this with -fPIC at present, which is a bug)
3. Find the right -m* options:
ld -march=native 
#look for the elf_* in the "Supported emulations" that matches your CPU
Change all occurences of -m* in config.mak to "-melf_<arch>"
(pcc doesn't parse -m*, which is at best an incompatible behavior)
4. Now you should be set to compile.

-- 
Isaac Dunham <idunham@lavabit.com>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: shared musl with PCC as system compiler
  2012-10-14  7:15 shared musl with PCC as system compiler Isaac Dunham
@ 2012-10-14 13:38 ` Luca Barbato
  2012-10-14 20:36   ` Isaac Dunham
  2012-10-14 15:29 ` Rich Felker
  1 sibling, 1 reply; 4+ messages in thread
From: Luca Barbato @ 2012-10-14 13:38 UTC (permalink / raw)
  To: musl

On 10/14/2012 09:15 AM, Isaac Dunham wrote:
> This is mainly a mix of what I've worked out previously and what Rich and I worked
> out on IRC. I figured posting it on the list would help those who want to use pcc
> as compiler...
> 0. Get today's (Oct 13) git HEAD or later! Otherwise libc.so will be broken.
> Get a fairly recent pcc from CVS (the last month should be good enough)
> When compiling pcc-libs, use 
> make CFLAGS="-fPIC ${OPTFLAGS}"
> (otherwise you get textrels in libc.so, which doesn't work)
> 1. Set LIBCC to -L$(dirname `pcc -print-file-name=libpcc.a`) -lpcc 
> #-lpccsoftfloat may be needed for some systems
> 2. Add 
> CFLAGS_ALL_SHARED += -D__PIC__=1
> to config.mak (pcc doesn't define this with -fPIC at present, which is a bug)
> 3. Find the right -m* options:
> ld -march=native 
> #look for the elf_* in the "Supported emulations" that matches your CPU
> Change all occurences of -m* in config.mak to "-melf_<arch>"
> (pcc doesn't parse -m*, which is at best an incompatible behavior)
> 4. Now you should be set to compile.

Do you have/know of a git mirror for pcc?

lu


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: shared musl with PCC as system compiler
  2012-10-14  7:15 shared musl with PCC as system compiler Isaac Dunham
  2012-10-14 13:38 ` Luca Barbato
@ 2012-10-14 15:29 ` Rich Felker
  1 sibling, 0 replies; 4+ messages in thread
From: Rich Felker @ 2012-10-14 15:29 UTC (permalink / raw)
  To: musl

On Sun, Oct 14, 2012 at 12:15:34AM -0700, Isaac Dunham wrote:
> This is mainly a mix of what I've worked out previously and what Rich and I worked out on IRC. I figured posting it on the list would help those who want to use pcc as compiler...
> 0. Get today's (Oct 13) git HEAD or later! Otherwise libc.so will be broken.
> Get a fairly recent pcc from CVS (the last month should be good enough)
> When compiling pcc-libs, use 
> make CFLAGS="-fPIC ${OPTFLAGS}"
> (otherwise you get textrels in libc.so, which doesn't work)
> 1. Set LIBCC to -L$(dirname `pcc -print-file-name=libpcc.a`) -lpcc 
> #-lpccsoftfloat may be needed for some systems

I think just $(pcc -print-file-name=libpcc.a) would work.

> 3. Find the right -m* options:
> ld -march=native 
> #look for the elf_* in the "Supported emulations" that matches your CPU
> Change all occurences of -m* in config.mak to "-melf_<arch>"
> (pcc doesn't parse -m*, which is at best an incompatible behavior)

Step 3 is entirely unnecessary. No -m options are needed. The problem
is that pcc wrongly passes-thru -march as an option to the linker.
Just remove -march and -mtune from the CFLAGS and the problem goes
away.

Rich


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: shared musl with PCC as system compiler
  2012-10-14 13:38 ` Luca Barbato
@ 2012-10-14 20:36   ` Isaac Dunham
  0 siblings, 0 replies; 4+ messages in thread
From: Isaac Dunham @ 2012-10-14 20:36 UTC (permalink / raw)
  To: musl

On Sun, 14 Oct 2012 15:38:36 +0200
Luca Barbato <lu_zero@gentoo.org> wrote:

> On 10/14/2012 09:15 AM, Isaac Dunham wrote:
> > This is mainly a mix of what I've worked out previously and what Rich and I worked
> > out on IRC. I figured posting it on the list would help those who want to use pcc
> > as compiler...
> > 0. Get today's (Oct 13) git HEAD or later! Otherwise libc.so will be broken.
> > Get a fairly recent pcc from CVS (the last month should be good enough)
> > When compiling pcc-libs, use 
> > make CFLAGS="-fPIC ${OPTFLAGS}"
> > (otherwise you get textrels in libc.so, which doesn't work)
> > 1. Set LIBCC to -L$(dirname `pcc -print-file-name=libpcc.a`) -lpcc 
Or $(${CC} -print-file-name=libpcc.a), as Rich mentioned.
> > 2. Add 
> > CFLAGS_ALL_SHARED += -D__PIC__=1
> > to config.mak (pcc doesn't define this with -fPIC at present, which is a bug)
No longer necessary, with today's CVS (DATESTAMP=20121014).
(Additionally, array arguments passed to inline asm _should_ properly decay to pointers now).

> Do you have/know of a git mirror for pcc?
Not until a few minutes ago. ;)
See
git://github.com/idunham/pcc
and
git://github.com/idunham/pcc-libs
(they are not recommended for use unless you need to use git, as I may not keep them current all the time!)
-- 
Isaac Dunham <idunham@lavabit.com>



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-14 20:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-14  7:15 shared musl with PCC as system compiler Isaac Dunham
2012-10-14 13:38 ` Luca Barbato
2012-10-14 20:36   ` Isaac Dunham
2012-10-14 15:29 ` Rich Felker

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).