Date: Sun, 24 Feb 2019 15:45:48 -0800 From: "Jin Guojun[VFF]" <jguojun@gmail.com> To: =?UTF-8?Q?T=c4=b3l_Coosemans?= <tijl@FreeBSD.org> Cc: "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org> Subject: Re: what causes Clang to use libgcc_s.so in FreeBSD 12.0-R linker Message-ID: <9d121114-8360-d93c-f86c-4d59611e303b@gmail.com> In-Reply-To: <20190224204458.5652577c@kalimero.tijl.coosemans.org> References: <14887cbb-a6ef-c6ac-f7b2-2d91e4c72351@gmail.com> <20190224204458.5652577c@kalimero.tijl.coosemans.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 02/24/19 11:44, Tijl Coosemans wrote: > On Wed, 13 Feb 2019 17:31:46 -0800 "Jin Guojun[VFF]" <jguojun@gmail.com> > wrote: >> Following CC command used for build a shared library that worked on all >> FreeBSD releases before 12-R. >> >> The -v CC option shows that linker indeed involves libgcc and gcc_s >> somehow, but no -static option was shown. Not clear what the error >> message implies. Also, none of these source code has GNU stuff in it and >> what linker tried to do with gcc libraries? >> >> Is something changed for building shared libraries under 12-R? >> >> Thanks, >> >> -Jin >> >> >> FBSD12: cc -Wl,-r -o libccs.so `lorder avail_type.so arg_vc.so >> c_array.so calibrate.so colortog >> .so c_map.so colort90.so dbvfft3d.so eta.so errors.so filter_f.so >> fits_io.so fourier.so gaussian >> .so glb_vars.so histgram.so icc_r.so io_ready.so libpbm.so libpbm2.so >> libpbm4.so libpgm1.so libp >> pm1.so libppm3.so libpbm1.so ln2argv.so message.so pict_r.so pgm_r.so >> q_sort.so rotate90.so t_co >> nsum.so tv_random.so time-out.so dbg_memsz.so to_sep.so to_8.so >> quantto8.so sub_mean.so zalloc.s >> o vfft3d.so vfft_2p.so c_map1.so c_to_c.so buffernw.so checksum.so >> dicm_h.so dir_unix.so eget_ws >> z.so gif_r.so ip-hdr.so private.so piperead.so parsargu.so rast_r.so >> sock_cnct.so sock_init.so s >> ock_subr.so swap_all.so table_if.so tv_empty.so tvmath.so u_db.so >> zreopen.so pip_read.so | tsort >> ` >> >> /usr/bin/ld: error: attempted static link of dynamic object >> /usr/lib/libgcc_s.so >> /usr/bin/ld: error: attempted static link of dynamic object >> /usr/lib/libgcc_s.so >> cc: error: linker command failed with exit code 1 (use -v to see invocation) >> *** Error code 1 (ignored) >> >> FBSD12: cc -v -Wl,-r -o libccs.so `lorder avail_type.so arg_vc.so >> c_array.so calibrate.so colortog.so c >> _map.so colort90.so dbvfft3d.so eta.so errors.so filter_f.so fits_io.so >> fourier.so gaussian.so g >> lb_vars.so histgram.so icc_r.so io_ready.so libpbm.so libpbm2.so >> libpbm4.so libpgm1.so libppm1.s >> o libppm3.so libpbm1.so ln2argv.so message.so pict_r.so pgm_r.so >> q_sort.so rotate90.so t_consum. >> so tv_random.so time-out.so dbg_memsz.so to_sep.so to_8.so quantto8.so >> sub_mean.so zalloc.so vff >> t3d.so vfft_2p.so c_map1.so c_to_c.so buffernw.so checksum.so dicm_h.so >> dir_unix.so eget_wsz.so >> gif_r.so ip-hdr.so private.so piperead.so parsargu.so rast_r.so >> sock_cnct.so sock_init.so sock_s >> ubr.so swap_all.so table_if.so tv_empty.so tvmath.so u_db.so zreopen.so >> pip_read.so | tsort` >> FreeBSD clang version 6.0.1 (tags/RELEASE_601/final 335540) (based on >> LLVM 6.0.1) >> Target: x86_64-unknown-freebsd12.0 >> Thread model: posix >> InstalledDir: /usr/bin >> "/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 >> --hash-style=both --enable-ne >> w-dtags -o libccs.so /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o >> -L/usr/lib -r pip_read. >> so zreopen.so u_db.so tv_empty.so table_if.so rast_r.so parsargu.so >> piperead.so private.so ip-hd >> r.so gif_r.so eget_wsz.so dir_unix.so dicm_h.so checksum.so buffernw.so >> c_map1.so vfft_2p.so sub >> _mean.so to_8.so to_sep.so dbg_memsz.so time-out.so tv_random.so >> t_consum.so pgm_r.so pict_r.so >> ln2argv.so libppm3.so libppm1.so libpgm1.so libpbm2.so libpbm.so >> io_ready.so icc_r.so histgram.s >> o glb_vars.so gaussian.so fits_io.so filter_f.so eta.so dbvfft3d.so >> colort90.so c_map.so colorto >> g.so calibrate.so c_array.so arg_vc.so avail_type.so tvmath.so >> swap_all.so sock_init.so sock_cnc >> t.so vfft3d.so quantto8.so rotate90.so q_sort.so libpbm1.so libpbm4.so >> fourier.so sock_subr.so c >> _to_c.so zalloc.so errors.so message.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 >> /usr/bin/ld: error: attempted static link of dynamic object >> /usr/lib/libgcc_s.so >> /usr/bin/ld: error: attempted static link of dynamic object >> /usr/lib/libgcc_s.so >> cc: error: linker command failed with exit code 1 (use -v to see invocation) > I'm not really sure what you are trying to do. You are using -Wl,-r > which suggest you want to combine multiple object files into a single > object file. Normally the extension .o is used for object files but you > are using .so, which is normally used for libraries. Then the output is > named libccs.so which suggests you want to create a library. It's > confusing. > > If you want to combine object files you should not use cc, but ld: > ld -r -o libccs.so ... > > If you want to create a shared library use this: > cc -shared -o libccs.so ... This has been identified a toolchain bug: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=235896
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9d121114-8360-d93c-f86c-4d59611e303b>