[erlang-bugs] Erlang/OTP R11B-3 OpenBSD patches

Mikael Pettersson mikpe@REDACTED
Sat Feb 3 12:40:53 CET 2007


On Sat, 3 Feb 2007 09:10:33 +0100, Jon Olsson <jon@REDACTED> wrote:
> > They were introduced originally for Solaris, but they
> > also see use (whether needed or not) on Linux.
> > They are (were) needed on Solaris because the compilers do not
> > necessarily support the SPARC v9 instruction set by default,
> > and parts of the runtime system need(ed) to include v9 instructions.
> > 
> > What exactly is the failure on OpenBSD?
> 
> cc -O2 -pipe -I/usr/ports/lang/erlang/w-erlang-11b.2/otp_src_R11B-2/erts/sparc64-unknown-openbsd4.0    -DUSE_THREADS  -D_THREAD_SAFE -D_REENTRANT  -DHAVE_CONFIG_H -Wall -Wstrict-prototypes -Wmissing-prototypes -DUSE_THREADS  -D_THREAD_SAFE -D_REENTRANT -Wa,-xarch=v8plusa -Ibeam -Isys/unix -Isys/common -Isparc64-unknown-openbsd4.0/opt/plain -Isparc64-unknown-openbsd4.0 -Izlib -Ihipe -I../include/internal -I../include/internal/sparc64-unknown-openbsd4.0 -c hipe/hipe_mkliterals.c -o obj/sparc64-unknown-openbsd4.0/opt/plain/hipe_mkliterals.o
> {standard input}: Assembler messages:
> {standard input}:286: Error: internal error: can't export reloc type 91 (`BFD_RELOC_SPARC_H44')
> {standard input}:289: Error: internal error: can't export reloc type 92 (`BFD_RELOC_SPARC_M44')
> {standard input}:293: Error: internal error: can't export reloc type 93 (`BFD_RELOC_SPARC_L44')
> {standard input}:841: Error: internal error: can't export reloc type 91 (`BFD_RELOC_SPARC_H44')
etc

That smells like a toolchain (binutils/gas) bug. It certainly works with the versions I
have on my Aurora Linux SPARC64 machine.

Hmm, does your `cc' perhaps default to building 64-bit code? The v8plusa option should
not be needed in that case, and might even be harmful.

> This fixes a bug on OpenBSD/sparc64
> --- erts/emulator/Makefile.in.orig      Mon Jan 29 13:52:09 2007
> +++ erts/emulator/Makefile.in   Wed Jan 31 17:25:33 2007
> @@ -137,7 +137,7 @@ darwinCFLAGS=-DDARWIN
>  noopsysCFLAGS=
>  OPSYSCFLAGS=$($(OPSYS)CFLAGS)
>  ARCH=@ARCH@
> -ultrasparcCFLAGS=-Wa,-xarch=v8plusa
> +ultrasparcCFLAGS=
>  ARCHCFLAGS=$($(ARCH)CFLAGS)

Unfortunately this change breaks Solaris/SPARC:

gcc  -g  -O3 -fomit-frame-pointer -I/tmp/mikpe/otp-0202/erts/sparc-sun-solaris2.9  -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -DUSE_THREADS  -D_THREAD_SAFE -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DHYBRID -DHAVE_CONFIG_H -Wall -Wstrict-prototypes -Wmissing-prototypes -DUSE_THREADS  -D_THREAD_SAFE -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS  -Ibeam -Isys/unix -Isys/common -Isparc-sun-solaris2.9/opt/hybrid -Isparc-sun-solaris2.9 -Izlib -Ihipe -I../include/internal -I../include/internal/sparc-sun-solaris2.9 -c beam/io.c -o obj/sparc-sun-solaris2.9/opt/hybrid/io.o
beam/io.c: In function 'io_list_to_vec':
beam/io.c:922: warning: pointer targets in assignment differ in signedness
beam/io.c: In function 'deliver_vec_message':
beam/io.c:1735: warning: pointer targets in assignment differ in signedness
/usr/ccs/bin/as: "/tmp/ccJaaCzj.s", line 1599: error: cannot use v8plus instructions in a non-v8plus target binary
/usr/ccs/bin/as: "/tmp/ccJaaCzj.s", line 1611: error: cannot use v8plus instructions in a non-v8plus target binary
/usr/ccs/bin/as: "/tmp/ccJaaCzj.s", line 1617: error: cannot use v8plus instructions in a non-v8plus target binary
(many more of these follow)

The issue is that we MUST use V9 instructions for atomic operations, but the assembler
rejects them unless the v8plusa option is passed to it.

This means that you need to figure out how to make this change only for OpenBSD.
An update in erts/configure{.in,} to detect OpenBSD and set OPSYS accordingly,
plus some trickery in erts/emulator/Makefile.in, should suffice.

/Mikael



More information about the erlang-bugs mailing list