On 5/2/2017 6:52 PM, Brad King wrote: > On 05/02/2017 11:48 AM, Christian Pfeiffer wrote: >> turn depends on libgcc_s. Any library starting with 'gcc' is being >> ignored in CMakeParseImplicitLinkInfo.cmake L.136, so libgcc_s is being >> stripped from the commandline. PGI Fortran however does not need >> libgcc_s on its own and therefore won't link it. > You might be able to just remove `|gcc.*` from the regex. > The comment nearby says it is trying to remove libraries that > are expected to be common to all language toolchains, but that > is not the case for GCC's libraries when mixing vendors. It > may not be necessary to remove `gcc_s` even when all the tools > are GNU-based (e.g. gcc/g++/gfortran) because we only explicitly > link to implicit libraries for other languages that are not also > implicit to the link language. > > -Brad > I think it has been done to prevent libgcc(_s) from appearing very often in the link line. Before filtering, gcc's output gives me the libgcc and libgcc_s twice. PGI also has libgcc appearing numerous times (but not libgcc_s), once after every compiler support library it links itself. I think virtually every compiler uses libgcc, so my idea would have been to change the regex for GCC to gcc[^_].*
However, I was mainly asking because the general matching logic there can break down in other ways, too. For example, filtering libclang_rt.* will cause Clang builds that pull in sanitizers, e.g. memory sanitizer or UBsan, which both require libclang_rt.msan-... and libclang_tr.ubsan_... to be linked to break on e.g. Linux. This can be reproduced by using a C and CXX file, the C one built with CMAKE_C_FLAGS set to -fsanitize=memory and the CXX one without. I'm not sure how useful such a binary might be, but it's definitely a possible option to build it like that. (I'm not quite sure why libclang_rt would make sense on that list, though. Is this because of OSX?) It might be sufficient to change the GCC regex as above and the clang_rt one somehow (I'm not sure what it's supposed to filter, so I don't know how it would make sense). - Chris -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers