mailing list of musl libc
 help / color / mirror / code / Atom feed
* musl libc.so working and almost building with current pcc
@ 2016-04-03 21:47 Isaac Dunham
  2016-04-04  0:04 ` Rich Felker
  0 siblings, 1 reply; 4+ messages in thread
From: Isaac Dunham @ 2016-04-03 21:47 UTC (permalink / raw)
  To: musl

Hello,
Current (20160403) pcc almost builds a working libc.so.

(Unfortunately, it's still necessary to fix the pcc-libs package
by updating config.guess/config.sub and adding protected visibility;
I didn't add protected visibility and forced -fPIC, though the build
system seems to add -fPIC for some files.)

However, PCC reports a major internal compiler error at line 1382
of ldso/dynlink.c (which is conditional on FDPIC support).
If I convert the "if (DL_FDPIC) ..." to an ifdef, I get a working libc.
(src/complex/catanf.c is now properly compiled.)

I'd like to find out what's causing the ICE and report it, but reducing
the dynamic linker to a testcase isn't something that I'm ready to do.
If someone has any further ideas, that would be appreciated.

Thanks,
Isaac Dunham



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

* Re: musl libc.so working and almost building with current pcc
  2016-04-03 21:47 musl libc.so working and almost building with current pcc Isaac Dunham
@ 2016-04-04  0:04 ` Rich Felker
  2016-04-04  4:00   ` Isaac Dunham
  2016-04-04 15:36   ` Isaac Dunham
  0 siblings, 2 replies; 4+ messages in thread
From: Rich Felker @ 2016-04-04  0:04 UTC (permalink / raw)
  To: musl

On Sun, Apr 03, 2016 at 02:47:56PM -0700, Isaac Dunham wrote:
> Hello,
> Current (20160403) pcc almost builds a working libc.so.
> 
> (Unfortunately, it's still necessary to fix the pcc-libs package
> by updating config.guess/config.sub and adding protected visibility;
> I didn't add protected visibility and forced -fPIC, though the build
> system seems to add -fPIC for some files.)

Everything in libpcc.a needs to be _hidden_, not protected. The issue
is not whether it binds locally but whether it produces
wrongly-exported symbols in shared libs it gets linked into.

> However, PCC reports a major internal compiler error at line 1382
> of ldso/dynlink.c (which is conditional on FDPIC support).
> If I convert the "if (DL_FDPIC) ..." to an ifdef, I get a working libc.
> (src/complex/catanf.c is now properly compiled.)

It's always defined (to either 0 or 1) so #ifdef produces wrong code.
Did you try #if DL_FDPIC? That should work but there's obviously some
serious pcc bug going on here, probably preprocessor breakage again.

FWIW pcc used to work fine but they keep breaking it, usually the
preprocessor.

Rich


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

* Re: musl libc.so working and almost building with current pcc
  2016-04-04  0:04 ` Rich Felker
@ 2016-04-04  4:00   ` Isaac Dunham
  2016-04-04 15:36   ` Isaac Dunham
  1 sibling, 0 replies; 4+ messages in thread
From: Isaac Dunham @ 2016-04-04  4:00 UTC (permalink / raw)
  To: musl

On Sun, Apr 03, 2016 at 08:04:48PM -0400, Rich Felker wrote:
> On Sun, Apr 03, 2016 at 02:47:56PM -0700, Isaac Dunham wrote:
> > Hello,
> > Current (20160403) pcc almost builds a working libc.so.
> > 
> > (Unfortunately, it's still necessary to fix the pcc-libs package
> > by updating config.guess/config.sub and adding protected visibility;
> > I didn't add protected visibility and forced -fPIC, though the build
> > system seems to add -fPIC for some files.)
> 
> Everything in libpcc.a needs to be _hidden_, not protected. The issue
> is not whether it binds locally but whether it produces
> wrongly-exported symbols in shared libs it gets linked into.

I remembered the general problem, but not the exact solution (had hidden
and protected mixed up).

By the way, checking things, yes, adding '-fPIC' to CFLAGS is still
necessary.

> > However, PCC reports a major internal compiler error at line 1382
> > of ldso/dynlink.c (which is conditional on FDPIC support).
> > If I convert the "if (DL_FDPIC) ..." to an ifdef, I get a working libc.
> > (src/complex/catanf.c is now properly compiled.)
> 
> It's always defined (to either 0 or 1) so #ifdef produces wrong code.
> Did you try #if DL_FDPIC? That should work but there's obviously some
> serious pcc bug going on here, probably preprocessor breakage again.

Yes, I used '#if DL_FDPIC' (not #ifdef).

> FWIW pcc used to work fine but they keep breaking it, usually the
> preprocessor.

I know.

Thanks,
Isaac Dunham



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

* Re: musl libc.so working and almost building with current pcc
  2016-04-04  0:04 ` Rich Felker
  2016-04-04  4:00   ` Isaac Dunham
@ 2016-04-04 15:36   ` Isaac Dunham
  1 sibling, 0 replies; 4+ messages in thread
From: Isaac Dunham @ 2016-04-04 15:36 UTC (permalink / raw)
  To: musl

On Sun, Apr 03, 2016 at 08:04:48PM -0400, Rich Felker wrote:
> On Sun, Apr 03, 2016 at 02:47:56PM -0700, Isaac Dunham wrote:
> > However, PCC reports a major internal compiler error at line 1382
> > of ldso/dynlink.c (which is conditional on FDPIC support).
> > If I convert the "if (DL_FDPIC) ..." to an ifdef, I get a working libc.
> > (src/complex/catanf.c is now properly compiled.)
> 
> It's always defined (to either 0 or 1) so #ifdef produces wrong code.
> Did you try #if DL_FDPIC? That should work but there's obviously some
> serious pcc bug going on here, probably preprocessor breakage again.

Not a preprocessor bug; building dynlink.i by hand, I see that this line
	if (DL_FDPIC) ((stage3_func)&ldso.funcdescs[dls3_def.sym-ldso.syms])(sp);
becomes
	if (0) ((stage3_func)&ldso.funcdescs[dls3_def.sym-ldso.syms])(sp);

Which is what it should be.
So it's hitting a problem with understanding the code.

Thanks,
Isaac Dunham



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

end of thread, other threads:[~2016-04-04 15:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-03 21:47 musl libc.so working and almost building with current pcc Isaac Dunham
2016-04-04  0:04 ` Rich Felker
2016-04-04  4:00   ` Isaac Dunham
2016-04-04 15:36   ` Isaac Dunham

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