Opened 5 years ago

Closed 3 years ago

#13186 closed defect (fixed)

LD_PRELOAD does not work anymore with ATTITUDE ADJUSTMENT (12.09-rc1, r34185)

Reported by: kontakt@… Owned by: developers
Priority: normal Milestone: Barrier Breaker 14.07
Component: packages Version: Trunk
Keywords: Cc:


root@OpenWrt:~# export LD_PRELOAD=/opt/lib/
root@OpenWrt:~# ldd /bin/ls => /lib/ (0x77a21000) => /lib/ (0x779fc000) => /lib/ (0x779d9000) => /lib/ (0x7796d000) => /lib/ (0x77a48000)

it worked with every previous release, can someone please fix that?

I guess it's disabled since it's a new feature in uclibc to turn it off?

Enable library loader LD_PRELOAD environment (LDSO_PRELOAD_ENV_SUPPORT) [Y/n/?] (NEW)
Enable library loader preload file ( (LDSO_PRELOAD_FILE_SUPPORT) [N/y/?] (NEW) works on every linux system by default, it should be Y by default, however it's not as important as the LD_PRELOAD parameter itself.

Attachments (0)

Change History (9)

comment:1 Changed 5 years ago by florian

Can you test if trunk is also affected by this bug? Thanks!

comment:2 Changed 5 years ago by nbd

  • Resolution set to no_response
  • Status changed from new to closed

comment:3 Changed 5 years ago by SB_Prime@…

  • Resolution no_response deleted
  • Status changed from closed to reopened

I tested this on:

  • 12.09-rc1
  • 12.09-rc2
  • 12.09
  • trunk (r36570 07-May-2013 17:32)

I used the brcm47xx-squashfs binaries.

On all those builds the LD_PRELOAD does not work.

comment:4 Changed 4 years ago by anonymous

does anyone know where the uclibc configuration file is? Because it has to be enabled there. Unfortunately I lost the exact link to it.

comment:5 Changed 4 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

comment:6 Changed 3 years ago by rmilecki

When using uClibc (it's default unless you're using OpenWrt svn branch for DD or later release) you need to enable LDSO_PRELOAD_ENV_SUPPORT option to have LD_PRELOAD support.

OpenWrt keeps uClibc specific files in toolchain/uClibc/ directory (you can find configs & patches there).
OpenWrt builds uClibc in the build_dir/toolchain-*/uClibc/ directory.

If you take a look at the place where LDSO_PRELOAD_ENV_SUPPORT is defined:

vim build_dir/toolchain-*/uClibc/extra/Configs/

you'll see that LDSO_PRELOAD_ENV_SUPPORT is default y and it only depends on HAVE_SHARED.

A quick test how OpenWrt compiles uClibc:

egrep "HAVE_SHARED|LDSO_PRELOAD_ENV_SUPPORT" build_dir/toolchain-*/uClibc/.config

So there is something disabling LDSO_PRELOAD_ENV_SUPPORT, but I don't know yet what...

comment:7 Changed 3 years ago by rmilecki

There is some log (grabbed from bcm53xx) how .config gets generated:

make[2]: Entering directory `$OPENWRT/toolchain/uClibc/headers'
$OPENWRT/scripts/ -n '+' ../config-  ../config- > $OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc-
$OPENWRT/staging_dir/host/bin/sed -i -e 's,^KERNEL_HEADERS=.*,KERNEL_HEADERS=\"$OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc-\",g' -e 's,^.*UCLIBC_HAS_FPU.*,UCLIBC_HAS_FPU=n,g' -e 's,^.*UCLIBC_HAS_SOFT_FLOAT.*,UCLIBC_HAS_SOFT_FLOAT=y,g' -e 's,^.*UCLIBC_HAS_SHADOW.*,UCLIBC_HAS_SHADOW=y,g' -e 's,^.*UCLIBC_HAS_LOCALE.*,UCLIBC_HAS_LOCALE=n,g' -e 's,^.*UCLIBC_BUILD_ALL_LOCALE.*,UCLIBC_BUILD_ALL_LOCALE=n,g' -e 's,^.*UCLIBC_HAS_SSP.*,UCLIBC_HAS_SSP=n,g' $OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc-
cmp -s $OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc- $OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc- || { cp $OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc- $OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc- && make -C $OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc- oldconfig KBUILD_HAVE_NLS= HOSTCFLAGS="-DKBUILD_NO_NLS" && make -C $OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc- conf KBUILD_HAVE_NLS= HOSTCFLAGS="-DKBUILD_NO_NLS" && cp $OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc- $OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc-; }
make[3]: Entering directory `$OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc-'
install -d include/config
make -C extra/config conf
gcc $OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc-  -c -o ../../extra/config/conf.o -DCURSES_LOC="<ncurses.h>" -DLOCALE  -DKBUILD_NO_NLS   
cat $OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc- > ../../extra/config/
cat $OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc- > ../../extra/config/lex.zconf.c
cat $OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc- > ../../extra/config/zconf.hash.c
gcc ../../extra/config/  -c -o ../../extra/config/ -DCURSES_LOC="<ncurses.h>" -DLOCALE  -DKBUILD_NO_NLS -I$OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc-  
gcc ../../extra/config/conf.o ../../extra/config/  -o ../../extra/config/conf -lncurses   -DCURSES_LOC="<ncurses.h>" -DLOCALE  -DKBUILD_NO_NLS   
extra/config/conf -o extra/Configs/
# configuration written to ./.config
Last edited 3 years ago by rmilecki (previous) (diff)

comment:8 Changed 3 years ago by rmilecki

Oh wait, it was fixed in r45004. I just had to do make toolchain/clean V=s to force OpenWrt recompile uClibc properly.

comment:9 Changed 3 years ago by rmilecki

  • Resolution set to fixed
  • Status changed from reopened to closed

Fixed in CC release.

Add Comment

Modify Ticket

as closed .
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.