NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-powerpc/43073: powerpc64 rescue link finds many missing symbols in /usr/lib/libcrypto.a

>Number:         43073
>Category:       port-powerpc
>Synopsis:       powerpc64 rescue link finds many missing symbols in 
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    port-powerpc-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Mar 29 13:55:00 +0000 2010
>Originator:     Dennis Ferguson
>Release:        very recent 5.99.24
NetBSD 5.99.24 NetBSD 5.99.24 (GENERIC) #0: Sun Mar 
14 17:25:30 HKT 2010
When building a macppc64 distribution, the link for rescue finds
many, many missing symbols in /usr/lib/libcrypto.a, e.g.:

#      link  obj/rescue
/usr/NetBSD/src/obj/destdir.macppc/usr/lib/libcrypto.a(bn_nist.o): In function 
bn_nist.c:(.text+0x2b8): undefined reference to `.bn_add_words'
bn_nist.c:(.text+0x2d0): undefined reference to `.bn_sub_words'
/usr/NetBSD/src/obj/destdir.macppc/usr/lib/libcrypto.a(bn_nist.o): In function 
bn_nist.c:(.text+0x518): undefined reference to `.bn_add_words'
bn_nist.c:(.text+0x534): undefined reference to `.bn_add_words'
bn_nist.c:(.text+0x5cc): undefined reference to `.bn_add_words'
bn_nist.c:(.text+0x658): undefined reference to `.bn_add_words'
bn_nist.c:(.text+0x6b4): undefined reference to `.bn_add_words'
 more undefined references to `.bn_add_words' follow
/usr/NetBSD/src/obj/destdir.macppc/usr/lib/libcrypto.a(bn_nist.o): In function 
bn_nist.c:(.text+0x7a4): undefined reference to `.bn_sub_words'
bn_nist.c:(.text+0x7fc): undefined reference to `.bn_sub_words'
bn_nist.c:(.text+0x844): undefined reference to `.bn_sub_words'
bn_nist.c:(.text+0x87c): undefined reference to `.bn_sub_words'
bn_nist.c:(.text+0x8b8): undefined reference to `.bn_add_words'

All the missing functions are powerpc (not 64) assembly
Do a

    MACHINE=macppc64 ./ distribution
For macppc64 builds we end up with the following two settings
for the cpu-related defines:

    MACHINE_ARCH=  "powerpc64"
    MACHINE_CPU=   "powerpc"

The make machinery in src/crypto/external/bsd/openssl/lib/libcrypto/,
based on this, includes the sources and Makefile includes
from its arch/powerpc subdirectory.  While the powerpc assembly
source files included in there assemble properly for powerpc64
the two ports have different, incompatible, calling and linkage
conventions (encapsulated in ENTRY() macros for NetBSD assembly
functions but not by libcrypto assembly functions).

Since modifying the powerpc functions to work on powerpc64 as
well, while possible, doesn't make sense, I think the quick fix
is to make powerpc64 the library's C versions of the functions
for now.

To do this do the following:

    mkdir crypto/external/bsd/openssl/lib/libcrypto/powerpc64
    cat > crypto/external/bsd/openssl/lib/libcrypto/powerpc64/
    .include "${.CURDIR}/"

(the file is for CVS, it does what the build system would
do with no arch/*/ file) and then apply the attached patch
patch to in the libcrypto directory.  Note that, instead
of exclusively using the arch/${MACHINE_CPU} directory if it
exists, the patch makes it first check to see if an
arch/${MACHINE_ARCH} directory exists and, if so, use that
in preference.  Note that I think this is actually a small
fix to the Makefile in general: in the very few cases where
more specific description of the target architecture, so it
an arch/${MACHINE_ARCH} directory exists at all it is almost
certainly correct to prefer it.

Index: crypto/external/bsd/openssl/lib/libcrypto/
RCS file: /cvsroot/src/crypto/external/bsd/openssl/lib/libcrypto/,v
retrieving revision 1.1
diff -u -r1.1
--- crypto/external/bsd/openssl/lib/libcrypto/  19 Jul 2009 23:30:44 
-0000      1.1
+++ crypto/external/bsd/openssl/lib/libcrypto/  29 Mar 2010 13:49:23 
@@ -17,7 +17,13 @@
+.if !defined(CRYPTO_MACHINE_CPU)
+.if exists(${.CURDIR}/arch/${MACHINE_ARCH})
 .for cryptoinc in ${CRYPTOINCS}
 .if exists(${.CURDIR}/arch/${CRYPTO_MACHINE_CPU}/${cryptoinc})

Home | Main Index | Thread Index | Old Index