Message ID | 20210308140237.ec2ecc0123db.Ib0c23e3dda8322f9306a9dd04146e797eb0690b2@changeid |
---|---|
State | Accepted |
Headers | show |
Series | um: allow not setting extra rpaths in the linux binary | expand |
On Mon, 2021-03-08 at 14:02 +0100, Johannes Berg wrote: > +config LD_SCRIPT_DYN_RPATH > + bool "set rpath in the binary" if EXPERT > + default y > + depends on LD_SCRIPT_DYN Somehow, that seems to trigger Kconfig bug. The resulting option is not actually visible, although in a menuconfig search it's visibility is shown as being true, but it's shown *underneath* STATIC_LINK (Force a static link) which is actually not visible for me, and ... that's just weird? If I manually set it in the .config file then it does stick, however, so it's actually settable that way. That's actually good enough for me (and in fact, because I was doing it that way, I didn't even notice the issue at first!), but it's not really what I expected. johannes
diff --git a/arch/um/Kconfig b/arch/um/Kconfig index f64d774706e5..e5cc1aea223c 100644 --- a/arch/um/Kconfig +++ b/arch/um/Kconfig @@ -105,6 +105,19 @@ config LD_SCRIPT_DYN depends on !LD_SCRIPT_STATIC select MODULE_REL_CRCS if MODVERSIONS +config LD_SCRIPT_DYN_RPATH + bool "set rpath in the binary" if EXPERT + default y + depends on LD_SCRIPT_DYN + help + Add /lib (and /lib64 for 64-bit) to the linux binary's rpath + explicitly. + + You may need to turn this off if compiling for nix systems + that have their libraries in random /nix directories and + might otherwise unexpected use libraries from /lib or /lib64 + instead of the desired ones. + config HOSTFS tristate "Host filesystem" help diff --git a/arch/um/Makefile b/arch/um/Makefile index 1cea46ff9bb7..12a7acef0357 100644 --- a/arch/um/Makefile +++ b/arch/um/Makefile @@ -118,7 +118,8 @@ archprepare: $(Q)$(MAKE) $(build)=$(HOST_DIR)/um include/generated/user_constants.h LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static -LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib $(call cc-option, -no-pie) +LINK-$(CONFIG_LD_SCRIPT_DYN) += $(call cc-option, -no-pie) +LINK-$(CONFIG_LD_SCRIPT_DYN_RPATH) += -Wl,-rpath,/lib CFLAGS_NO_HARDENING := $(call cc-option, -fno-PIC,) $(call cc-option, -fno-pic,) \ -fno-stack-protector $(call cc-option, -fno-stack-protector-all) diff --git a/arch/x86/Makefile.um b/arch/x86/Makefile.um index 1db7913795f5..b3c1ae084180 100644 --- a/arch/x86/Makefile.um +++ b/arch/x86/Makefile.um @@ -44,7 +44,7 @@ ELF_FORMAT := elf64-x86-64 # Not on all 64-bit distros /lib is a symlink to /lib64. PLD is an example. -LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib64 +LINK-$(CONFIG_LD_SCRIPT_DYN_RPATH) += -Wl,-rpath,/lib64 LINK-y += -m64 endif