Skip to content

Commit 6f9d91c

Browse files
authored
[release/7.0] Suppress clang-16 warnings (backport #81573) (#84444)
Fix DBI loading problem on Linux (#82461)
1 parent bf7c094 commit 6f9d91c

File tree

5 files changed

+26
-6
lines changed

5 files changed

+26
-6
lines changed

eng/native/configurecompiler.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,15 @@ if (CLR_CMAKE_HOST_UNIX)
449449
add_compile_options(-Wno-incompatible-ms-struct)
450450

451451
add_compile_options(-Wno-reserved-identifier)
452+
453+
# clang 16.0 introduced buffer hardening https://discourse.llvm.org/t/rfc-c-buffer-hardening/65734
454+
# which we are not conforming to yet.
455+
add_compile_options(-Wno-unsafe-buffer-usage)
456+
457+
# other clang 16.0 suppressions
458+
add_compile_options(-Wno-single-bit-bitfield-constant-conversion)
459+
add_compile_options(-Wno-cast-function-type-strict)
460+
add_compile_options(-Wno-incompatible-function-pointer-types-strict)
452461
else()
453462
add_compile_options(-Wno-uninitialized)
454463
add_compile_options(-Wno-strict-aliasing)

src/coreclr/dlls/mscordbi/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,17 @@ elseif(CLR_CMAKE_HOST_UNIX)
100100
mscordaccore
101101
)
102102

103+
# Before llvm 16, lld was setting `--undefined-version` by default. The default was
104+
# flipped to `--no-undefined-version` in lld 16, so we will explicitly set it to
105+
# `--undefined-version` for our use-case.
106+
include(CheckLinkerFlag OPTIONAL)
107+
if(COMMAND check_linker_flag)
108+
check_linker_flag(CXX -Wl,--undefined-version LINKER_SUPPORTS_UNDEFINED_VERSION)
109+
if (LINKER_SUPPORTS_UNDEFINED_VERSION)
110+
add_linker_flag(-Wl,--undefined-version)
111+
endif(LINKER_SUPPORTS_UNDEFINED_VERSION)
112+
endif(COMMAND check_linker_flag)
113+
103114
# COREDBI_LIBRARIES is mentioned twice because ld is one pass linker and will not find symbols
104115
# if they are defined after they are used. Having all libs twice makes sure that ld will actually
105116
# find all symbols.

src/native/corehost/apphost/static/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ if(CLR_CMAKE_TARGET_WIN32)
6565
add_linker_flag("/DEF:${CMAKE_CURRENT_SOURCE_DIR}/singlefilehost.def")
6666

6767
else()
68-
if(CLR_CMAKE_TARGET_OSX)
69-
set(DEF_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/singlefilehost_OSXexports.src)
68+
if(CLR_CMAKE_TARGET_FREEBSD)
69+
set(DEF_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/singlefilehost_freebsdexports.src)
7070
else()
7171
set(DEF_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/singlefilehost_unixexports.src)
7272
endif()

src/native/corehost/apphost/static/singlefilehost_OSXexports.src renamed to src/native/corehost/apphost/static/singlefilehost_freebsdexports.src

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ g_dacTable
99

1010
; Used by profilers
1111
MetaDataGetDispenser
12+
13+
; FreeBSD needs to reexport these
14+
__progname
15+
environ

src/native/corehost/apphost/static/singlefilehost_unixexports.src

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,3 @@ g_dacTable
99

1010
; Used by profilers
1111
MetaDataGetDispenser
12-
13-
; FreeBSD needs to reexport these
14-
__progname
15-
environ

0 commit comments

Comments
 (0)