Date: Mon, 22 Jun 2020 11:58:58 -0700 From: "Jin Guojun[VFF]" <jguojun@gmail.com> To: freebsd-questions@freebsd.org Subject: Re: Why clang/cc needs libgcc_s in 11.4-R Message-ID: <3656e95d-e95a-e56a-aa8c-9a5c3d6207c2@gmail.com> In-Reply-To: <53331bc9-b5c9-df83-0b01-a56061faa6bb@gmail.com> References: <dd120fa2-d263-da99-f16a-82c15626b038@gmail.com> <53331bc9-b5c9-df83-0b01-a56061faa6bb@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
It is clang/cc problem because if using ld directly, there is no problem. It is not clear why cc passes -lgcc_s requirement to ld when -Wl,-r flag presents, and this looks like a bug in cc. Why ld complains libgcc_s does not exist, where the libgcc_s.so does exist in /usr/lib directory, is a different issue. On 06/19/20 21:50, Jin Guojun[VFF] wrote: > This looks like a clang issue since version 6 because there is > libgcc_s.so in /usr/lib, and it is a symlink to /lib/libgcc_s.so.1. > A number of discussions about this issue on the Internet, but no real > solution found. > > Does anyone have an idea on how to work around this problem? > > -Jin > > ll /usr/lib/libgcc_s.so > lrwxr-xr-x 1 root wheel 23 Jun 12 11:28 /usr/lib/libgcc_s.so@ -> > ../../lib/libgcc_s.so.1 > > ll /lib/libgcc_s.so.1 > -r--r--r-- 1 root wheel 98912 Jun 12 11:28 /lib/libgcc_s.so.1 > > file /lib/libgcc_s.so.1 > /lib/libgcc_s.so.1: ELF 64-bit LSB shared object, x86-64, version 1 > (FreeBSD), statically linked, stripped > > On 06/19/20 20:49, Jin Guojun[VFF] wrote: >> Just installed 11.4-R and try to build a shared library by passing >> relocation flag from cc -Wl,-r to ld, but ld complains -lgcc_s not >> found: >> >> FBSD11: cc -Wl,-r -o libpixrect.so `lorder rast_mem.so rast_dump.so | >> tsort` >> /usr/bin/ld: cannot find -lgcc_s >> cc: error: linker command failed with exit code 1 (use -v to see >> invocation) >> >> FBSD11: cc -Wl,-r,-v -v -o libpixrect.so `lorder rast_mem.so >> rast_dump.so | tsort` >> FreeBSD clang version 10.0.0 (git@github.com:llvm/llvm-project.git >> llvmorg-10.0.0-0-gd32170dbd5b) >> Target: x86_64-unknown-freebsd11.4 >> Thread model: posix >> InstalledDir: /usr/bin >> "/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 >> --hash-style=both --enable-new-dtags -o libpixrect.so /usr/lib/crt1.o >> /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/lib -r -v rast_dump.so >> rast_mem.so -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc >> --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o >> GNU ld 2.17.50 [FreeBSD] 2007-07-03 >> /usr/bin/ld: cannot find -lgcc_s >> >> Why clang depends on gcc library? >> Is any flag or ENV variable can overwrite this requirement? >> If not, where can I get the libgcc_s? >> >> Thanks in advance, >> -Jin > >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3656e95d-e95a-e56a-aa8c-9a5c3d6207c2>
