On 8/29/2020 5:55 PM, j...@bitminer.ca wrote:
This fixes the -static option when using lang/gcc for
linking, at least on amd64 (I'm not sure about other
platforms).
Before, gcc would emit both "-Bstatic" and
"-dynamic-linker /usr/libexec/ld.so" to the linker,
and llvm linker 8 would adopt static and ignore the
-dynamic-linker option. llvm10 does both, and the
resulting program fails with coredump and emitting a
syslog message about bogus syscall.
This fix changes the resulting link command to
avoid the dynamic-linker option for static linking.
Thanks also to didick...@gmail.com for help on the issue.
John
Any changes to the link specs should be kept in sync between
the x86 and alpha / arm / mips / pa / rs6000 / sparc configuration
headers. It makes sense to not try to emit -dynamic-linker when static
linking. This is closer to what clang does.
Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/gcc/8/Makefile,v
retrieving revision 1.32
diff -u -p -r1.32 Makefile
--- Makefile 8 Aug 2020 16:48:48 -0000 1.32
+++ Makefile 29 Aug 2020 18:22:39 -0000
@@ -16,7 +16,7 @@ USE_LLD = No
DPB_PROPERTIES = parallel
V = 8.3.0
-REVISION = 6
+REVISION = 7
FULL_VERSION = $V
FULL_PKGVERSION = $V
Index: patches/patch-gcc_config_i386_openbsdelf_h
===================================================================
RCS file: /cvs/ports/lang/gcc/8/patches/patch-gcc_config_i386_openbsdelf_h,v
retrieving revision 1.3
diff -u -p -r1.3 patch-gcc_config_i386_openbsdelf_h
--- patches/patch-gcc_config_i386_openbsdelf_h 8 Aug 2020 16:48:48 -0000
1.3
+++ patches/patch-gcc_config_i386_openbsdelf_h 29 Aug 2020 18:22:39 -0000
@@ -1,5 +1,7 @@
$OpenBSD: patch-gcc_config_i386_openbsdelf_h,v 1.3 2020/08/08 16:48:48 sthen
Exp $
+Test shared and static before adopting dynamic.
+
Index: gcc/config/i386/openbsdelf.h
--- gcc/config/i386/openbsdelf.h.orig
+++ gcc/config/i386/openbsdelf.h
@@ -10,7 +12,7 @@ Index: gcc/config/i386/openbsdelf.h
+ %{rdynamic:-export-dynamic} \
%{assert*} \
- -dynamic-linker /usr/libexec/ld.so"
-+ %{!shared:%{!-dynamic-linker:-dynamic-linker /usr/libexec/ld.so}} \
++ %{!shared:%{!static:%{!-dynamic-linker:-dynamic-linker
/usr/libexec/ld.so}}} \
+ -L/usr/lib"
#undef STARTFILE_SPEC