Bug 12280 - Makefiles don't support LTO
Summary: Makefiles don't support LTO
Status: RESOLVED DUPLICATE of bug 26792
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.22
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-02 01:16 UTC by H.J. Lu
Modified: 2022-07-22 22:36 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2010-12-02 01:16:00 UTC
In a combined gcc 4.6 + binutils tree configured with
-with-build-config=bootstrap-lto, I got

make -j8
...
...
libtool: link: /export/build/gnu/gcc-lto/build-x86_64-linux/./prev-gcc/xgcc
-B/export/build/gnu/gcc-lto/build-x86_64-linux/./prev-gcc/
-B/usr/gcc-4.6.0/x86_64-unknown-linux-gnu/bin/
-B/usr/gcc-4.6.0/x86_64-unknown-linux-gnu/bin/
-B/usr/gcc-4.6.0/x86_64-unknown-linux-gnu/lib/ -isystem
/usr/gcc-4.6.0/x86_64-unknown-linux-gnu/include -isystem
/usr/gcc-4.6.0/x86_64-unknown-linux-gnu/sys-include -W -Wall
-Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2
-flto=jobserver -fuse-linker-plugin -frandom-seed=1 -o .libs/as-new app.o as.o
atof-generic.o compress-debug.o cond.o depend.o dwarf2dbg.o dw2gencfi.o ecoff.o
ehopt.o expr.o flonum-copy.o flonum-konst.o flonum-mult.o frags.o hash.o
input-file.o input-scrub.o listing.o literal.o macro.o messages.o output-file.o
read.o remap.o sb.o stabs.o subsegs.o symbols.o write.o tc-i386.o obj-elf.o
atof-ieee.o  -L/export/build/gnu/gcc-lto/build-x86_64-linux/./ld
../opcodes/.libs/libopcodes.so
-L/export/build/gnu/gcc-lto/build-x86_64-linux/opcodes/../libiberty/pic
../bfd/.libs/libbfd.so
-L/export/build/gnu/gcc-lto/build-x86_64-linux/bfd/../libiberty/pic -liberty
../libiberty/libiberty.a -lz -Wl,-rpath -Wl,/usr/gcc-4.6.0/lib
make[3]: *** read jobs pipe EOF.  Stop.
make[3]: *** Waiting for unfinished jobs....
lto-wrapper: make returned 2 exit status
lto-wrapper failedcollect2: ld returned 1 exit status
make[2]: *** [as-new] Error 1
make[2]: Leaving directory `/export/build/gnu/gcc-lto/build-x86_64-linux/gas'
make[1]: *** [all-recursive] Error 1

Gcc manual says

---
     You can also specify `-flto=jobserver' to use GNU make's job
     server mode to determine the number of parallel jobs. This is
     useful when the Makefile calling GCC is already executing in
     parallel.  The parent Makefile will need a `+' prepended to the
     command recipe for this to work. This will likely only work if
     `MAKE' is GNU make.
---

Binutils Makefiles don't have `+' and failed.

[hjl@gnu-6 binutils]$ grep "^LINK" */Makefile.*
bfd/Makefile.in:LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
binutils/Makefile.in:LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
gas/Makefile.in:LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
gold/Makefile.in:LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
gprof/Makefile.in:LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
ld/Makefile.in:LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
opcodes/Makefile.am:LINK_FOR_BUILD = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) \
opcodes/Makefile.in:LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
opcodes/Makefile.in:LINK_FOR_BUILD = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) \
[hjl@gnu-6 binutils]$ 

We need to prepend `+'.
Comment 1 H.J. Lu 2022-07-22 22:36:26 UTC
Dup.

*** This bug has been marked as a duplicate of bug 26792 ***