mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-05 19:35:48 +03:00
Merge pull request #10159 from gilles-peskine-arm/union-initialization-gcc15-preliminaries-dev
Test with GCC 15
This commit is contained in:
@@ -50,8 +50,15 @@ int main(void)
|
|||||||
#if defined(MBEDTLS_SSL_TLS_C)
|
#if defined(MBEDTLS_SSL_TLS_C)
|
||||||
void *tls_so = dlopen(TLS_SO_FILENAME, RTLD_NOW);
|
void *tls_so = dlopen(TLS_SO_FILENAME, RTLD_NOW);
|
||||||
CHECK_DLERROR("dlopen", TLS_SO_FILENAME);
|
CHECK_DLERROR("dlopen", TLS_SO_FILENAME);
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
/* dlsym() returns an object pointer which is meant to be used as a
|
||||||
|
* function pointer. This has undefined behavior in standard C, so
|
||||||
|
* "gcc -std=c99 -pedantic" complains about it, but it is perfectly
|
||||||
|
* fine on platforms that have dlsym(). */
|
||||||
|
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||||
const int *(*ssl_list_ciphersuites)(void) =
|
const int *(*ssl_list_ciphersuites)(void) =
|
||||||
dlsym(tls_so, "mbedtls_ssl_list_ciphersuites");
|
dlsym(tls_so, "mbedtls_ssl_list_ciphersuites");
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
CHECK_DLERROR("dlsym", "mbedtls_ssl_list_ciphersuites");
|
CHECK_DLERROR("dlsym", "mbedtls_ssl_list_ciphersuites");
|
||||||
const int *ciphersuites = ssl_list_ciphersuites();
|
const int *ciphersuites = ssl_list_ciphersuites();
|
||||||
for (n = 0; ciphersuites[n] != 0; n++) {/* nothing to do, we're just counting */
|
for (n = 0; ciphersuites[n] != 0; n++) {/* nothing to do, we're just counting */
|
||||||
@@ -85,9 +92,15 @@ int main(void)
|
|||||||
CHECK_DLERROR("dlopen", TFPSACRYPTO_SO_FILENAME);
|
CHECK_DLERROR("dlopen", TFPSACRYPTO_SO_FILENAME);
|
||||||
crypto_so_filename = TFPSACRYPTO_SO_FILENAME;
|
crypto_so_filename = TFPSACRYPTO_SO_FILENAME;
|
||||||
}
|
}
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
/* dlsym() returns an object pointer which is meant to be used as a
|
||||||
|
* function pointer. This has undefined behavior in standard C, so
|
||||||
|
* "gcc -std=c99 -pedantic" complains about it, but it is perfectly
|
||||||
|
* fine on platforms that have dlsym(). */
|
||||||
|
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||||
const int *(*md_list)(void) =
|
const int *(*md_list)(void) =
|
||||||
dlsym(crypto_so, "mbedtls_md_list");
|
dlsym(crypto_so, "mbedtls_md_list");
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
CHECK_DLERROR("dlsym", "mbedtls_md_list");
|
CHECK_DLERROR("dlsym", "mbedtls_md_list");
|
||||||
const int *mds = md_list();
|
const int *mds = md_list();
|
||||||
for (n = 0; mds[n] != 0; n++) {/* nothing to do, we're just counting */
|
for (n = 0; mds[n] != 0; n++) {/* nothing to do, we're just counting */
|
||||||
|
@@ -73,6 +73,39 @@ support_test_gcc_latest_opt () {
|
|||||||
type "$GCC_LATEST" >/dev/null 2>/dev/null
|
type "$GCC_LATEST" >/dev/null 2>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Prepare for a non-regression for https://github.com/Mbed-TLS/mbedtls/issues/9814 :
|
||||||
|
# test with GCC 15.
|
||||||
|
# Eventually, $GCC_LATEST will be GCC 15 or above, and we can remove this
|
||||||
|
# separate component.
|
||||||
|
# For the time being, we don't make $GCC_LATEST be GCC 15 on the CI
|
||||||
|
# platform, because that would break branches where #9814 isn't fixed yet.
|
||||||
|
support_test_gcc15_drivers_opt () {
|
||||||
|
if type gcc-15 >/dev/null 2>/dev/null; then
|
||||||
|
GCC_15=gcc-15
|
||||||
|
elif [ -x /usr/local/gcc-15/bin/gcc-15 ]; then
|
||||||
|
GCC_15=/usr/local/gcc-15/bin/gcc-15
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
component_test_gcc15_drivers_opt () {
|
||||||
|
msg "build: GCC 15: full + test drivers dispatching to builtins"
|
||||||
|
scripts/config.py full
|
||||||
|
loc_cflags="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_CONFIG_ADJUST_TEST_ACCELERATORS"
|
||||||
|
loc_cflags="${loc_cflags} -I../framework/tests/include -O2"
|
||||||
|
# Until https://github.com/Mbed-TLS/mbedtls/issues/9814 is fixed,
|
||||||
|
# disable the new problematic optimization.
|
||||||
|
loc_cflags="${loc_cflags} -fzero-init-padding-bits=unions"
|
||||||
|
# Also allow a warning that we don't yet comply to.
|
||||||
|
# https://github.com/Mbed-TLS/mbedtls/issues/9944
|
||||||
|
loc_cflags="${loc_cflags} -Wno-error=unterminated-string-initialization"
|
||||||
|
|
||||||
|
make CC=$GCC_15 CFLAGS="${loc_cflags}" LDFLAGS="$ASAN_CFLAGS"
|
||||||
|
|
||||||
|
msg "test: GCC 15: full + test drivers dispatching to builtins"
|
||||||
|
make test
|
||||||
|
}
|
||||||
|
|
||||||
component_test_gcc_earliest_opt () {
|
component_test_gcc_earliest_opt () {
|
||||||
scripts/config.py full
|
scripts/config.py full
|
||||||
test_build_opt 'full config' "$GCC_EARLIEST" -O2
|
test_build_opt 'full config' "$GCC_EARLIEST" -O2
|
||||||
|
Submodule tf-psa-crypto updated: 5ab6c9c8d6...dc6c60204b
Reference in New Issue
Block a user