Monday, November 30, 2020

Re: gcc --static produces programs that crash

On Sun, 29 Nov 2020 22:45:27 -0500
George Koehler <kernigh@gmail.com> wrote:

> This diff might fix the problem. This diff was in one of my ports
> trees, but I forgot about it....

The diff that I sent yesterday was bad. Please don't build it (and
I'm sorry if you started building it). Adding a REVISION = 0 below
the REVISION = 1 is obviously wrong.

I'm working on making a better diff. --George

> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/lang/gcc/8/Makefile,v
> retrieving revision 1.36
> diff -u -p -r1.36 Makefile
> --- Makefile 14 Nov 2020 00:00:39 -0000 1.36
> +++ Makefile 30 Nov 2020 03:24:18 -0000
> @@ -36,6 +36,8 @@ PKGNAME-objc = gobjc-${FULL_PKGVERSION}
> PKGNAME-ada = gnat-${FULL_PKGVERSION}
> PKGSPEC-main = gcc->=8,<9
>
> +REVISION = 0
> +
> SHARED_LIBS = estdc++ 19.0 \
> gfortran 8.0 \
> objc 8.0 \
> Index: patches/patch-gcc_config_aarch64_openbsd_h
> ===================================================================
> RCS file: /cvs/ports/lang/gcc/8/patches/patch-gcc_config_aarch64_openbsd_h,v
> retrieving revision 1.2
> diff -u -p -r1.2 patch-gcc_config_aarch64_openbsd_h
> --- patches/patch-gcc_config_aarch64_openbsd_h 20 May 2019 14:59:05 -0000 1.2
> +++ patches/patch-gcc_config_aarch64_openbsd_h 30 Nov 2020 03:24:18 -0000
> @@ -57,7 +57,7 @@ Index: gcc/config/aarch64/openbsd.h
> + %{!static:-Bdynamic} \
> + %{rdynamic:-export-dynamic} \
> + %{assert*} \
> -+ %{!shared:%{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so}} \
> ++ %{!shared:%{!static:%{!-dynamic-linker:-dynamic-linker /usr/libexec/ld.so}}} \
> + -L/usr/lib"
> +
> +#define OPENBSD_ENTRY_POINT "__start"
> Index: patches/patch-gcc_config_alpha_openbsd_h
> ===================================================================
> RCS file: /cvs/ports/lang/gcc/8/patches/patch-gcc_config_alpha_openbsd_h,v
> retrieving revision 1.2
> diff -u -p -r1.2 patch-gcc_config_alpha_openbsd_h
> --- patches/patch-gcc_config_alpha_openbsd_h 20 May 2019 14:59:05 -0000 1.2
> +++ patches/patch-gcc_config_alpha_openbsd_h 30 Nov 2020 03:24:18 -0000
> @@ -2,7 +2,7 @@ $OpenBSD: patch-gcc_config_alpha_openbsd
> Index: gcc/config/alpha/openbsd.h
> --- gcc/config/alpha/openbsd.h.orig
> +++ gcc/config/alpha/openbsd.h
> -@@ -19,6 +19,28 @@ along with GCC; see the file COPYING3. If not see
> +@@ -19,6 +19,28 @@ along with GCC; see the file COPYING3.
>
> /* Controlling the compilation driver. */
>
> @@ -17,7 +17,7 @@ Index: gcc/config/alpha/openbsd.h
> + %{!static:-Bdynamic} \
> + %{rdynamic:-export-dynamic} \
> + %{assert*} \
> -+ %{!shared:%{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so}}"
> ++ %{!shared:%{!static:%{!-dynamic-linker:-dynamic-linker /usr/libexec/ld.so}}}"
> +
> +/* As an elf system, we need crtbegin/crtend stuff. */
> +#undef STARTFILE_SPEC
> @@ -31,7 +31,7 @@ Index: gcc/config/alpha/openbsd.h
> /* run-time target specifications */
> #define TARGET_OS_CPP_BUILTINS() \
> do { \
> -@@ -28,18 +50,27 @@ along with GCC; see the file COPYING3. If not see
> +@@ -28,18 +50,27 @@ along with GCC; see the file COPYING3.
>
> /* Layout of source language data types. */
>
> @@ -54,9 +54,9 @@ Index: gcc/config/alpha/openbsd.h
>
> #undef WCHAR_TYPE_SIZE
> #define WCHAR_TYPE_SIZE 32
> -+
> +
> +#undef WINT_TYPE
> +#define WINT_TYPE "int"
> -
> ++
>
> #define LOCAL_LABEL_PREFIX "."
> Index: patches/patch-gcc_config_arm_openbsd_h
> ===================================================================
> RCS file: /cvs/ports/lang/gcc/8/patches/patch-gcc_config_arm_openbsd_h,v
> retrieving revision 1.2
> diff -u -p -r1.2 patch-gcc_config_arm_openbsd_h
> --- patches/patch-gcc_config_arm_openbsd_h 20 May 2019 14:59:05 -0000 1.2
> +++ patches/patch-gcc_config_arm_openbsd_h 30 Nov 2020 03:24:18 -0000
> @@ -82,7 +82,7 @@ Index: gcc/config/arm/openbsd.h
> + %{!static:-Bdynamic} \
> + %{rdynamic:-export-dynamic} \
> + %{assert*} \
> -+ %{!shared:%{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so}} \
> ++ %{!shared:%{!static:%{!-dynamic-linker:-dynamic-linker /usr/libexec/ld.so}}} \
> + %{!nostdlib:-L/usr/lib}"
> +

No comments:

Post a Comment