Skip to content

Commit 9009796

Browse files
krajrpurdie
authored andcommitted
utils.bbclass: Use objdump instead of readelf to compute SONAME
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] llvm/llvm-project#96562 Signed-off-by: Khem Raj <[email protected]> Signed-off-by: Richard Purdie <[email protected]>
1 parent 43e2700 commit 9009796

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

meta/classes-global/utils.bbclass

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ oe_soinstall() {
1515
;;
1616
esac
1717
install -m 755 $1 $2/$libname
18-
sonamelink=`${READELF} -d $1 |grep 'Library soname:' |sed -e 's/.*\[\(.*\)\].*/\1/'`
18+
sonamelink=`${OBJDUMP} -p $1 | grep SONAME | awk '{print $2}'`
1919
if [ -z $sonamelink ]; then
2020
bbfatal "oe_soinstall: $libname is missing ELF tag 'SONAME'."
2121
fi
@@ -147,7 +147,7 @@ oe_libinstall() {
147147
# special case hack for non-libtool .so.#.#.# links
148148
baselibfile=`basename "$libfile"`
149149
if (echo $baselibfile | grep -qE '^lib.*\.so\.[0-9.]*$'); then
150-
sonamelink=`${READELF} -d $libfile |grep 'Library soname:' |sed -e 's/.*\[\(.*\)\].*/\1/'`
150+
sonamelink=`${OBJDUMP} -p $libfile | grep SONAME | awk '{print $2}'`
151151
solink=`echo $baselibfile | sed -e 's/\.so\..*/.so/'`
152152
if [ -n "$sonamelink" -a x"$baselibfile" != x"$sonamelink" ]; then
153153
__runcmd ln -sf $baselibfile $destpath/$sonamelink

0 commit comments

Comments
 (0)