prelink: Allow it to work on 64 bit binaries in /lib
PATCH 1/1 prelink: Allow it to work on 64 bit binaries in /lib
Checks within prelink force 64 bit binaries into lib64 and n32 binaries into lib32. We load prelink.conf with all combinations but this code then defeats it for us and means /lib is ignored.
Comment out this code to disable it and allow our settings to work. This allows 64 bit binaries in /lib to work. We pass in the correct dyanamic loader path anyhow and our binaries don't contain ld.so so this should be safe for us.
meta/recipes-devtools/prelink/prelink/64bitfix.patch new file +35 -0
@@ -0,0 +1,35 @@ +These checks force 64 bit binaries into lib64 and n32 binaries into lib32. We +load prelink.conf with all combinations but this code then defeats it for us +and means /lib is ignored. + +Comment out this code to disable it and allow our settings to work. This +allows 64 bit binaries in /lib to work. We pass in the correct dyanamic +loader path anyhow and our binaries don't contain ld.so so this should be +safe for us. + +Upstream-Status: Inappropriate +RP 2015/9/23 + + +Index: trunk/src/rtld/rtld.c +=================================================================== +--- trunk.orig/src/rtld/rtld.c ++++ trunk/src/rtld/rtld.c +@@ -334,7 +334,7 @@ load_ld_so_conf (int use_64bit, int use_ + + /* Only use the correct machine, to prevent mismatches if we + have both /lib/ld.so and /lib64/ld.so on x86-64. */ +- if (use_64bit) ++ /*if (use_64bit) + { + dst_LIB = "lib64"; + add_dir (&ld_dirs, "/lib64/tls", strlen ("/lib64/tls")); +@@ -350,7 +350,7 @@ load_ld_so_conf (int use_64bit, int use_ + add_dir (&ld_dirs, "/usr/lib32/tls", strlen ("/usr/lib32/tls")); + add_dir (&ld_dirs, "/usr/lib32", strlen ("/usr/lib32")); + } +- else ++ else*/ + { + dst_LIB = "lib"; + add_dir (&ld_dirs, "/lib/tls", strlen ("/lib/tls"));
meta/recipes-devtools/prelink/prelink_git.bb +1 -0
@@ -27,6 +27,7 @@ FILES_${PN}-cron = "${sysconfdir}/cron.daily ${sysconfdir}/default" PACKAGES =+ "${PN}-cron" SRC_URI = "git://git.yoctoproject.org/prelink-cross.git;branch=cross_prelink \ + file://64bitfix.patch \ file://prelink.conf \ file://prelink.cron.daily \ file://prelink.default \
Quoted 33 lines · Richard Purdie
Checks within prelink force 64 bit binaries into lib64 and n32 binaries into lib32. We load prelink.conf with all combinations but this code then defeats it for us and means /lib is ignored.
Comment out this code to disable it and allow our settings to work. This allows 64 bit binaries in /lib to work. We pass in the correct dyanamic loader path anyhow and our binaries don't contain ld.so so this should be safe for us.
Signed-off-by Richard Purdie <[email protected]>meta/recipes-devtools/prelink/prelink/64bitfix.patch new file +13
-0@@ -0,0 +1,35 @@ +These checks force 64 bit binaries into lib64 and n32 binaries into lib32. We +load prelink.conf with all combinations but this code then defeats it for us +and means /lib is ignored. + +Comment out this code to disable it and allow our settings to work. This +allows 64 bit binaries in /lib to work. We pass in the correct dyanamic +loader path anyhow and our binaries don't contain ld.so so this should be +safe for us. + +Upstream-Status: Inappropriate +RP 2015/9/23 + +
meta/recipes-devtools/prelink/prelink/64bitfix.patch line 23
Quoted 10 lines
meta/recipes-devtools/prelink/prelink/64bitfix.patch new file +10
-0+Index: trunk/src/rtld/rtld.c +=================================================================== +--- trunk.orig/src/rtld/rtld.c ++++ trunk/src/rtld/rtld.c +@@ -334,7 +334,7 @@ load_ld_so_conf (int use_64bit, int use_ + + /* Only use the correct machine, to prevent mismatches if we + have both /lib/ld.so and /lib64/ld.so on x86-64. */ +- if (use_64bit) ++ /*if (use_64bit)
may be it would be good to use it as fallback if nothing comes out of prelink.conf such a patch would be acceptable upstream too.
Quoted 31 lines
meta/recipes-devtools/prelink/prelink/64bitfix.patch new file +12
-0+ { + dst_LIB = "lib64"; + add_dir (&ld_dirs, "/lib64/tls", strlen ("/lib64/tls")); +@@ -350,7 +350,7 @@ load_ld_so_conf (int use_64bit, int use_ + add_dir (&ld_dirs, "/usr/lib32/tls", strlen ("/usr/lib32/tls")); + add_dir (&ld_dirs, "/usr/lib32", strlen ("/usr/lib32")); + } +- else ++ else*/ + { + dst_LIB = "lib"; + add_dir (&ld_dirs, "/lib/tls", strlen ("/lib/tls"));meta/recipes-devtools/prelink/prelink_git.bb +0
-0@@ -27,6 +27,7 @@ FILES_${PN}-cron = "${sysconfdir}/cron.daily ${sysconfdir}/default"PACKAGES =+ "${PN}-cron"
SRC_URI= "git://git.yoctoproject.org/prelink-cross.git;branch=cross_prelink\+ file://64bitfix.patch \ file://prelink.conf \ file://prelink.cron.daily \ file://prelink.default \--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Quoted 38 lines · Khem Raj
Quoted 38 lines · Richard Purdie
Checks within prelink force 64 bit binaries into lib64 and n32 binaries into lib32. We load prelink.conf with all combinations but this code then defeats it for us and means /lib is ignored.
Comment out this code to disable it and allow our settings to work. This allows 64 bit binaries in /lib to work. We pass in the correct dyanamic loader path anyhow and our binaries don't contain ld.so so this should be safe for us.
Signed-off-by Richard Purdie <[email protected]>meta/recipes-devtools/prelink/prelink/64bitfix.patch new file +18
-0@@ -0,0 +1,35 @@ +These checks force 64 bit binaries into lib64 and n32 binaries into lib32. We +load prelink.conf with all combinations but this code then defeats it for us +and means /lib is ignored. + +Comment out this code to disable it and allow our settings to work. This +allows 64 bit binaries in /lib to work. We pass in the correct dyanamic +loader path anyhow and our binaries don't contain ld.so so this should be +safe for us. + +Upstream-Status: Inappropriate +RP 2015/9/23 + + +Index: trunk/src/rtld/rtld.c +=================================================================== +--- trunk.orig/src/rtld/rtld.c ++++ trunk/src/rtld/rtld.c +@@ -334,7 +334,7 @@ load_ld_so_conf (int use_64bit, int use_
Quoted 8 lines
meta/recipes-devtools/prelink/prelink/64bitfix.patch line 23
Quoted 5 lines
meta/recipes-devtools/prelink/prelink/64bitfix.patch new file +5
-0+ + /* Only use the correct machine, to prevent mismatches if we + have both /lib/ld.so and /lib64/ld.so on x86-64. */ +- if (use_64bit) ++ /*if (use_64bit)may be it would be good to use it as fallback if nothing comes out of prelink.conf such a patch would be acceptable upstream too.
This is the emulated rtld that prelink uses. It's only in the cross-prelink.
As far as I can tell the previous 'upstream prelink' is abandon-ware now.. so cross-prelink is more or less the new (final) upstream.
This code block is from the original (cross) prelink work done back in roughly 2006. Obviously things have changed a bit since then.
However, this code will break the normal multilib use-case. So I don't think it can be generically applied.
The dst_LIB value being set to only 'lib' won't be set properly. (dst_LIB is used when executables or libraries have embedded '$LIB', this is similar to $PLATFORM, or $ORIGIN...) So any executables using it in their internal search paths will reference the wrong values in a any config where 'libdir' isn't '/lib'.
The 'ld_dirs' is used by the dynamic search capabilities of the emulated rtld. So when something says give me "libfoo.so.1". It uses the ld_dirs to search for the library. Again if the libdir is not '/lib' then it won't find the libraries and prelinking may abort for that particular item.
Quoted 4 lines
Quoted 4 lines
meta/recipes-devtools/prelink/prelink/64bitfix.patch new file +4
-0+ { + dst_LIB = "lib64"; + add_dir (&ld_dirs, "/lib64/tls", strlen ("/lib64/tls")); +@@ -350,7 +350,7 @@ load_ld_so_conf (int use_64bit, int use_
Quoted 8 lines
meta/recipes-devtools/prelink/prelink/64bitfix.patch line 35
Quoted 8 lines
meta/recipes-devtools/prelink/prelink/64bitfix.patch new file +8
-0+ add_dir (&ld_dirs, "/usr/lib32/tls", strlen ("/usr/lib32/tls")); + add_dir (&ld_dirs, "/usr/lib32", strlen ("/usr/lib32")); + } +- else ++ else*/ + { + dst_LIB = "lib"; + add_dir (&ld_dirs, "/lib/tls", strlen ("/lib/tls"));
If we were to only comment out the last 'else'. We still have the dst_LIB issue as mentioned above.. (what is the right value?)
It also open up the possibility though where the system has a flaw -- where an ELF64/ELF N32 is on the system and asks for libfoo.so.1, but that was not installed for the 64-bit/n32 system. It will fall back and find it in the '32-bit' side and use that for the processing.... (I'm not sure if prelink has the ability to detect that there is a mismatch between the two executables.)
The rtld as far as I can remember does nothing globally to make sure that the binaries are all for the same machine type... (this may be a bug that could be easily fixed given a good test case, like what I suggested above. Pull the machine from the executable and skip any libraries that are not of the same machine type....)
An alternative to all of this would be only applying the path if BASELIB == lib?
--Mark
Quoted 22 lines
Quoted 19 lines
meta/recipes-devtools/prelink/prelink_git.bb +0
-0@@ -27,6 +27,7 @@ FILES_${PN}-cron = "${sysconfdir}/cron.daily ${sysconfdir}/default"PACKAGES =+ "${PN}-cron"
SRC_URI= "git://git.yoctoproject.org/prelink-cross.git;branch=cross_prelink\+ file://64bitfix.patch \ file://prelink.conf \ file://prelink.cron.daily \ file://prelink.default \--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core