Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 330915 - =dev-libs/openssl-1.0.0a fails on alpha for multiple reasons
Summary: =dev-libs/openssl-1.0.0a fails on alpha for multiple reasons
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: Alpha Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL: http://www.mail-archive.com/openssl-d...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-02 21:18 UTC by Kazuyoshi Furutaka
Modified: 2010-09-14 00:29 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
the build log (build.log-openssl-1.0.0a,64.03 KB, text/plain)
2010-08-02 21:22 UTC, Kazuyoshi Furutaka
Details
the build.log for 1.0.0a-r1 (build.log-openssl-1.0.0a-r1,65.74 KB, text/plain)
2010-08-15 14:52 UTC, Kazuyoshi Furutaka
Details
openssl-1.0.0a-r1-build.log.gz (openssl-1.0.0a-r1-build.log.gz,22.12 KB, application/x-gzip)
2010-09-12 01:50 UTC, Matt Turner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kazuyoshi Furutaka 2010-08-02 21:18:54 UTC
Build of dev-libs/openssl-1.0.0a failed due to an upstream packaging issue.
It failed even with the alphacpuid.s referred in the archived mail.
Comment 1 Kazuyoshi Furutaka 2010-08-02 21:22:20 UTC
Created attachment 241153 [details]
the build log
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2010-08-03 03:37:03 UTC
Please post your `emerge --info =dev-libs/openssl-1.0.0a' too.
Comment 3 Kazuyoshi Furutaka 2010-08-03 09:51:41 UTC
(In reply to comment #2)
> Please post your `emerge --info =dev-libs/openssl-1.0.0a' too.

Sorry to forget...

Portage 2.1.8.3 (default/linux/alpha/10.0/desktop/gnome, gcc-4.4.4, glibc-2.11.2-r0, 2.6.30-gentoo-r6 alpha)
=================================================================
                        System Settings
=================================================================
System uname: Linux-2.6.30-gentoo-r6-alpha-EV56-with-gentoo-2.0.1
Timestamp of tree: Wed, 28 Jul 2010 12:55:01 +0000
ccache version 2.4 [disabled]
app-shells/bash:     4.1_p7
dev-lang/python:     2.6.5-r3, 3.1.2-r4
dev-util/ccache:     2.4-r8
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.6.1-r1
sys-apps/sandbox:    2.2
sys-devel/autoconf:  2.13, 2.65-r1
sys-devel/automake:  1.7.9-r1, 1.9.6-r3, 1.10.2, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.3.5, 4.4.4-r1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.10
virtual/os-headers:  2.6.34
ACCEPT_KEYWORDS="alpha ~alpha"
ACCEPT_LICENSE="* -@EULA"
CBUILD="alpha-unknown-linux-gnu"
CFLAGS="-mieee -pipe -O2 -mcpu=ev56"
CHOST="alpha-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-mieee -pipe -O2 -mcpu=ev56"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://gentoo.gg3.net/ ftp://gg3.net/pub/linux/gentoo/ ftp://ftp.ecc.u-tokyo.ac.jp/GENTOO http://gentoo.channelx.biz/ http://ftp.jaist.ac.jp/pub/Linux/Gentoo/ ftp://ftp.jaist.ac.jp/pub/Linux/Gentoo/ http://ftp.iij.ad.jp/pub/linux/gentoo/ ftp://ftp.iij.ad.jp/pub/linux/gentoo/ "
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac acl alpha alsa berkdb branding bzip2 cairo cdr cli consolekit cracklib crypt cups cxx dbus dri dts dvd dvdr eds encode evo exif fam firefox flac fortran gdbm gdu gif gnome gnome-keyring gpm gstreamer gtk hal iconv ipv6 jpeg lcms ldap libnotify mad mikmod mng modules mp3 mp4 mpeg mudflap nautilus ncurses nls nptl nptlonly ogg opengl openmp pam pango pcre pdf perl png policykit ppds pppd python qt3support qt4 readline reflection sdl session spell spl ssl startup-notification svg sysfs tcpd tiff truetype unicode usb vorbis x264 xcb xml xorg xulrunner xv xvid zlib" ALSA_CARDS="ali5451 als4000 bt87x ca0106 cmipci emu10k1 ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 maestro3 trident usb-audio via82xx ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fbdev glint mach64 mga nv r128 radeon savage tdfx voodoo" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY

