Bug 2655

Summary: In /usr/bin/ldd shared library path mentioned multiple times ( RTLDLIST="/lib/ld-linux.so.2 /lib/ld-linux.so.2 )
Product: [Build System, Metadata & Runtime] OE-Core Reporter: veera <veerabrahmamvr>
Component: devtools / tool chainAssignee: Hongxu Jia <hongxu.jia>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Low CC: hongxu.jia, juro.bystricky, liezhi.yang, meta.mr.watcher, meta.watcher, raj.khem, randy.macleod, sanil.kumar, sgw, song.liu, venkatarg
Version: 2.5   
Target Milestone: 2.7 M2   
Hardware: Other   
OS: x86_64   
Whiteboard:
OS type for building Yocto: --- Type of Regression: Regression (Used to work)
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
observation screen shot is added none

Description veera 2012-06-25 09:42:03 UTC
Created attachment 606 [details]
observation screen shot is added

[Build version]:http://autobuilder.yoctoproject.org/pub/nightly/20120621-3/
[Issue]:shared library path is mentioned multiple times for RTLDLIST
Test Case:TC-2736
https://wiki.yoctoproject.org/wiki/images/a/a1/Yocto_1.3_M1_Test_Execution_Plan.pdf
Steps:
1)down load  bzImage-qemux86.bin core-image-sato-sdk-qemux86-20120621031842.rootfs.ext3  & poky-eglibc-i686-i586-toolchain-gmae-1.2+snapshot-20120621.tar.bz2
2)tar -xvf poky-eglibc-i686-i586-toolchain-gmae-1.2+snapshot-20120621.tar.bz2
3)Runqemu qemux86  bzImage-qemux86.bin core-image-sato-sdk-qemux86-0120621031842.rootfs.ext3
4)cat `which ldd` | grep RTLDLIST

Observation:
qemux86:/home/test# cat `which ldd` | grep RTLDLIST
RTDLIST="/lib/ld-linux.so.2 /lib/ld-linux.so.2 "--> 2 times
qemux86:/home/test# 
qemux86_64:/home/test# cat `which ldd` | grep RTLDLIST
RTLDLIST="/lib/ld-linux.so.2 /lib/ld-linux.so.2  /lib/ld-linux.so.2" --> 3 times
qemux86_64 :/home/test# 

Note @ This behavior observed on sato , sato_sdk  ( qemu_x86 ,qemu_x86_64 ) image profiles
Comment 1 veera 2012-11-26 07:18:18 UTC
root@qemux86-sato-sdksdk:/home# cat `which ldd` | grep RTLDLIST
RTLDLIST="/lib/ld-linux.so.2 /lib/ld-linux.so.2" --> same path 2 times
    for rtld in ${RTLDLIST}; do
root@qemux86:/home#


this is i obsered in the latest release 

http://autobuilder.yoctoproject.org/pub/nightly/20121121-3/
Comment 2 Bogdan Marinescu 2013-01-30 16:24:04 UTC
Patch submitted (eglibc: don't list the same path twice in RTLDLIST).
Comment 3 Bogdan Marinescu 2013-02-01 11:30:39 UTC
Patch merged.
Comment 4 Juro Bystricky 2018-01-23 22:30:20 UTC
As far as I can tell, the problem is still (or again?) there, check any recent ldd_2.26 package (compiled for multilib):

RTLDLIST="/lib/ld-linux.so.2 /lib64/ld-linux-x86-64.so.2 /libx32/ld-linux-x32.so.2 /lib64/ld-linux-x86-64.so.2 /lib/ld-linux.so.2"

Looking at the patch (for glibc_2.26.bb), seems incorrect logic:
if [ "${prevrtld}" != "${RTLDLIST}" ]
then
  sed -i ${B}/elf/ldd -e "s#^RTLDLIST=.*\$#RTLDLIST=\"${prevrtld} ${RTLDLIST}\"#"
fi


So if RTLDLIST is a subset of "prevltdlist", we concatenate it anyway, see what happens if we have:
prevrtld: /lib/ld-linux.so.2 /lib64/ld-linux-x86-64.so.2 /libx32/ld-linux-x32.so.2 /lib/ld-linux.so.2
RTLDLIST: /lib/ld-linux.so.2 /lib64/ld-linux-x86-64.so.2

So I have my doubts it ever worked.
Comment 5 Juro Bystricky 2018-02-05 17:47:51 UTC
building (a multilib) ldd with the latest master (as of Feb 04/2018), results in:
RTLDLIST="/lib/ld-linux.so.2 /lib64/ld-linux-x86-64.so.2 /libx32/ld-linux-x32.so.2 /lib64/ld-linux-x86-64.so.2 /lib/ld-linux.so.2"

So clearly there are duplicates,
Comment 6 Juro Bystricky 2018-02-05 18:45:45 UTC
patch sent to ML:
https://patchwork.openembedded.org/patch/147888/
Comment 7 Hongxu Jia 2018-12-10 01:33:49 UTC
Merged to oe-core

commit 3f839c0cdfe253677ebee47838fe476a0939e0aa
Author: Hongxu Jia <hongxu.jia@windriver.com>
Date:   Thu Dec 6 16:56:15 2018 +0800

    glibc: improve reproducibility with multilib
    
    Multilib builds specify several loaders which will end up embedded in
    some binaries or script files. To support reproducible builds, we must
    ensure the loaders are always in deterministic order.
    
    [YOCTO #2655]
    [YOCTO #12478]
    [YOCTO #12480]
    
    Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
    
    Improve the fix and rebase it to 2.28
    
    Here is the log of lib32-glibc
    [log.do_compile]
    |Adjust ldd script
    |ldd "/lib64/ld-linux-x86-64.so.2 /lib/ld-linux.so.2 /lib/ld-linux.so.2
    /lib64/ld-linux-x86-64.so.2" -> "/lib/ld-linux.so.2 /lib64/ld-linux-x86-64.so.2"
    [log.do_compile]
    
    Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
    Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>