Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Jun 2020 20:49:38 -0700
From:      "Jin Guojun[VFF]" <>
Subject:   Why clang/cc needs libgcc_s in 11.4-R
Message-ID:  <>

Next in thread | Raw E-Mail | Index | Archive | Help
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 `lorder | 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 `lorder | tsort`
FreeBSD clang version 10.0.0 ( 
Target: x86_64-unknown-freebsd11.4
Thread model: posix
InstalledDir: /usr/bin
  "/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ 
--hash-style=both --enable-new-dtags -o /usr/lib/crt1.o 
/usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/lib -r -v -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,

Want to link to this message? Use this URL: <>