Jeffrey Walton <[email protected]> writes:

> When linking the shared object with -G on Solaris:
>
> gcc -g2 -O2 -m64 -march=native -fPIC -pthread  -Wno-pointer-sign -Wall
> -W   -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes
> -Wpointer-arith -Wbad-function-cast -Wnested-externs -L/usr/local/lib
> -m64 -Wl,-R,'$ORIGIN/../lib' -Wl,-R,/usr/local/lib -G -h
> libnettle.so.7 aes-decrypt-internal.o aes-decrypt.o
> aes-encrypt-internal.o aes-encrypt.o aes-encrypt-table.o ...
>
> It results in:
>
> ld.so.1: aes-test: fatal: relocation error: R_AMD64_PC32: file
> ../.lib/libhogweed.so.5: symbol _init: value 0x7f004df15e9d does not
> fit
> ../run-tests: line 61: 12934: Killed
> FAIL: aes
> ld.so.1: arcfour-test: fatal: relocation error: R_AMD64_PC32: file
> ../.lib/libhogweed.so.5: symbol _init: value 0x7f004df15a1d does not
> fit
> ../run-tests: line 61: 12939: Killed
> FAIL: arcfour
> ld.so.1: arctwo-test: fatal: relocation error: R_AMD64_PC32: file
> ../.lib/libhogweed.so.5: symbol _init: value 0x7f004df153dd does not
> fit
> ../run-tests: line 61: 12944: Killed
> FAIL: arctwo
> ...
>
> Here's the full paste of the build using -G: https://pastebin.com/SKZxKfdZ.
>
> Please use -shared, not -G. -shared works as expected on Solaris.

So you're suggesting the following change, right?

diff --git a/configure.ac b/configure.ac
index 09f719a0..ba3ab7c6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -655,13 +655,13 @@ case "$host_os" in
     LIBNETTLE_FORLINK=libnettle.so
     LIBNETTLE_SONAME='$(LIBNETTLE_FORLINK).$(LIBNETTLE_MAJOR)'
     LIBNETTLE_FILE='$(LIBNETTLE_SONAME).$(LIBNETTLE_MINOR)'
-    LIBNETTLE_LINK='$(CC) $(CFLAGS) $(LDFLAGS) -G -h $(LIBNETTLE_SONAME)'
+    LIBNETTLE_LINK='$(CC) $(CFLAGS) $(LDFLAGS) -shared -h $(LIBNETTLE_SONAME)'
     LIBNETTLE_LIBS=''
 
     LIBHOGWEED_FORLINK=libhogweed.so
     LIBHOGWEED_SONAME='$(LIBHOGWEED_FORLINK).$(LIBHOGWEED_MAJOR)'
     LIBHOGWEED_FILE='$(LIBHOGWEED_SONAME).$(LIBHOGWEED_MINOR)'
-    LIBHOGWEED_LINK='$(CC) $(CFLAGS) $(LDFLAGS) -G -h $(LIBHOGWEED_SONAME)'
+    LIBHOGWEED_LINK='$(CC) $(CFLAGS) $(LDFLAGS) --shared -h 
$(LIBHOGWEED_SONAME)'
     LIBHOGWEED_LIBS='libnettle.so $(LIBS)'
     ;;
   *)

IIRC, the reason for current use of -G rather than -shared is that it
worked better with Solaris cc. But according to

https://docs.oracle.com/cd/E77782_01/html/E77792/gqexw.html#OSGCCgqfch  

-shared was added as an alias for -G in Oracle Developer Studio 12.4,
and changed to be more gcc-compatible in 12.6. 

Are you able to test if building shared libraries still works with these
tools? Support for unusual proprietary compilers linkers is not that
high a priority, but it would be nice to keep it working, or at least,
know when breaking it.

> Here's the full paste of the build using -G: https://pastebin.com/SKZxKfdZ.

: checking build system type... i386-pc-solaris2.11
: checking host system type... x86_64-sun-solaris2

Looks like a cross-compile configuration. Is that intentional? 

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.
_______________________________________________
nettle-bugs mailing list
[email protected]
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs

Reply via email to