Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 86f85f5

Browse files
authored
Fix compilation under newer GCC/Clang (#28130)
Linking coreclr with gcc 10 or clang 11 (both of which default to -fno-common) fails with this error: [31%] Linking CXX shared library libdbgshim.so /usr/bin/ld: ../../pal/src/libcoreclrpal.a(dyn-info-list.c.o):src/pal/src/libunwind/src/mi/dyn-info-list.c:28: multiple definition of `_U_dyn_info_list'; ../../pal/src/libcoreclrpal.a(Linit.c.o):src/pal/src/libunwind/src/x86_64/Ginit.c:52: first defined here This commit fixes that, by switching to -fcommon as the default.
1 parent 10240c4 commit 86f85f5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

configurecompiler.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,9 @@ if (CLR_CMAKE_PLATFORM_UNIX)
478478
#These seem to indicate real issues
479479
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-invalid-offsetof>)
480480

481+
# Some newer compilers default to -fno-common; revert to -fcommon
482+
add_compile_options(-fcommon)
483+
481484
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
482485
# The -ferror-limit is helpful during the porting, it makes sure the compiler doesn't stop
483486
# after hitting just about 20 errors.

0 commit comments

Comments
 (0)