mailing list of musl libc
 help / color / mirror / code / Atom feed
* using musl with older gcc
@ 2011-05-04  5:18 Szabolcs Nagy
  2011-05-04 12:53 ` Rich Felker
  0 siblings, 1 reply; 2+ messages in thread
From: Szabolcs Nagy @ 2011-05-04  5:18 UTC (permalink / raw)
  To: musl

i've just tried out musl

the install instruction says

"It requires a version of gcc with the -wrapper option
(gcc 4.x should work)."

i have 4.3.x and it does not have -wrapper
(it seems 4.4.x has though, you should fix the instructions)


so i tried to compile some code without the gcc wrapper,

cat >t.c <<EOF
#include <stdio.h>
int main(){ fputs("hello\n", stderr); return 0; }
EOF

gcc -c t.c -std=gnu99 -nostdinc \
  -isystem "$libc_inc" -isystem "$gcc_inc"

ld -o t t.o "$libc_start" "$libc_crt" "$libc_end" \
  -L"$libc_lib" -lc -L"$libgcc" -lgcc -nostdlib

this one actually worked, but using stdout instead
of stderr, ld says:

__stdout_write.c:(.text+0x55): undefined reference to `__stack_chk_fail'

if i create a dummy __stack_chk_fail function
then the resulting executable segfaults

this is some newer stackprotection thing
maybe i just have to link some additional
lib to make this error go away

in the end i recompiled musl with
CFLAGS += -fno-stack-protector
and now everything works fine

i hope this helps those who have older gcc



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

* Re: using musl with older gcc
  2011-05-04  5:18 using musl with older gcc Szabolcs Nagy
@ 2011-05-04 12:53 ` Rich Felker
  0 siblings, 0 replies; 2+ messages in thread
From: Rich Felker @ 2011-05-04 12:53 UTC (permalink / raw)
  To: musl

On Wed, May 04, 2011 at 07:18:09AM +0200, Szabolcs Nagy wrote:
> i've just tried out musl
> 
> the install instruction says
> 
> "It requires a version of gcc with the -wrapper option
> (gcc 4.x should work)."
> 
> i have 4.3.x and it does not have -wrapper
> (it seems 4.4.x has though, you should fix the instructions)

You're right. Either this should be fixed, or I should finish the new
version of the wrapper that works with older gcc versions.

> __stdout_write.c:(.text+0x55): undefined reference to `__stack_chk_fail'
> 
> if i create a dummy __stack_chk_fail function
> then the resulting executable segfaults
> 
> this is some newer stackprotection thing
> maybe i just have to link some additional
> lib to make this error go away
> 
> in the end i recompiled musl with
> CFLAGS += -fno-stack-protector
> and now everything works fine

Yes, some vendors have patched the gcc to make this option default...
I will add a note about that.

Thanks!

Rich


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

end of thread, other threads:[~2011-05-04 12:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-04  5:18 using musl with older gcc Szabolcs Nagy
2011-05-04 12:53 ` 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).