Bug 229246

Summary: -Wl,--unresolved-symbols=ignore-in-object-files fails for shared libraries
Product: Base System Reporter: Yuri Victorovich <yuri>
Component: miscAssignee: freebsd-bugs (Nobody) <bugs>
Status: New ---    
Severity: Affects Only Me    
Priority: ---    
Version: 11.1-STABLE   
Hardware: Any   
OS: Any   

Description Yuri Victorovich freebsd_committer 2018-06-23 06:36:50 UTC
This command line:
> c++ -Wl,--unresolved-symbols=ignore-in-object-files -shared -o libblank.so blank.cpp
fails:
> /usr/lib/libcxxrt.so: undefined reference to `_Unwind_GetDataRelBase@GCC_3.0'
> /usr/lib/libcxxrt.so: undefined reference to `_Unwind_SetIP@GCC_3.0'
> /usr/lib/libcxxrt.so: undefined reference to `_Unwind_GetIP@GCC_3.0'
> /lib/libc.so.7: undefined reference to `__progname'
> /usr/lib/libcxxrt.so: undefined reference to `_Unwind_RaiseException@GCC_3.0'
> /usr/lib/libcxxrt.so: undefined reference to `_Unwind_GetLanguageSpecificData@GCC_3.0'
> /usr/lib/libcxxrt.so: undefined reference to `_Unwind_GetRegionStart@GCC_3.0'
> /usr/lib/libcxxrt.so: undefined reference to `_Unwind_SetGR@GCC_3.0'
> /usr/lib/libc++.so.1: undefined reference to `_Unwind_Resume@GCC_3.0'
> /usr/lib/libcxxrt.so: undefined reference to `_Unwind_Backtrace@GCC_3.3'
> /usr/lib/libcxxrt.so: undefined reference to `_Unwind_Resume_or_Rethrow@GCC_3.3'
> /lib/libc.so.7: undefined reference to `environ'
> /usr/lib/libcxxrt.so: undefined reference to `_Unwind_GetTextRelBase@GCC_3.0'
> clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)

There are no object files that user supplied, so -Wl,--unresolved-symbols=ignore-in-object-files should be practically a noop?

I found this error in one of the projects, and it seems like a bug in the compiler to me. It should link whatever it links normally without this flag.