Project

General

Profile

Actions

Bug #13185

open

-zassert-deflib does not work for 64-bit objects

Added by xto uqh 10 months ago. Updated 7 months ago.

Status:
In Progress
Priority:
Normal
Assignee:
Category:
tools - gate/build tools
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

I have a library linking against libcrypto, not added to NATIVE_LIBS, and while 32bit build correctly fails, 64bit one is clean and happy.


Related issues

Related to illumos gate - Bug #13443: gate build missing some NATIVE_LIBSClosedAndy Fiddaman

Actions
Actions #1

Updated by Andy Fiddaman 7 months ago

  • Assignee set to Andy Fiddaman

Here's a reproducer:

#!/bin/ksh

tf=test$$.c

cat << EOM > $tf
int main(){return(0);}
EOM

for gcc in 4.4.4 7 9 10; do
       for a in 32 64; do
                [ $a = 32 ] && lib=/lib || lib=/lib/amd64
                echo
                echo "+ gcc $gcc, $a" 
                [ $gcc = 4.4.4 ] && b=/opt/gcc-4.4.4/bin/gcc || b=gcc-$gcc
                $b -m$a -o /dev/null -L$lib \
                    -Wl,-zassert-deflib -Wl,-zfatal-warnings $tf -lmtmalloc
        done
done

rm -f $tf

which outputs, for example with gcc 10 on OmniOS:

+ gcc 10, 32
ld: warning: dynamic library found on default search path (/usr/lib): libmtmalloc.so
collect2: error: ld returned 1 exit status

+ gcc 10, 64

The root cause of this is gcc invoking the linker with specific -L options for the standard library directory for a 64-bit link, whereas it elides them for a 32-bit one.
The linker sees that the library was found in a user provided path and so the assertion is not raised.

There are several possibilities on how to fix this. I have a test patch for gcc but will continue to explore options.

Actions #2

Updated by Andy Fiddaman 7 months ago

  • Status changed from New to In Progress
Actions #3

Updated by Andy Fiddaman 7 months ago

  • Subject changed from assert-deflib checks do not work 64bit libraries to -zassert-deflib does not work for 64-bit objects
Actions #5

Updated by Andy Fiddaman 7 months ago

  • Related to Bug #13443: gate build missing some NATIVE_LIBS added
Actions

Also available in: Atom PDF