Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Wed, 4 May 2011 07:18:09 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: using musl with older gcc

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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.