install symlink to liblto_plugin.so into lib/bfd-plugins

Submitted by patrick.oppenlander@gmail.com on Jan. 14, 2021, 4:03 a.m.

Details

Message ID 20210114040341.2524044-1-patrick.oppenlander@gmail.com
State New
Series "install symlink to liblto_plugin.so into lib/bfd-plugins"
Headers show

Commit Message

patrick.oppenlander@gmail.com Jan. 14, 2021, 4:03 a.m.
From: Patrick Oppenlander <patrick.oppenlander@gmail.com>

The ar, nm and ranlib tools will automatically load plugins from the
lib/bfd-plugins directory if present.

With this symlink in place it is no longer necessary to use the gcc-
prefixed versions of these tools (or the --plugin argument) to handle
LTO objects.
---
 litecross/Makefile | 2 ++
 1 file changed, 2 insertions(+)

Patch hide | download patch | download mbox

diff --git a/litecross/Makefile b/litecross/Makefile
index 8ec0ed2..8bae518 100644
--- a/litecross/Makefile
+++ b/litecross/Makefile
@@ -254,6 +254,8 @@  install-binutils: | obj_binutils/.lc_built
 install-gcc: | obj_gcc/.lc_built
 	cd obj_gcc && $(MAKE) MAKE="$(MAKE) $(LIBTOOL_ARG)" DESTDIR=$(DESTDIR)$(OUTPUT) install
 	ln -sf $(TARGET)-gcc $(DESTDIR)$(OUTPUT)/bin/$(TARGET)-cc
+	mkdir -p $(DESTDIR)$(OUTPUT)/lib/bfd-plugins
+	ln -sf ../../libexec/gcc/$(TARGET)/$(file < src_gcc/gcc/BASE-VER)/liblto_plugin.so $(DESTDIR)$(OUTPUT)/lib/bfd-plugins
 
 ifneq ($(LINUX_SRCDIR),)
 TARGET_ARCH = $(firstword $(subst -, ,$(TARGET)))

Comments

Szabolcs Nagy Jan. 14, 2021, 8:09 a.m.
* patrick.oppenlander@gmail.com <patrick.oppenlander@gmail.com> [2021-01-14 15:03:42 +1100]:
> From: Patrick Oppenlander <patrick.oppenlander@gmail.com>
> 
> The ar, nm and ranlib tools will automatically load plugins from the
> lib/bfd-plugins directory if present.
> 
> With this symlink in place it is no longer necessary to use the gcc-
> prefixed versions of these tools (or the --plugin argument) to handle
> LTO objects.
> ---
>  litecross/Makefile | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/litecross/Makefile b/litecross/Makefile
> index 8ec0ed2..8bae518 100644
> --- a/litecross/Makefile
> +++ b/litecross/Makefile
> @@ -254,6 +254,8 @@ install-binutils: | obj_binutils/.lc_built
>  install-gcc: | obj_gcc/.lc_built
>  	cd obj_gcc && $(MAKE) MAKE="$(MAKE) $(LIBTOOL_ARG)" DESTDIR=$(DESTDIR)$(OUTPUT) install
>  	ln -sf $(TARGET)-gcc $(DESTDIR)$(OUTPUT)/bin/$(TARGET)-cc
> +	mkdir -p $(DESTDIR)$(OUTPUT)/lib/bfd-plugins
> +	ln -sf ../../libexec/gcc/$(TARGET)/$(file < src_gcc/gcc/BASE-VER)/liblto_plugin.so $(DESTDIR)$(OUTPUT)/lib/bfd-plugins

file < BASE-VER

does not do anything useful for me, did you mean

cat BASE-VER

?

this does not work if different TARGETs are installed to the same OUTPUT

or is the plugin independent from target?
then maybe a copy would be better than a symlink
>  
>  ifneq ($(LINUX_SRCDIR),)
>  TARGET_ARCH = $(firstword $(subst -, ,$(TARGET)))
> -- 
> 2.30.0
patrick.oppenlander@gmail.com Jan. 14, 2021, 10:24 a.m.
On Thu, Jan 14, 2021 at 7:09 PM Szabolcs Nagy <nsz@port70.net> wrote:
>
> * patrick.oppenlander@gmail.com <patrick.oppenlander@gmail.com> [2021-01-14 15:03:42 +1100]:
> > From: Patrick Oppenlander <patrick.oppenlander@gmail.com>
> >
> > The ar, nm and ranlib tools will automatically load plugins from the
> > lib/bfd-plugins directory if present.
> >
> > With this symlink in place it is no longer necessary to use the gcc-
> > prefixed versions of these tools (or the --plugin argument) to handle
> > LTO objects.
> > ---
> >  litecross/Makefile | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/litecross/Makefile b/litecross/Makefile
> > index 8ec0ed2..8bae518 100644
> > --- a/litecross/Makefile
> > +++ b/litecross/Makefile
> > @@ -254,6 +254,8 @@ install-binutils: | obj_binutils/.lc_built
> >  install-gcc: | obj_gcc/.lc_built
> >       cd obj_gcc && $(MAKE) MAKE="$(MAKE) $(LIBTOOL_ARG)" DESTDIR=$(DESTDIR)$(OUTPUT) install
> >       ln -sf $(TARGET)-gcc $(DESTDIR)$(OUTPUT)/bin/$(TARGET)-cc
> > +     mkdir -p $(DESTDIR)$(OUTPUT)/lib/bfd-plugins
> > +     ln -sf ../../libexec/gcc/$(TARGET)/$(file < src_gcc/gcc/BASE-VER)/liblto_plugin.so $(DESTDIR)$(OUTPUT)/lib/bfd-plugins
>
> file < BASE-VER
>
> does not do anything useful for me, did you mean
>
> cat BASE-VER
>
> ?

It's this:

https://www.gnu.org/software/make/manual/html_node/File-Function.html

I think it was added in GNU make 4.0 around 2013.

> this does not work if different TARGETs are installed to the same OUTPUT
>
> or is the plugin independent from target?
> then maybe a copy would be better than a symlink

I believe the plugin is target independent but will change between gcc versions.

The plugin is only ~100k so a file copy should be fine. I can submit a
new patch tomorrow when I'm back on the dev box.

Patrick