From: Simon Z <simonz13579@hotmail.com> To: "musl@lists.openwall.com" <musl@lists.openwall.com> Subject: [musl] Failed to invoke ld.lld by using clang -fuse-ld=/usr/local/bin/ld.lld Date: Sun, 28 Nov 2021 03:38:58 +0000 [thread overview] Message-ID: <DM5PR03MB266875E496543D4A7FCC91D6FA659@DM5PR03MB2668.namprd03.prod.outlook.com> (raw) [-- Attachment #1: Type: text/plain, Size: 2383 bytes --] Hello, I am trying to cross compile musl 1.2.2 by using the following configure: ./configure CC="clang --target=aarch64" --target=aarch64 CFLAGS="--rtlib=compiler-rt" AR=/usr/local/bin/llvm-ar LDFLAGS="-fuse-ld=/usr/local/bin/ld.lld" RANLIB=/usr/local/bin/llvm-ranlib --syslibdir=/usr/local/lib LIBCC=-L/usr/local/lib/clang/13.0.0/lib/linux The linking phase failed, it reported the below error: gcc: error: unrecognized command-line option ‘--noexecstack’ clang-13: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation) make: *** [Makefile:162: lib/libc.so] Error 1 make: *** Waiting for unfinished jobs.... Finally, I find the reason is on my computer clang -fuse-ld=/usr/local/bin/ld.lld can't force clang to use ld.lld, while it still will invoke gcc ld, below is my testing: simon@LAPTOP-JH2M71LG:~/workspace/musl-1.2.2$ clang -fuse-ld=/usr/local/bin/ld.lld -v -nostdlib -shared -Wl,-e,_dlstart -o lib/libc.so obj/src/aio/aio.lo clang version 13.0.0 Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /usr/local/bin Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9 Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Candidate multilib: x32;@mx32 Selected multilib: .;@m64 "/usr/local/bin/ld.lld" -z relro --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -shared -o lib/libc.so -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib64 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -L/usr/local/bin/../lib -L/lib -L/usr/lib -e _dlstart obj/src/aio/aio.lo ld.lld: error: obj/src/aio/aio.lo is incompatible with elf_x86_64 clang-13: error: linker command failed with exit code 1 (use -v to see invocation) Then I modified the Makefile (line 162 and 163) from: lib/libc.so: $(LOBJS) $(LDSO_OBJS) $(CC) $(CFLAGS_ALL) $(LDFLAGS_ALL) -nostdlib -shared \ -Wl,-e,_dlstart -o $@ $(LOBJS) $(LDSO_OBJS) $(LIBCC) to lib/libc.so: $(LOBJS) $(LDSO_OBJS) /usr/local/bin/ld.lld -nostdlib -shared \ -e _dlstart -o $@ $(LOBJS) $(LDSO_OBJS) $(LIBCC) It works now! I am using clang 13.0.0. Is it the problem caused by my computer setting? And I also have a question why $(CFLAGS_ALL) is needed to build libc.so? Thanks! Best Regards, Simon [-- Attachment #2: Type: text/html, Size: 6697 bytes --]
reply other threads:[~2021-11-28 3:39 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=DM5PR03MB266875E496543D4A7FCC91D6FA659@DM5PR03MB2668.namprd03.prod.outlook.com \ --to=simonz13579@hotmail.com \ --cc=musl@lists.openwall.com \ --subject='Re: [musl] Failed to invoke ld.lld by using clang -fuse-ld=/usr/local/bin/ld.lld' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Code repositories for project(s) associated with this 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).