* [Buildroot] [PATCH 0/2] Workaround for bug #7172: patchelf (branch yem/patchelf)
@ 2014-07-13 14:42 Yann E. MORIN
2014-07-13 14:42 ` [Buildroot] [PATCH 1/2] toolchain: linker options with a $ sign are not supported Yann E. MORIN
2014-07-13 14:42 ` [Buildroot] [PATCH 2/2] package/patchelf: new host package Yann E. MORIN
0 siblings, 2 replies; 7+ messages in thread
From: Yann E. MORIN @ 2014-07-13 14:42 UTC (permalink / raw)
To: buildroot
Hello All!
This series introduces a workaround for the limitations expressed in bug
#7172 [0], which explains that a variable containing a $ sign is incorrectly
expanded.
Since it is not trivial to actually fix #7172, this series implements a
workaround, by:
- explaining the limitation in the menuconfig and the manual
- adding patchelf as a host-package, so users can tweak ELF files
after the build (e.g. in a post-build script)
[0] https://bugs.buildroot.org/show_bug.cgi?id=7172
Regards,
Yann E. MORIN.
The following changes since commit 30252ae893298bf3f190b57d33c545e0e46c40db:
libgpgme: disable all tests (2014-07-12 20:47:38 +0200)
are available in the git repository at:
git://ymorin.is-a-geek.org/buildroot yem/patchelf
for you to fetch changes up to a8d871e1d1bf5eb507d24eac6f5dd51cda98a326:
package/patchelf: new host package (2014-07-13 16:38:43 +0200)
----------------------------------------------------------------
Yann E. MORIN (2):
toolchain: linker options with a $ sign are not supported
package/patchelf: new host package
docs/manual/known-issues.txt | 4 ++++
package/Config.in.host | 1 +
package/patchelf/Config.in.host | 7 +++++++
package/patchelf/patchelf.mk | 12 ++++++++++++
toolchain/toolchain-common.in | 3 +++
5 files changed, 27 insertions(+)
create mode 100644 package/patchelf/Config.in.host
create mode 100644 package/patchelf/patchelf.mk
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 7+ messages in thread* [Buildroot] [PATCH 1/2] toolchain: linker options with a $ sign are not supported 2014-07-13 14:42 [Buildroot] [PATCH 0/2] Workaround for bug #7172: patchelf (branch yem/patchelf) Yann E. MORIN @ 2014-07-13 14:42 ` Yann E. MORIN 2014-07-14 8:16 ` Thomas De Schampheleire 2014-07-13 14:42 ` [Buildroot] [PATCH 2/2] package/patchelf: new host package Yann E. MORIN 1 sibling, 1 reply; 7+ messages in thread From: Yann E. MORIN @ 2014-07-13 14:42 UTC (permalink / raw) To: buildroot As reported in bug #7172 [0], setting BR2_TARGET_LDFLAGS to a value containing a $ sign can lead to unexpected results. This is because it is very hard to know when the $ sign gets evaluated: - in the Buildroot-level make - in the shell called by the Buildroot-level make - in the package's own build-system, either at configure time, in the Makefile, in a shell in the Makefile... So, it is very difficult to know how much escaping that would need. A proposal is to use a shell variable to pass such values in-molested. But it is not that simple either, since it still contains a $ sign, and there no much certainty to when it would be evaluated. Instead, just document this limitation, both in the help text for BR2_TARGET_LDFLAGS, and in the known-issues section in the manual. Does not really fix #7172, but at least the limitation is documented. [0] https://bugs.buildroot.org/show_bug.cgi?id=7172 Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Mike Zick <minimod@morethan.org> --- docs/manual/known-issues.txt | 4 ++++ toolchain/toolchain-common.in | 3 +++ 2 files changed, 7 insertions(+) diff --git a/docs/manual/known-issues.txt b/docs/manual/known-issues.txt index 08469e9..5eaded9 100644 --- a/docs/manual/known-issues.txt +++ b/docs/manual/known-issues.txt @@ -3,6 +3,10 @@ = Known issues +* It is not possible to pass extra linker options via +BR2_TARGET_LDFLAGS+ + if such options contain a +$+ sign. For example, the following is known + to break: +BR2_TARGET_LDFLAGS="-Wl,-rpath=\'$ORIGIN/../lib'"+ + * The +ltp-testsuite+ package does not build with the default uClibc configuration used by the Buildroot toolchain backend. The LTP testsuite uses several functions that are considered obsolete, such diff --git a/toolchain/toolchain-common.in b/toolchain/toolchain-common.in index a91d247..e278a7f 100644 --- a/toolchain/toolchain-common.in +++ b/toolchain/toolchain-common.in @@ -110,6 +110,9 @@ config BR2_TARGET_LDFLAGS help Extra options to pass to the linker when building for the target. + Note that options with a '$' sign (eg. -Wl,-rpath='$ORIGIN/../lib') + are not supported. + config BR2_ECLIPSE_REGISTER bool "Register toolchain within Eclipse Buildroot plug-in" help -- 1.9.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH 1/2] toolchain: linker options with a $ sign are not supported 2014-07-13 14:42 ` [Buildroot] [PATCH 1/2] toolchain: linker options with a $ sign are not supported Yann E. MORIN @ 2014-07-14 8:16 ` Thomas De Schampheleire 2014-07-14 13:24 ` Yann E. MORIN 0 siblings, 1 reply; 7+ messages in thread From: Thomas De Schampheleire @ 2014-07-14 8:16 UTC (permalink / raw) To: buildroot Hi Yann, On Sun, Jul 13, 2014 at 4:42 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote: > As reported in bug #7172 [0], setting BR2_TARGET_LDFLAGS to a value > containing a $ sign can lead to unexpected results. > > This is because it is very hard to know when the $ sign gets evaluated: > - in the Buildroot-level make > - in the shell called by the Buildroot-level make > - in the package's own build-system, either at configure time, in the > Makefile, in a shell in the Makefile... > > So, it is very difficult to know how much escaping that would need. > > A proposal is to use a shell variable to pass such values in-molested. 'in-molested' sounds very odd to me. If you want to keep the expressive value ;-) you could maybe write non-molested, or unmolested (I don't really know the right prefix here, but I'm pretty sure that 'in' is not the one), or otherwise maybe 'untouched' ? > But it is not that simple either, since it still contains a $ sign, and > there no much certainty to when it would be evaluated. s/no/not/ > > Instead, just document this limitation, both in the help text for > BR2_TARGET_LDFLAGS, and in the known-issues section in the manual. > > Does not really fix #7172, but at least the limitation is documented. > > [0] https://bugs.buildroot.org/show_bug.cgi?id=7172 > > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> > Cc: Mike Zick <minimod@morethan.org> > --- > docs/manual/known-issues.txt | 4 ++++ > toolchain/toolchain-common.in | 3 +++ > 2 files changed, 7 insertions(+) > > diff --git a/docs/manual/known-issues.txt b/docs/manual/known-issues.txt > index 08469e9..5eaded9 100644 > --- a/docs/manual/known-issues.txt > +++ b/docs/manual/known-issues.txt > @@ -3,6 +3,10 @@ > > = Known issues > > +* It is not possible to pass extra linker options via +BR2_TARGET_LDFLAGS+ > + if such options contain a +$+ sign. For example, the following is known > + to break: +BR2_TARGET_LDFLAGS="-Wl,-rpath=\'$ORIGIN/../lib'"+ > + > * The +ltp-testsuite+ package does not build with the default uClibc > configuration used by the Buildroot toolchain backend. The LTP > testsuite uses several functions that are considered obsolete, such > diff --git a/toolchain/toolchain-common.in b/toolchain/toolchain-common.in > index a91d247..e278a7f 100644 > --- a/toolchain/toolchain-common.in > +++ b/toolchain/toolchain-common.in > @@ -110,6 +110,9 @@ config BR2_TARGET_LDFLAGS > help > Extra options to pass to the linker when building for the target. > > + Note that options with a '$' sign (eg. -Wl,-rpath='$ORIGIN/../lib') > + are not supported. > + > config BR2_ECLIPSE_REGISTER > bool "Register toolchain within Eclipse Buildroot plug-in" > help Thanks for working on this! Best regards, Thomas ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH 1/2] toolchain: linker options with a $ sign are not supported 2014-07-14 8:16 ` Thomas De Schampheleire @ 2014-07-14 13:24 ` Yann E. MORIN 0 siblings, 0 replies; 7+ messages in thread From: Yann E. MORIN @ 2014-07-14 13:24 UTC (permalink / raw) To: buildroot Thomas, All, On 2014-07-14 10:16 +0200, Thomas De Schampheleire spake thusly: > On Sun, Jul 13, 2014 at 4:42 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote: > > As reported in bug #7172 [0], setting BR2_TARGET_LDFLAGS to a value > > containing a $ sign can lead to unexpected results. > > > > This is because it is very hard to know when the $ sign gets evaluated: > > - in the Buildroot-level make > > - in the shell called by the Buildroot-level make > > - in the package's own build-system, either at configure time, in the > > Makefile, in a shell in the Makefile... > > > > So, it is very difficult to know how much escaping that would need. > > > > A proposal is to use a shell variable to pass such values in-molested. > > 'in-molested' sounds very odd to me. If you want to keep the > expressive value ;-) you could maybe write non-molested, or unmolested > (I don't really know the right prefix here, but I'm pretty sure that > 'in' is not the one), or otherwise maybe 'untouched' ? Yep, my fingers are not so precise, and hit the wrong key. No matter how many times I re-read myself, I always miss typoes. > > But it is not that simple either, since it still contains a $ sign, and > > there no much certainty to when it would be evaluated. > s/no/not/ Both fixed, thanks. Regards, Yann E. MORIN. > > Instead, just document this limitation, both in the help text for > > BR2_TARGET_LDFLAGS, and in the known-issues section in the manual. > > > > Does not really fix #7172, but at least the limitation is documented. > > > > [0] https://bugs.buildroot.org/show_bug.cgi?id=7172 > > > > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> > > Cc: Mike Zick <minimod@morethan.org> > > --- > > docs/manual/known-issues.txt | 4 ++++ > > toolchain/toolchain-common.in | 3 +++ > > 2 files changed, 7 insertions(+) > > > > diff --git a/docs/manual/known-issues.txt b/docs/manual/known-issues.txt > > index 08469e9..5eaded9 100644 > > --- a/docs/manual/known-issues.txt > > +++ b/docs/manual/known-issues.txt > > @@ -3,6 +3,10 @@ > > > > = Known issues > > > > +* It is not possible to pass extra linker options via +BR2_TARGET_LDFLAGS+ > > + if such options contain a +$+ sign. For example, the following is known > > + to break: +BR2_TARGET_LDFLAGS="-Wl,-rpath=\'$ORIGIN/../lib'"+ > > + > > * The +ltp-testsuite+ package does not build with the default uClibc > > configuration used by the Buildroot toolchain backend. The LTP > > testsuite uses several functions that are considered obsolete, such > > diff --git a/toolchain/toolchain-common.in b/toolchain/toolchain-common.in > > index a91d247..e278a7f 100644 > > --- a/toolchain/toolchain-common.in > > +++ b/toolchain/toolchain-common.in > > @@ -110,6 +110,9 @@ config BR2_TARGET_LDFLAGS > > help > > Extra options to pass to the linker when building for the target. > > > > + Note that options with a '$' sign (eg. -Wl,-rpath='$ORIGIN/../lib') > > + are not supported. > > + > > config BR2_ECLIPSE_REGISTER > > bool "Register toolchain within Eclipse Buildroot plug-in" > > help > > > > Thanks for working on this! > Best regards, > Thomas -- .-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH 2/2] package/patchelf: new host package 2014-07-13 14:42 [Buildroot] [PATCH 0/2] Workaround for bug #7172: patchelf (branch yem/patchelf) Yann E. MORIN 2014-07-13 14:42 ` [Buildroot] [PATCH 1/2] toolchain: linker options with a $ sign are not supported Yann E. MORIN @ 2014-07-13 14:42 ` Yann E. MORIN 2014-07-14 8:18 ` Thomas De Schampheleire 1 sibling, 1 reply; 7+ messages in thread From: Yann E. MORIN @ 2014-07-13 14:42 UTC (permalink / raw) To: buildroot In some situations, users may want to tweak the dynamic section of the binaries (for example to add/set the RPATH to $ORIGIN/../lib). Because it is not trivial to do it properly from the Buildroot infrastructure, allow those users to use patchelf (e.g. from a post-build script) to tweak binaries. patchelf is able to: - modify an existing DT_RUNPATH tags - add a DT_RUNPATH tag is not already present - do the above to the DT_RPATH tag, too - set the path to the interpreter - remove DT_NEEDED tags - query a inary for the DT_RUNPATH/DT_RPATH tag, or for the interpreter path Does not really fix #7172, but this is workaround. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Mike Zick <minimod@morethan.org> --- package/Config.in.host | 1 + package/patchelf/Config.in.host | 7 +++++++ package/patchelf/patchelf.mk | 12 ++++++++++++ 3 files changed, 20 insertions(+) create mode 100644 package/patchelf/Config.in.host create mode 100644 package/patchelf/patchelf.mk diff --git a/package/Config.in.host b/package/Config.in.host index 062c6c9..e05bbfa 100644 --- a/package/Config.in.host +++ b/package/Config.in.host @@ -13,6 +13,7 @@ menu "Host utilities" source "package/omap-u-boot-utils/Config.in.host" source "package/openocd/Config.in.host" source "package/parted/Config.in.host" + source "package/patchelf/Config.in.host" source "package/pwgen/Config.in.host" source "package/sam-ba/Config.in.host" source "package/squashfs/Config.in.host" diff --git a/package/patchelf/Config.in.host b/package/patchelf/Config.in.host new file mode 100644 index 0000000..d1c8375 --- /dev/null +++ b/package/patchelf/Config.in.host @@ -0,0 +1,7 @@ +config BR2_PACKAGE_HOST_PATCHELF + bool "host patchelf" + help + PatchELF is a small utility to modify the dynamic linker + and RPATH of ELF executables. + + http://nixos.org/patchelf.html diff --git a/package/patchelf/patchelf.mk b/package/patchelf/patchelf.mk new file mode 100644 index 0000000..1a8e48d --- /dev/null +++ b/package/patchelf/patchelf.mk @@ -0,0 +1,12 @@ +################################################################################ +# +# patchelf +# +################################################################################ + +PATCHELF_VERSION = 0.8 +PATCHELF_SITE = http://releases.nixos.org/patchelf/patchelf-0.8/ +PATCHELF_LICENSE = GPLv3 +PATCHELF_LICENSE_FILES = COPYING + +$(eval $(host-autotools-package)) -- 1.9.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH 2/2] package/patchelf: new host package 2014-07-13 14:42 ` [Buildroot] [PATCH 2/2] package/patchelf: new host package Yann E. MORIN @ 2014-07-14 8:18 ` Thomas De Schampheleire 2014-07-14 13:25 ` Yann E. MORIN 0 siblings, 1 reply; 7+ messages in thread From: Thomas De Schampheleire @ 2014-07-14 8:18 UTC (permalink / raw) To: buildroot Hi Yann, On Sun, Jul 13, 2014 at 4:42 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote: > In some situations, users may want to tweak the dynamic section of the > binaries (for example to add/set the RPATH to $ORIGIN/../lib). > > Because it is not trivial to do it properly from the Buildroot > infrastructure, allow those users to use patchelf (e.g. from a > post-build script) to tweak binaries. > > patchelf is able to: > - modify an existing DT_RUNPATH tags > - add a DT_RUNPATH tag is not already present s/is/if/ > - do the above to the DT_RPATH tag, too > - set the path to the interpreter > - remove DT_NEEDED tags > - query a inary for the DT_RUNPATH/DT_RPATH tag, or for the s/inary/binary/ > interpreter path > > Does not really fix #7172, but this is workaround. > > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> > Cc: Mike Zick <minimod@morethan.org> > --- > package/Config.in.host | 1 + > package/patchelf/Config.in.host | 7 +++++++ > package/patchelf/patchelf.mk | 12 ++++++++++++ > 3 files changed, 20 insertions(+) > create mode 100644 package/patchelf/Config.in.host > create mode 100644 package/patchelf/patchelf.mk > > diff --git a/package/Config.in.host b/package/Config.in.host > index 062c6c9..e05bbfa 100644 > --- a/package/Config.in.host > +++ b/package/Config.in.host > @@ -13,6 +13,7 @@ menu "Host utilities" > source "package/omap-u-boot-utils/Config.in.host" > source "package/openocd/Config.in.host" > source "package/parted/Config.in.host" > + source "package/patchelf/Config.in.host" > source "package/pwgen/Config.in.host" > source "package/sam-ba/Config.in.host" > source "package/squashfs/Config.in.host" > diff --git a/package/patchelf/Config.in.host b/package/patchelf/Config.in.host > new file mode 100644 > index 0000000..d1c8375 > --- /dev/null > +++ b/package/patchelf/Config.in.host > @@ -0,0 +1,7 @@ > +config BR2_PACKAGE_HOST_PATCHELF > + bool "host patchelf" > + help > + PatchELF is a small utility to modify the dynamic linker > + and RPATH of ELF executables. > + > + http://nixos.org/patchelf.html > diff --git a/package/patchelf/patchelf.mk b/package/patchelf/patchelf.mk > new file mode 100644 > index 0000000..1a8e48d > --- /dev/null > +++ b/package/patchelf/patchelf.mk > @@ -0,0 +1,12 @@ > +################################################################################ > +# > +# patchelf > +# > +################################################################################ > + > +PATCHELF_VERSION = 0.8 > +PATCHELF_SITE = http://releases.nixos.org/patchelf/patchelf-0.8/ > +PATCHELF_LICENSE = GPLv3 > +PATCHELF_LICENSE_FILES = COPYING > + > +$(eval $(host-autotools-package)) > -- Best regards, Thomas ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH 2/2] package/patchelf: new host package 2014-07-14 8:18 ` Thomas De Schampheleire @ 2014-07-14 13:25 ` Yann E. MORIN 0 siblings, 0 replies; 7+ messages in thread From: Yann E. MORIN @ 2014-07-14 13:25 UTC (permalink / raw) To: buildroot Thomas, All, On 2014-07-14 10:18 +0200, Thomas De Schampheleire spake thusly: > On Sun, Jul 13, 2014 at 4:42 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote: > > In some situations, users may want to tweak the dynamic section of the > > binaries (for example to add/set the RPATH to $ORIGIN/../lib). > > > > Because it is not trivial to do it properly from the Buildroot > > infrastructure, allow those users to use patchelf (e.g. from a > > post-build script) to tweak binaries. > > > > patchelf is able to: > > - modify an existing DT_RUNPATH tags > > - add a DT_RUNPATH tag is not already present > > s/is/if/ > > > - do the above to the DT_RPATH tag, too > > - set the path to the interpreter > > - remove DT_NEEDED tags > > - query a inary for the DT_RUNPATH/DT_RPATH tag, or for the > > s/inary/binary/ Both fixed, thanks Regards, Yann E. MORIN. > > interpreter path > > > > Does not really fix #7172, but this is workaround. > > > > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> > > Cc: Mike Zick <minimod@morethan.org> > > --- > > package/Config.in.host | 1 + > > package/patchelf/Config.in.host | 7 +++++++ > > package/patchelf/patchelf.mk | 12 ++++++++++++ > > 3 files changed, 20 insertions(+) > > create mode 100644 package/patchelf/Config.in.host > > create mode 100644 package/patchelf/patchelf.mk > > > > diff --git a/package/Config.in.host b/package/Config.in.host > > index 062c6c9..e05bbfa 100644 > > --- a/package/Config.in.host > > +++ b/package/Config.in.host > > @@ -13,6 +13,7 @@ menu "Host utilities" > > source "package/omap-u-boot-utils/Config.in.host" > > source "package/openocd/Config.in.host" > > source "package/parted/Config.in.host" > > + source "package/patchelf/Config.in.host" > > source "package/pwgen/Config.in.host" > > source "package/sam-ba/Config.in.host" > > source "package/squashfs/Config.in.host" > > diff --git a/package/patchelf/Config.in.host b/package/patchelf/Config.in.host > > new file mode 100644 > > index 0000000..d1c8375 > > --- /dev/null > > +++ b/package/patchelf/Config.in.host > > @@ -0,0 +1,7 @@ > > +config BR2_PACKAGE_HOST_PATCHELF > > + bool "host patchelf" > > + help > > + PatchELF is a small utility to modify the dynamic linker > > + and RPATH of ELF executables. > > + > > + http://nixos.org/patchelf.html > > diff --git a/package/patchelf/patchelf.mk b/package/patchelf/patchelf.mk > > new file mode 100644 > > index 0000000..1a8e48d > > --- /dev/null > > +++ b/package/patchelf/patchelf.mk > > @@ -0,0 +1,12 @@ > > +################################################################################ > > +# > > +# patchelf > > +# > > +################################################################################ > > + > > +PATCHELF_VERSION = 0.8 > > +PATCHELF_SITE = http://releases.nixos.org/patchelf/patchelf-0.8/ > > +PATCHELF_LICENSE = GPLv3 > > +PATCHELF_LICENSE_FILES = COPYING > > + > > +$(eval $(host-autotools-package)) > > -- > > Best regards, > Thomas -- .-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-07-14 13:25 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-07-13 14:42 [Buildroot] [PATCH 0/2] Workaround for bug #7172: patchelf (branch yem/patchelf) Yann E. MORIN 2014-07-13 14:42 ` [Buildroot] [PATCH 1/2] toolchain: linker options with a $ sign are not supported Yann E. MORIN 2014-07-14 8:16 ` Thomas De Schampheleire 2014-07-14 13:24 ` Yann E. MORIN 2014-07-13 14:42 ` [Buildroot] [PATCH 2/2] package/patchelf: new host package Yann E. MORIN 2014-07-14 8:18 ` Thomas De Schampheleire 2014-07-14 13:25 ` Yann E. MORIN
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox