]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
utils.bbclass: Use objdump instead of readelf to compute SONAME
authorKhem Raj <raj.khem@gmail.com>
Thu, 27 Jun 2024 07:55:50 +0000 (00:55 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 1 Jul 2024 12:55:37 +0000 (13:55 +0100)
LLVM has changed the ELF header dump format [1], the code in oe_libinstall
relied upon the format and processed the SONAME inside square brackets
e.g.

0x000000000000000e (SONAME)       Library soname: libreadline.so.8

with older readelf from ( llvm <19 or GNU binutils objdump ) we get

0x000000000000000e (SONAME)       Library soname: [libreadline.so.8]

The check in oe_libinstall will now trip over ELF files read by llvm-readelf
from llvm19+

To make it portable which works across GNU binutils and LLVM tools
switch to using objdump -p to dump the ELF file and modify the regexp
accordingly, as an aside, the post processing expression is simplified
too

[1] https://github.com/llvm/llvm-project/pull/96562

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes-global/utils.bbclass

index 957389928f3ac01d5e40053d639650dfddc94217..c9cae8930f71adb575e36bdf59ab5f660d99b50a 100644 (file)
@@ -15,7 +15,7 @@ oe_soinstall() {
                ;;
        esac
        install -m 755 $1 $2/$libname
-       sonamelink=`${READELF} -d $1 |grep 'Library soname:' |sed -e 's/.*\[\(.*\)\].*/\1/'`
+       sonamelink=`${OBJDUMP} -p $1 | grep SONAME | awk '{print $2}'`
        if [ -z $sonamelink ]; then
                bbfatal "oe_soinstall: $libname is missing ELF tag 'SONAME'."
        fi
@@ -147,7 +147,7 @@ oe_libinstall() {
                # special case hack for non-libtool .so.#.#.# links
                baselibfile=`basename "$libfile"`
                if (echo $baselibfile | grep -qE '^lib.*\.so\.[0-9.]*$'); then
-                       sonamelink=`${READELF} -d $libfile |grep 'Library soname:' |sed -e 's/.*\[\(.*\)\].*/\1/'`
+                       sonamelink=`${OBJDUMP} -p $libfile | grep SONAME | awk '{print $2}'`
                        solink=`echo $baselibfile | sed -e 's/\.so\..*/.so/'`
                        if [ -n "$sonamelink" -a x"$baselibfile" != x"$sonamelink" ]; then
                                __runcmd ln -sf $baselibfile $destpath/$sonamelink