I'm cross-compiling avr-gcc statically (in order not to depend on Android linker) to work on aarch64 android devices. gcc is compiled with the flags:
generic_arm64:/data/data/myapp/files/sdk/hardware/tools/avr/bin # ./avr-g++ -v
Using built-in specs.
COLLECT_GCC=./avr-g++
Target: avr
Configured with: /home/anton/build-avr-gcc/.build/HOST-aarch64-linux-gnu/avr/src/gcc/configure --build=x86_64-build_pc-linux-gnu --host=aarch64-host_unknown-linux-gnu --target=avr --prefix=/home/anton/x-tools/HOST-aarch64-linux-gnu/avr --with-local-prefix=/home/anton/x-tools/HOST-aarch64-linux-gnu/avr/avr --with-headers=/home/anton/x-tools/HOST-aarch64-linux-gnu/avr/avr/include --with-newlib --enable-threads=no --disable-shared --with-pkgversion='crosstool-NG 1.24.0-rc3.1-f7b1ece' --disable-__cxa_atexit --disable-libgomp --disable-libmudflap --disable-libmpx --disable-libssp --disable-libquadmath --disable-libquadmath-support --with-gmp=/home/anton/build-avr-gcc/.build/HOST-aarch64-linux-gnu/avr/buildtools/complibs-host --with-mpfr=/home/anton/build-avr-gcc/.build/HOST-aarch64-linux-gnu/avr/buildtools/complibs-host --with-mpc=/home/anton/build-avr-gcc/.build/HOST-aarch64-linux-gnu/avr/buildtools/complibs-host --disable-lto --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++ -lm' --enable-target-optspace --disable-nls --enable-multiarch --enable-languages=c,c++ --enable-plugins --enable-lto
Thread model: single
I compile the files with -flto argument, eg.:
/data/user/0/myapp/files/sdk/hardware/tools/avr/bin/avr-g++ -no-canonical-prefixes -std=gnu++11 -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fpermissive -fno-threadsafe-statics -mmcu=atmega328p -DF_CPU=16000000L -MMD -flto -Wno-error=narrowing -DUSB_VID=null -DUSB_PID=null -DARDUINO=10812 -DIDE="ArduinoDroid" -DARDUINO_ARCH_AVR -DARDUINO_AVR_UNO -I/data/user/0/myapp/files/sdk/hardware/arduino/variants/standard -I/data/user/0/myapp/files/sdk/hardware/arduino/cores/arduino /data/user/0/myapp/files/sdk/hardware/arduino/cores/arduino/new.cpp -o /data/user/0/myapp/files/coreBuild/new.cpp.o
However when linking into .elf:
/data/user/0/myapp/files/sdk/hardware/tools/avr/bin/avr-gcc -no-canonical-prefixes -Os -flto -fuse-linker-plugin -Wl,--gc-sections -Wl,-T /data/user/0/myapp/files/sdk/hardware/tools/avr/avr/lib/ldscripts/avr5.x -mmcu=atmega328p -o /data/user/0/myapp/files/build/EchoString.cpp.elf ...
i'm getting the following:
avr-gcc: error: -fuse-linker-plugin is not supported in this configuration
What "this configuration" means? I do have the dedicated LTO executables on device:
130|generic_arm64:/data/data/myapp/files/sdk/hardware/tools/avr/libexec/gcc/avr/7.3.0 # ls
cc1 cc1plus collect2 liblto_plugin.a lto-wrapper lto1 plugin
130|generic_arm64:/data/data/myapp/files/sdk/hardware/tools/avr/avr/bin # ls
as avr-ld.bfd ld ld.bfd nm
Any env.variable pointing to the 'lto-wrapper' executable needed (I remember smth similar)?
strace?