[PATCH] Add gcc-ar/nm/ranlib wrappers for slim LTO

Joseph S. Myers joseph@codesourcery.com
Thu Oct 20 15:24:00 GMT 2011


On Thu, 20 Oct 2011, Andi Kleen wrote:

> The logic gcc.c uses to find the files is very complicated. I didn't
> try to replicate it 100% and left out some magic. I would be interested
> if this simple method works for everyone or if more code needs
> to be added. This only needs to support LTO supporting hosts of course.

Certainly it needs to work for the installed prefix being different from 
the configured prefix, which means using make_relative_prefix.

> +install-gcc-ar:
> +	$(INSTALL_PROGRAM) gcc-ar$(exeext) $(DESTDIR)$(bindir)/gcc-ar$(exeext)
> +	$(INSTALL_PROGRAM) gcc-ar$(exeext) $(DESTDIR)$(bindir)/gcc-nm$(exeext)
> +	$(INSTALL_PROGRAM) gcc-ar$(exeext) $(DESTDIR)$(bindir)/gcc-ranlib$(exeext)

Programs should be installed under names that:

* begin with $(target_noncanonical)-;

* only have copies / links without that prefix in the case of a native 
compiler;

* respect $(program_transform_name), for any program installed in bindir 
(see GCC_INSTALL_NAME etc.).

The logic for installing the Go driver in go/Make-lang.in is probably the 
most modern version of the code to install a program in bindir, minus the 
cruft in some of the older bits of code.

Also, the GNU Coding Standards specify that the program's behavior should 
not depend on the name by which it is run.  Thus, you do need to build 
separate programs for each case (they might use a single source file built 
with separate defines).

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Gcc-patches mailing list