Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 23 Aug 2012 16:25:55 +0600
From: agent <>
Subject: Re: build musl with clang

23.08.2012 15:23, Szabolcs Nagy пишет:
> maybe try to link separately with ld
> (clang might invoke ld in hideous ways)
> # if there is no crtbegin.o,crtend.o then remove them
> START="$MUSL/lib/crti.o $MUSL/lib/crt1.o $CLANG/lib/crtbegin.o"
> END="$CLANG/lib/crtend.o $MUSL/lib/crtn.o -L$MUSL/lib -lc -L$CLANG/lib -lclang"
> # compile:
> clang -c t.c -nostdinc -isystem $MUSL/include
> # link: either one of the following should work
> clang -nostdlib -Wl,-dynamic-linker,/lib/ $START t.o $END
> ld -X -d -e _start -dynamic-linker /lib/ $START t.o $END
the way clang invokes ld is really weird because neither -dynamic-linker 
nor -Wl,-dynamic-linker override the option clang invokes ld, it is only 
appended to a command line. using ld explicitly works perfectly even 
without need for libclang when linking dynamically, at least for hello 
world. unfortunatelly ubuntu does not provide libclang.a in packages and 
i don't want to recompile clang itself, so i can't test static build 
right now, but it is good that at least dynamic linking works.

thanks for your help!

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.