From 3b21c21f3f5726823e19728fdd1571a14aae0fb3 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Mon, 27 Jun 2022 13:27:24 +0100 Subject: c++: avoid poisoning on musl [PR106102] On musl uses calloc() (via ). includes it indirectly and exposes use of poisoned calloc() when module code is built: /build/build/./prev-gcc/xg++ ... ../../gcc-13-20220626/gcc/cp/mapper-resolver.cc In file included from /<>/musl-1.2.3-dev/include/pthread.h:30, from /build/build/prev-x86_64-unknown-linux-musl/libstdc++-v3/include/x86_64-unknown-linux-musl/bits/gthr-default.h:35, .... from /build/build/prev-x86_64-unknown-linux-musl/libstdc++-v3/include/memory:77, from ../../gcc-13-20220626/gcc/../libcody/cody.hh:24, from ../../gcc-13-20220626/gcc/cp/../../c++tools/resolver.h:25, from ../../gcc-13-20220626/gcc/cp/../../c++tools/resolver.cc:23, from ../../gcc-13-20220626/gcc/cp/mapper-resolver.cc:32: /<>/musl-1.2.3-dev/include/sched.h:84:7: error: attempt to use poisoned "calloc" 84 | void *calloc(size_t, size_t); | ^ /<>/musl-1.2.3-dev/include/sched.h:124:36: error: attempt to use poisoned "calloc" 124 | #define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n))) | ^ gcc/cp/ PR c++/106102 * mapper-client.cc: Include via "system.h". * mapper-resolver.cc: Ditto. * module.cc: Ditto. libcc1/ PR c++/106102 * libcc1plugin.cc: Include via "system.h". * libcp1plugin.cc: Ditto. --- libcc1/libcc1plugin.cc | 1 + libcc1/libcp1plugin.cc | 1 + 2 files changed, 2 insertions(+) (limited to 'libcc1') diff --git a/libcc1/libcc1plugin.cc b/libcc1/libcc1plugin.cc index 12ab5a57..bdd0bda 100644 --- a/libcc1/libcc1plugin.cc +++ b/libcc1/libcc1plugin.cc @@ -31,6 +31,7 @@ #undef PACKAGE_TARNAME #undef PACKAGE_VERSION +#define INCLUDE_MEMORY #include "gcc-plugin.h" #include "system.h" #include "coretypes.h" diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc index 83dab7f..e2d5039 100644 --- a/libcc1/libcp1plugin.cc +++ b/libcc1/libcp1plugin.cc @@ -32,6 +32,7 @@ #undef PACKAGE_TARNAME #undef PACKAGE_VERSION +#define INCLUDE_MEMORY #include "gcc-plugin.h" #include "system.h" #include "coretypes.h" -- cgit v1.1