0

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)?

7
  • What did you try already, like what GCC documentation about "use-linker-plugin" did you read? And why did it not help you? Commented Oct 6 at 9:23
  • Of coarse, i've read gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html. It says it does LTO if any of the objects was compiled with '-flto'. If i remove '-fuse-linker-plugin' the compilation fails with some symbols not found. Commented Oct 6 at 13:36
  • @thebusybee Anything i can check with strace? Commented Oct 6 at 13:41
  • Well, I rather thought about searching the web and reading some hits. For example gcc.gnu.org/legacy-ml/gcc-help/2016-01/msg00061.html, which at least gives a hint for "configuration": When compiling your own GCC, you provide configuration options. But you already have this in your first block in the question. So I would investigate how to configure GCC, in the context of LTO and the linker plugin. Such kind of documentation (and forum posts, and articles) is meant. Commented Oct 6 at 15:19
  • Another idea: Did you check that no pre-compiled cross-GCC for AVR exists for an aarch64 host? Commented Oct 6 at 15:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.