AR needs plugin to support LTO

Bug #1808722 reported by Marc Singer
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU Arm Embedded Toolchain
New
Undecided
Unassigned

Bug Description

The librarian reports that it needs a plugin to support LTO within library files.

/opt/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-ar -cru ../o/lib-glo/libglo.a ../base/o/lib-glo/start.o ...
/opt/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-ar: ../base/o/lib-glo/start.o: plugin needed to handle lto object

From a read of the man page, it looks like this is a configuration issue for the toolchain. The linker accepts the LTO object without issue. Per the ar documentation, the plugin for LTO must be available in ${libdir}/bfd-plugins. Creating links in /opt/gcc-arm-none-eabi-7-2018-q2-update/lib/bfd-plugins does eliminate the warning.

Should the installation of the toolchain include this fixup so that AR can handle LTO out-of-the-box?

Revision history for this message
Liviu Ionescu (ilg) wrote :

I confirm the problem, it occured to mee too.

My environment is Eclipse, building static libraries. In this configuration, the build process automatically compiles and archives the objects.

Here is an example of a build:

17:11:09 **** Build of configuration Debug for project static-lto ****
make all
Building file: ../file.c
Invoking: GNU ARM Cross C Compiler
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -flto -g3 -std=gnu11 -MMD -MP -MF"file.d" -MT"file.o" -c -o "file.o" "../file.c"
Finished building: ../file.c

Building target: libstatic-lto.a
Invoking: GNU ARM Cross Archiver
arm-none-eabi-ar -r "libstatic-lto.a" ./file.o
arm-none-eabi-ar: creating libstatic-lto.a
arm-none-eabi-ar: ./file.o: plugin needed to handle lto object
Finished building target: libstatic-lto.a

17:11:09 Build Finished. 0 errors, 0 warnings. (took 271ms)

On macOS, manually creating a link fixed the problem:

$ cd gcc-arm-none-eabi-8-2018-q4-major
$ mkdir -p lib/bfd-plugins
$ ln -s -v ../../$(find * -type f -name liblto_plugin.0.so) lib/bfd-plugins/liblto_plugin.so

I'm currently working on a solution for the GNU MCU Eclipse ARM Embedded GCC distribution to include this links automatically.

It would be good if the Arm distribution would do the same.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.