zhouwg / minigcc

customized toolchain for x86-ia32,learning and studying how Linaro create their various toolchain from scratch source code
GNU General Public License v2.0
0 stars 0 forks source link

"'__ATOMIC_ACQUIRE' undeclared" when build minigcc in Host x86-32 #2

Closed zhouwg closed 4 years ago

zhouwg commented 4 years ago

Host OS: cde-wg # cat /etc/issue CDEOS(Custom Design Engagement OS r2017 by cde-wg@cdeos.com) \n \l cde-wg #


Target: x86-32


Kernel: 5.4.1

GCC:

cde-wg # gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.5.4/lto-wrapper Target: i686-linux-gnu Configured with: ../../toolchains_src/gcc-4.5.4/configure --prefix=/usr --libexecdir=/usr/lib --enable-static --enable-share --enable-threads=posix --enable-c99 --enable-long-long --disable-libstdcxx-pch --disable-multilib --enable-languages=c,c++ --enable-mpfr --with-gnu-as --with-gnu-ld --enable-__cxa_atexit --with-gmp=/usr --with-mpfr=/usr --with-mpc=/usr --disable-nls --enable-languages=c,c++ --with-pkgversion='x86 toolchain for miniCDE' --with-bugurl=http://www.gnu.org --enable-clocale=gnu --with-system-zlib --host=i686-linux-gnu Thread model: posix gcc version 4.5.4 (x86 toolchain for miniCDE)


Desc:

gcc -c -m32 -g -O2 -DPLATFORM_PCLINUX -Wmissing-declarations -Wnested-externs -Wmissing-prototypes -DHAVE_CONFIG_H -I. -I/android/gcc/gcc-6.4.0/libbacktrace -I /android/gcc/gcc-6.4.0/libbacktrace/../include -I /android/gcc/gcc-6.4.0/libbacktrace/../libgcc -I ../libgcc -funwind-tables -frandom-seed=atomic.lo -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wmissing-format-attribute -Wcast-qual -g -O2 -c dwarf.c -o dwarf.o dwarf.c: In function 'dwarf_lookup_pc': dwarf.c:2694:18: warning: implicit declaration of function 'atomic_load_n' dwarf.c:2694:18: warning: nested extern declaration of 'atomic_load_n' dwarf.c:2694:26: error: 'ATOMIC_ACQUIRE' undeclared (first use in this function) dwarf.c:2694:26: note: each undeclared identifier is reported only once for each function it appears in dwarf.c:2754:4: warning: implicit declaration of function 'atomic_store_n' dwarf.c:2754:4: warning: nested extern declaration of 'atomic_store_n' dwarf.c:2754:4: error: 'ATOMIC_RELEASE' undeclared (first use in this function) dwarf.c: In function 'dwarf_fileline': dwarf.c:2889:12: error: 'ATOMIC_ACQUIRE' undeclared (first use in this function) dwarf.c: In function 'backtrace_dwarf_add': dwarf.c:3022:12: error: 'ATOMIC_ACQUIRE' undeclared (first use in this function) make[1]: [dwarf.o] Error 1 make[1]: Leaving directory `/android/minigcc/libbacktrace' make: [build] Error 2

zhouwg commented 4 years ago

quote from https://gcc.gnu.org/onlinedocs/gcc-4.7.1/gcc/_005f_005fatomic-Builtins.html:

There are 6 different memory models which can be specified. These map to the same names in the C++11 standard. Refer there or to the GCC wiki on atomic synchronization for more detailed definitions. These memory models integrate both barriers to code motion as well as synchronization requirements with other threads. These are listed in approximately ascending order of strength.

ATOMIC_RELAXED No barriers or synchronization. __ATOMIC_CONSUME Data dependency only for both barrier and synchronization with another thread. ATOMIC_ACQUIRE Barrier to hoisting of code and synchronizes with release (or stronger) semantic stores from another thread. __ATOMIC_RELEASE Barrier to sinking of code and synchronizes with acquire (or stronger) semantic loads from another thread. ATOMIC_ACQ_REL Full barrier in both directions and synchronizes with acquire loads and release stores in another thread. ATOMIC_SEQ_CST Full barrier in both directions and synchronizes with acquire loads and release stores in all threads.

I guess the toolchain which used in Host x86-ia32 should be upgrade to gcc-4.7+.