Comment 4 SpanKY gentoo-dev 2010-08-04 02:41:25 UTC
ive added the missing file to 1.0.0a, but i dont know alpha assembly to propose a fix for the build error
Comment 5 Kazuyoshi Furutaka 2010-08-15 14:51:00 UTC
(In reply to comment #4)
> ive added the missing file to 1.0.0a, but i dont know alpha assembly to propose
> a fix for the build error

The build of 1.0.0a-r1 failed due to the failure of the compile of alphacpuid.s as before;

(...)
alpha-unknown-linux-gnu-gcc -I. -I.. -I../include  -fPIC -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DL_ENDIAN -DTERMIO -DOPENSSL_BN_ASM_MONT -mieee -pipe -O2 -mcpu=ev56 -mlarge-data -fno-strict-aliasing -Wa,--noexecstack -c  -o alphacpuid.o alphacpuid.s
alphacpuid.s: Assembler messages:
alphacpuid.s:71: Error: inappropriate arguments for opcode `ldl_l'
alphacpuid.s:73: Error: inappropriate arguments for opcode `stl_c'
make[1]: *** [alphacpuid.o] Error 1
make[1]: Leaving directory `/var/tmp/portage/dev-libs/openssl-1.0.0a-r1/work/openssl-1.0.0a/crypto'
make: *** [build_crypto] Error 1

I'll attach the build.log.
Comment 6 Kazuyoshi Furutaka 2010-08-15 14:52:55 UTC
Created attachment 243071 [details]
the build.log for 1.0.0a-r1
Comment 7 Matt Turner gentoo-dev 2010-08-15 15:00:56 UTC
FYI, I'm not ignoring this bug. I'm just really busy moving. Will get to this as soon as I can.
Comment 8 Kazuyoshi Furutaka 2010-09-11 12:11:10 UTC
(In reply to comment #6)
> Created an attachment (id=243071) [details]
> the build.log for 1.0.0a-r1

With the following modification I can at least compile the modified alphacpuid.s:
--- alphacpuid.s.orig	2010-08-04 11:41:17.000000000 +0900
+++ alphacpuid.s	2010-09-11 18:44:00.000000000 +0900
@@ -68,9 +68,9 @@
 OPENSSL_atomic_add:
 	.frame	$30,0,$26
 	.prologue 0
-1:	ldl_l	$0,($16)
+1:	ldl_l	$0,1($16)
 	addl	$0,$17,$1
-	stl_c	$1,($16)
+	stl_c	$1,1($16)
 	beq	$1,1b
 	addl	$0,$17,$0
 	ret	($26)

I KNOW almost nothing about alpha assembly; by consulting a reference book I just found that ldl_l and stl_c need displacement values.  Does it make sense to specify "1" as the displacements?  What should it be?


Then, the build stopped again failing the compilation of alpha-mont.s:
/usr/bin/perl asm/alpha-mont.pl | alpha-unknown-linux-gnu-gcc -E - | tee alpha-mont.s > /dev/null
<stdin>:1:17: error: asm.h: No such file or directory
<stdin>:2:20: error: regdef.h: No such file or directory
alpha-unknown-linux-gnu-gcc -I.. -I../.. -I../asn1 -I../evp -I../../include  -fPIC -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DL_ENDIAN -DTERMIO -DOPENSSL_BN_ASM_MONT -mieee -pipe -O2 -mcpu=ev56 -mlarge-data -fno-strict-aliasing -Wa,--noexecstack -c  -o alpha-mont.o alpha-mont.s
<stdin>: Assembler messages:
<stdin>:13: Error: syntax error
<stdin>:14: Error: syntax error
<stdin>:15: Error: syntax error
<stdin>:16: Error: syntax error
<stdin>:17: Error: syntax error
<stdin>:18: Error: syntax error
<stdin>:19: Error: inappropriate arguments for opcode `mov'
<stdin>:21: Warning: frame reg expected, using $30.
<stdin>:21: Warning: bad .frame directive
<stdin>:26: Error: inappropriate arguments for opcode `sextl'
<stdin>:27: Error: inappropriate arguments for opcode `mov'
<stdin>:28: Error: inappropriate arguments for opcode `cmplt'
<stdin>:29: Error: inappropriate arguments for opcode `bne'
<stdin>:31: Error: syntax error
(error message continues but omitted)

regdef.h can be found at a few location but it seems that no asm.h FOR ALPHA
(say in linux-2.6.35-gentoo-r5 kernel source);
furutaka@genalpha /usr/portage/dev-libs/openssl/files $ find /usr/src/linux-2.6.35-gentoo-r5/ -name asm.h -o -name regdef.h
/usr/src/linux-2.6.35-gentoo-r5/arch/alpha/include/asm/regdef.h
/usr/src/linux-2.6.35-gentoo-r5/arch/avr32/include/asm/asm.h
/usr/src/linux-2.6.35-gentoo-r5/arch/mips/include/asm/asm.h
/usr/src/linux-2.6.35-gentoo-r5/arch/mips/include/asm/regdef.h
/usr/src/linux-2.6.35-gentoo-r5/arch/sparc/include/asm/asm.h
/usr/src/linux-2.6.35-gentoo-r5/arch/x86/include/asm/asm.h
furutaka@genalpha /usr/portage/dev-libs/openssl/files $ find /usr/include -name asm.h -o -name regdef.h
/usr/include/asm/regdef.h
/usr/include/alpha/regdef.h

Any clue?
Comment 9 Matt Turner gentoo-dev 2010-09-12 01:50:53 UTC
Created attachment 246927 [details]
openssl-1.0.0a-r1-build.log.gz

The correct fix to the ldl_l/stl_c is this:

--- alphacpuid.s.orig   2010-08-04 11:41:17.000000000 +0900
+++ alphacpuid.s        2010-09-11 18:44:00.000000000 +0900
@@ -68,9 +68,9 @@
 OPENSSL_atomic_add:
        .frame  $30,0,$26
        .prologue 0
-1:     ldl_l   $0,($16)
+1:     ldl_l   $0,0($16)
        addl    $0,$17,$1
-       stl_c   $1,($16)
+       stl_c   $1,0($16)
        beq     $1,1b
        addl    $0,$17,$0
        ret     ($26)

No idea what fucking compiler they're using that accepts that. I tried gcc 4.3.4, 4.4.3, and 4.5.1. None accepted their code.

FYI, ldl_l is load-locked or load-linked, and stl_c is store-conditional. They're used for atomic operations like mutexes. Load/store syntax is
ldl $1,8($2) which means load the value stored in the address pointed by $2, offset by 8, into register $1. So, since they didn't specify an offset in the openssl code, undoubtedly they meant 0.

Anyway, attached is my build log after modifying alphacpuid.s.

I see in the log:
/usr/bin/perl asm/alpha-mont.pl | alpha-unknown-linux-gnu-gcc -E - | tee alpha-mont.s > /dev/null
<stdin>:1:17: fatal error: asm.h: No such file or directory
compilation terminated.
alpha-unknown-linux-gnu-gcc

But compilation continues until...

alpha-unknown-linux-gnu-gcc -Wl,--as-needed -fPIC -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DL_ENDIAN -DTERMIO -DOPENSSL_BN_ASM_MONT -ggdb -O3 -mcpu=ev67 -pipe -fno-strict-aliasing -Wa,--noexecstack -Wl,-rpath,/usr/lib -o openssl openssl.o verify.o asn1pars.o req.o dgst.o dh.o dhparam.o enc.o passwd.o gendh.o errstr.o ca.o pkcs7.o crl2p7.o crl.o rsa.o rsautl.o dsa.o dsaparam.o ec.o ecparam.o x509.o genrsa.o gendsa.o genpkey.o s_server.o s_client.o speed.o s_time.o apps.o s_cb.o s_socket.o app_rand.o version.o sess_id.o ciphers.o nseq.o pkcs12.o pkcs8.o pkey.o pkeyparam.o pkeyutl.o spkac.o smime.o cms.o rand.o engine.o ocsp.o prime.o ts.o -L.. -lssl -L.. -lcrypto -ldl -lz
../libcrypto.so: undefined reference to `bn_mul_mont'

It's totally clear that they didn't test this, as THEY LEFT OUT A FILE, but god. This is ridiculous.
Comment 10 SpanKY gentoo-dev 2010-09-12 04:17:05 UTC
ive added that patch to the tree

http://sources.gentoo.org/dev-libs/openssl/files/openssl-1.0.0a-alphacpuid.patch?rev=1.1
Comment 11 SpanKY gentoo-dev 2010-09-12 05:18:11 UTC
odd that you didnt also get a regdef.h error ... i did.  maybe a difference in gcc versions ?  i'm using gcc-4.4.x here.

anyways, comment out the asm.h include and change the regdef.h to asm/regdef.h, and it gets much further.

<stdin>: Assembler messages:
<stdin>:36: Warning: operand out of range (0xfffffffffffff000 is not between 0x0000000000000000 and 0x00000000000000ff)
<stdin>:66: Error: inappropriate arguments for opcode `ldq'
<stdin>:68: Error: inappropriate arguments for opcode `ldq'
<stdin>:119: Error: inappropriate arguments for opcode `ldq'
<stdin>:121: Error: inappropriate arguments for opcode `ldq'
<stdin>:122: Error: inappropriate arguments for opcode `ldq'
<stdin>:124: Error: inappropriate arguments for opcode `ldq'
<stdin>:155: Error: inappropriate arguments for opcode `ldq'
<stdin>:158: Error: inappropriate arguments for opcode `ldq'
<stdin>:207: Error: inappropriate arguments for opcode `stq'
<stdin>:225: Error: inappropriate arguments for opcode `ldq'
<stdin>:226: Error: inappropriate arguments for opcode `ldq'
<stdin>:234: Error: inappropriate arguments for opcode `stq'
<stdin>:248: Error: inappropriate arguments for opcode `ldq'
<stdin>:269: Error: unknown pseudo-op: `.rdata'
<stdin>:270: Error: unknown pseudo-op: `.asciiz'
make[3]: *** [alpha-mont.o] Error 1

the last two are easy to fix ... comment out the useless string that notes who wrote this sucker.  i cant see any labels that mark this string let alone anyone else referring to it.

as for the "inappropriate arguments" errors, those appear to be the same as your previous fix -- declare an explicit offset of 0.

that leaves the "Warning: operand out of range" ... not an error, but i imagine fixing this requires knowledge of the original code.

i'm guessing that the guy who wrote this stuff didnt do it with a GNU toolchain.  perhaps we was using the old school Alpha ccc compiler or something similar.

ive added a patch with my proposed fixes and sent it upstream:
http://sources.gentoo.org/dev-libs/openssl/files/openssl-1.0.0a-alpha-mont.patch?rev=1.1

but while this allows the compile to succeed, rebuilding openssh against it results in an `ssh` that likes to segfault.  so ive marked the 1.0.0a-r3 ebuild as -alpha to prevent screwing people over.

http://sources.gentoo.org/dev-libs/openssl/openssl-1.0.0a-r3.ebuild?r1=1.3&r2=1.4
Comment 12 SpanKY gentoo-dev 2010-09-12 05:24:42 UTC
and after installing gdb, there is no surprise when i get:
Program received signal SIGSEGV, Segmentation fault.
0x0000020000186fd0 in bn_mul_mont () from /usr/lib/libcrypto.so.1.0.0
Comment 13 SpanKY gentoo-dev 2010-09-14 00:29:41 UTC
upstream addressed the warning and that seems to fix things for me on alpha, so ive moved it into ~alpha

http://sources.gentoo.org/dev-libs/openssl/openssl-1.0.0a-r3.ebuild?r1=1.4&r2=1.5
http://sources.gentoo.org/dev-libs/openssl/files/openssl-1.0.0a-alpha-mont.patch?r1=1.1&r2=1.2