The gcc-6-branch at the current upstream revision (r246561) doesn't build when configured with the following options: "--target=msp430-elf --enable-languages=c,c++"
The gcc-5-branch does build with these options. Backporting r244727 and r243310 to the gcc-6-branch fixes the two build issues, so the build completes successfully. The patches are at the end of this message. I don't have write access to the GCC repository, so would appreciate if someone could backport these patches for me. The error message when building GCC on the gcc-6-branch: checking how size_t is mangled... x configure: error: Unknown underlying type for size_t make[1]: *** [configure-target-libstdc++-v3] Error 1 make[1]: Leaving directory `/srv/net/msp430/jozefl/gcc/build' make: *** [all] Error 2 Applying r244727 fixes this configure error. Discussion on this patch is here: https://gcc.gnu.org/ml/gcc-patches/2017-01/msg01448.html Rebuilding results in this new error: ../../../../../libstdc++-v3/src/c++11/cow-stdexcept.cc: In function âvoid* txnal_read_ptr(void* const*)â: ../../../../../libstdc++-v3/src/c++11/cow-stdexcept.cc:274:3: error: static assertion failed: Pointers must be 32 bits or 64 bits wide static_assert(sizeof(uint64_t) == sizeof(void*) ^~~~~~~~~~~~~ make[4]: *** [cow-stdexcept.lo] Error 1 Applying r243310 fixes this build error. Discussion on this patch is here: https://gcc.gnu.org/ml/gcc-patches/2016-11/msg00950.html GCC now builds successfully builds successfully: Target: msp430-elf Configured with: ../configure --target=msp430-elf --enable-languages=c,c++ Thread model: single gcc version 6.3.1 20170329 (GCC) The 2 patches are below, I verified GCC builds successfully for x86_64-unknown-linux-gnu with both applied. From b5aacd74cdd4209f28309d38d85cb0004cc93410 Mon Sep 17 00:00:00 2001 From: Jozef Lawrynowicz <joze...@somniumtech.com> Date: Thu, 30 Mar 2017 15:46:26 +0000 Subject: [PATCH 1/2] Backport r244727 2017-01-20 Joe Seymour <jo...@somniumtech.com> * acinclude.m4 (GLIBCXX_CHECK_SIZE_T_MANGLING): Support uint20_t. * configure: Regenerate. --- libstdc++-v3/acinclude.m4 | 8 ++++++-- libstdc++-v3/configure | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 0576560..e48cf96 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -4468,8 +4468,12 @@ AC_DEFUN([GLIBCXX_CHECK_SIZE_T_MANGLING], [ [glibcxx_cv_size_t_mangling=y], [ AC_TRY_COMPILE([], [extern __SIZE_TYPE__ x; extern unsigned short x;], - [glibcxx_cv_size_t_mangling=t], - [glibcxx_cv_size_t_mangling=x]) + [glibcxx_cv_size_t_mangling=t], [ + AC_TRY_COMPILE([], + [extern __SIZE_TYPE__ x; extern __int20 unsigned x;], + [glibcxx_cv_size_t_mangling=u6uint20], + [glibcxx_cv_size_t_mangling=x]) + ]) ]) ]) ]) diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index b5ae421..f8635f8 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -80555,6 +80555,21 @@ _ACEOF if ac_fn_c_try_compile "$LINENO"; then : glibcxx_cv_size_t_mangling=t else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +extern __SIZE_TYPE__ x; extern __int20 unsigned x; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glibcxx_cv_size_t_mangling=u6uint20 +else glibcxx_cv_size_t_mangling=x fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext @@ -80569,6 +80584,9 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_size_t_mangling" >&5 $as_echo "$glibcxx_cv_size_t_mangling" >&6; } if test $glibcxx_cv_size_t_mangling = x; then -- 2.9.3 ============= From: Jozef Lawrynowicz <joze...@somniumtech.com> Date: Thu, 30 Mar 2017 15:42:26 +0000 Subject: [PATCH 2/2] Backport r243310 Added #ifdef case for when void* is 16 bits so it compiles in AVR target. 2016-12-06 Felipe Magno de Almeida <fel...@expertisesolutions.com.br> * src/c++11/cow-stdexcept.cc: Add special case for 16 bit pointers. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@243310 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/src/c++11/cow-stdexcept.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/src/c++11/cow-stdexcept.cc b/libstdc++-v3/src/c++11/cow-stdexcept.cc index 31a89df..641b372 100644 --- a/libstdc++-v3/src/c++11/cow-stdexcept.cc +++ b/libstdc++-v3/src/c++11/cow-stdexcept.cc @@ -208,6 +208,8 @@ extern void* _ZGTtnaX (size_t sz) __attribute__((weak)); extern void _ZGTtdlPv (void* ptr) __attribute__((weak)); extern uint8_t _ITM_RU1(const uint8_t *p) ITM_REGPARM __attribute__((weak)); +extern uint16_t _ITM_RU2(const uint16_t *p) + ITM_REGPARM __attribute__((weak)); extern uint32_t _ITM_RU4(const uint32_t *p) ITM_REGPARM __attribute__((weak)); extern uint64_t _ITM_RU8(const uint64_t *p) @@ -272,12 +274,15 @@ _txnal_cow_string_C1_for_exceptions(void* that, const char* s, static void* txnal_read_ptr(void* const * ptr) { static_assert(sizeof(uint64_t) == sizeof(void*) - || sizeof(uint32_t) == sizeof(void*), - "Pointers must be 32 bits or 64 bits wide"); + || sizeof(uint32_t) == sizeof(void*) + || sizeof(uint16_t) == sizeof(void*), + "Pointers must be 16 bits, 32 bits or 64 bits wide"); #if __UINTPTR_MAX__ == __UINT64_MAX__ return (void*)_ITM_RU8((const uint64_t*)ptr); -#else +#elif __UINTPTR_MAX__ == __UINT32_MAX__ return (void*)_ITM_RU4((const uint32_t*)ptr); +#else + return (void*)_ITM_RU2((const uint16_t*)ptr); #endif } -- 2.9.3 On 21 March 2017 at 17:57, Jozef Lawrynowicz <joze...@somniumtech.com> wrote: > r244727 and r243310 from the gcc trunk are needed in the gcc-6-branch > to build gcc for the msp430 target with C and C++ support. > > Would it be possible for these patches to be backported to the > gcc-6-branch? The gcc-5-branch builds for msp430 with C and C++ > support, so isn't this technically a regression? -- Jozef Lawrynowicz Software Engineer SOMNIUM Technologies www.somniumtech.com