pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/52951: lang/gcc7 fails to compile on NetBSD 8 on earmv7hf



The following reply was made to PR pkg/52951; it has been noted by GNATS.

From: maya%netbsd.org@localhost
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: pkg/52951: lang/gcc7 fails to compile on NetBSD 8 on earmv7hf
Date: Sat, 27 Jan 2018 12:34:54 +0000

 --82I3+IH0IqGh5yIs
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 sending the patch again because I didn't email gnats.
 I'm not sure how far this gets you, but probably 'further'. I'm
 cross-compiling from x86 and didn't complete a build but I wonder if it
 will be easier natively.
 
 --82I3+IH0IqGh5yIs
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="gcc.diff"
 
 diff --git a/gcc/config.gcc b/gcc/config.gcc
 index ec6822b9d..cfc93cfba 100644
 --- a/gcc/config.gcc
 +++ b/gcc/config.gcc
 @@ -1119,10 +1119,37 @@ arm*-*-freebsd*)                # ARM FreeBSD EABI
  	with_tls=${with_tls:-gnu}
  	;;
  arm*-*-netbsdelf*)
 -	tm_file="dbxelf.h elfos.h ${nbsd_tm_file} arm/elf.h arm/aout.h ${tm_file} arm/netbsd-elf.h"
 -	extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
  	tmake_file="${tmake_file} arm/t-arm"
 -	target_cpu_cname="arm6"
 +	tm_file="dbxelf.h elfos.h ${nbsd_tm_file} arm/elf.h"
 +	extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
 +	case ${target} in
 +	arm*eb-*) tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" ;;
 +	esac
 +	case ${target} in
 +	arm*-*-netbsdelf-*eabi*)
 +	    tm_file="$tm_file arm/bpabi.h arm/netbsd-elf.h arm/netbsd-eabi.h"
 +	    tmake_file="$tmake_file arm/t-bpabi arm/t-netbsdeabi"
 +	    # The BPABI long long divmod functions return a 128-bit value in
 +	    # registers r0-r3.  Correctly modeling that requires the use of
 +	    # TImode.
 +	    need_64bit_hwint=yes
 +	    ;;
 +	*)
 +	    tm_file="$tm_file arm/netbsd-elf.h"
 +	    tmake_file="$tmake_file arm/t-netbsd"
 +	    ;;
 +	esac
 +	tm_file="${tm_file} arm/aout.h arm/arm.h"
 +	case ${target} in
 +	arm*-*-netbsdelf-*eabihf*)
 +	    tm_defines="${tm_defines} TARGET_DEFAULT_FLOAT_ABI=ARM_FLOAT_ABI_HARD"
 +	    ;;
 +	esac
 +	case ${target} in
 +	armv4*) target_cpu_cname="strongarm";;
 +	armv6*) target_cpu_cname="arm1176jzf-s";;
 +	armv7*) target_cpu_cname="cortex-a8";;
 +	esac
  	;;
  arm*-*-linux-*)			# ARM GNU/Linux with ELF
  	tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
 diff --git a/gcc/config/arm/netbsd-eabi.h b/gcc/config/arm/netbsd-eabi.h
 new file mode 100644
 index 000000000..6e1831b31
 --- /dev/null
 +++ b/gcc/config/arm/netbsd-eabi.h
 @@ -0,0 +1,112 @@
 +/* Definitions of target machine for GNU compiler, NetBSD/arm ELF version.
 +   Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
 +   Contributed by Wasabi Systems, Inc.
 +
 +   This file is part of GCC.
 +
 +   GCC is free software; you can redistribute it and/or modify it
 +   under the terms of the GNU General Public License as published
 +   by the Free Software Foundation; either version 3, or (at your
 +   option) any later version.
 +
 +   GCC is distributed in the hope that it will be useful, but WITHOUT
 +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 +   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
 +   License for more details.
 +
 +   You should have received a copy of the GNU General Public License
 +   along with GCC; see the file COPYING3.  If not see
 +   <http://www.gnu.org/licenses/>.  */
 +
 +/* Run-time Target Specification.  */
 +#undef MULTILIB_DEFAULTS
 +#define MULTILIB_DEFAULTS { "mabi=aapcs-linux" }
 +
 +#define TARGET_LINKER_EABI_SUFFIX \
 +    (TARGET_DEFAULT_FLOAT_ABI == ARM_FLOAT_ABI_SOFT \
 +     ? "%{!mabi=apcs-gnu:%{!mabi=atpcs:%{mfloat-abi=hard:_eabihf;:_eabi}}}" \
 +     : "%{!mabi=apcs-gnu:%{!mabi=atpcs:%{mfloat-abi=soft:_eabi;:_eabihf}}}")
 +#define TARGET_LINKER_BIG_EMULATION "armelfb_nbsd%(linker_eabi_suffix)"
 +#define TARGET_LINKER_LITTLE_EMULATION "armelf_nbsd%(linker_eabi_suffix)"
 +
 +/* TARGET_BIG_ENDIAN_DEFAULT is set in
 +   config.gcc for big endian configurations.  */
 +#undef  TARGET_LINKER_EMULATION
 +#if TARGET_BIG_ENDIAN_DEFAULT
 +#define TARGET_LINKER_EMULATION TARGET_LINKER_BIG_EMULATION
 +#undef BE8_LINK_SPEC
 +#define BE8_LINK_SPEC " %{!mlittle-endian:%{march=armv7-a|mcpu=cortex-a5|mcpu=cortex-a8|mcpu=cortex-a9:%{!r:--be8}}}" 
 +#else
 +#define TARGET_LINKER_EMULATION TARGET_LINKER_LITTLE_EMULATION
 +#endif
 +
 +#undef ARM_DEFAULT_ABI
 +#define ARM_DEFAULT_ABI ARM_ABI_AAPCS_LINUX
 +
 +#undef ARM_EABI_UNWIND_TABLES
 +#define ARM_EABI_UNWIND_TABLES 0
 +#undef ARM_UNWIND_INFO
 +#define ARM_UNWIND_INFO 0
 +#undef ARM_DWARF_UNWIND_TABLES
 +#define ARM_DWARF_UNWIND_TABLES 1
 +
 +#undef TARGET_OS_CPP_BUILTINS
 +#define TARGET_OS_CPP_BUILTINS()		\
 +  do						\
 +    {						\
 +      if (TARGET_AAPCS_BASED)			\
 +	TARGET_BPABI_CPP_BUILTINS();		\
 +      NETBSD_OS_CPP_BUILTINS_ELF();		\
 +      if (ARM_DWARF_UNWIND_TABLES)		\
 +	builtin_define ("__ARM_DWARF_EH__");	\
 +      if (ARM_EABI_UNWIND_TABLES)		\
 +	builtin_define ("__UNWIND_TABLES__");	\
 +    }						\
 +  while (0)
 +
 +#undef SUBTARGET_CPP_SPEC
 +#define SUBTARGET_CPP_SPEC NETBSD_CPP_SPEC
 +
 +/*
 + * Override AAPCS types to remain compatible the existing NetBSD types.
 + */
 +#undef WCHAR_TYPE
 +#define WCHAR_TYPE "int"
 +
 +#undef SIZE_TYPE
 +#define SIZE_TYPE "long unsigned int"
 + 
 +#undef PTRDIFF_TYPE
 +#define PTRDIFF_TYPE "long int"
 +
 +#undef SUBTARGET_EXTRA_ASM_SPEC
 +#define SUBTARGET_EXTRA_ASM_SPEC	\
 +  "-matpcs %{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu} %{fpic|fpie:-k} %{fPIC|fPIE:-k}"
 +
 +/* Default to full VFP if -mhard-float is specified.  */
 +#undef SUBTARGET_ASM_FLOAT_SPEC
 +#define SUBTARGET_ASM_FLOAT_SPEC	\
 +  "%{mhard-float:%{!mfpu=*:-mfpu=vfp}}   \
 +   %{mfloat-abi=hard:%{!mfpu=*:-mfpu=vfp}}"
 +
 +#undef SUBTARGET_EXTRA_SPECS
 +#define SUBTARGET_EXTRA_SPECS				\
 +  { "subtarget_extra_asm_spec",	SUBTARGET_EXTRA_ASM_SPEC }, \
 +  { "subtarget_asm_float_spec", SUBTARGET_ASM_FLOAT_SPEC }, \
 +  { "linker_eabi_suffix",	TARGET_LINKER_EABI_SUFFIX }, \
 +  { "linker_emulation",		TARGET_LINKER_EMULATION }, \
 +  { "linker_big_emulation",	TARGET_LINKER_BIG_EMULATION }, \
 +  { "linker_little_emulation",	TARGET_LINKER_LITTLE_EMULATION }, \
 +  { "be8_link_spec",		BE8_LINK_SPEC }, \
 +  { "target_fix_v4bx_spec",	TARGET_FIX_V4BX_SPEC }, \
 +  NETBSD_SUBTARGET_EXTRA_SPECS
 +
 +#define NETBSD_ENTRY_POINT "__start"
 +
 +#undef LINK_SPEC
 +#define LINK_SPEC \
 +  "-X %{mbig-endian:-EB -m %(linker_big_emulation)} \
 +   %{mlittle-endian:-EL -m %(linker_liitle_emulation)} \
 +   %{!mbig-endian:%{!mlittle-endian:-m %(linker_emulation)}} \
 +   %(be8_link_spec) %(target_fix_v4bx_spec) \
 +   %(netbsd_link_spec)"
 diff --git a/gcc/config/arm/netbsd-elf.h b/gcc/config/arm/netbsd-elf.h
 index 11247716c..96fa6056b 100644
 --- a/gcc/config/arm/netbsd-elf.h
 +++ b/gcc/config/arm/netbsd-elf.h
 @@ -27,9 +27,20 @@
  
  /* arm.h defaults to ARM6 CPU.  */
  
 -/* This defaults us to little-endian.  */
 -#ifndef TARGET_ENDIAN_DEFAULT
 -#define TARGET_ENDIAN_DEFAULT 0
 +/* Default EABI to armv5t so that thumb shared libraries work.
 +   The ARM926EH-S core is the default for armv5te, so set
 +   SUBTARGET_CPU_DEFAULT to achieve this.  */
 +
 +#define SUBTARGET_CPU_DEFAULT \
 +	(ARM_DEFAULT_ABI != ARM_ABI_APCS && ARM_DEFAULT_ABI != ARM_ABI_ATPCS \
 +	    ? TARGET_CPU_arm926ejs : TARGET_CPU_arm6)
 +
 +/* TARGET_BIG_ENDIAN_DEFAULT is set in
 +   config.gcc for big endian configurations.  */
 +#if TARGET_BIG_ENDIAN_DEFAULT
 +#define TARGET_ENDIAN_DEFAULT    MASK_BIG_END
 +#else
 +#define TARGET_ENDIAN_DEFAULT    0
  #endif
  
  #undef MULTILIB_DEFAULTS
 @@ -43,6 +54,7 @@
  #undef ARM_DEFAULT_ABI
  #define ARM_DEFAULT_ABI ARM_ABI_ATPCS
  
 +#undef TARGET_OS_CPP_BUILTINS
  #define TARGET_OS_CPP_BUILTINS()	\
    do					\
      {					\
 @@ -55,25 +67,21 @@
  
  #undef SUBTARGET_EXTRA_ASM_SPEC
  #define SUBTARGET_EXTRA_ASM_SPEC	\
 -  "-matpcs %{" FPIE_OR_FPIC_SPEC ":-k}"
 +  "-matpcs %{mabi=aapcs*:-meabi=5} %{fpic|fpie:-k} %{fPIC|fPIE:-k}"
  
  /* Default to full VFP if -mfloat-abi=hard is specified.  */
  #undef SUBTARGET_ASM_FLOAT_SPEC
  #define SUBTARGET_ASM_FLOAT_SPEC	\
 -  "%{mfloat-abi=hard:{!mfpu=*:-mfpu=vfp}}"
 -
 -#undef SUBTARGET_EXTRA_SPECS
 -#define SUBTARGET_EXTRA_SPECS				\
 -  { "subtarget_extra_asm_spec",	SUBTARGET_EXTRA_ASM_SPEC }, \
 -  { "subtarget_asm_float_spec", SUBTARGET_ASM_FLOAT_SPEC }, \
 -  { "netbsd_link_spec",		NETBSD_LINK_SPEC_ELF },	\
 -  { "netbsd_entry_point",	NETBSD_ENTRY_POINT },
 +  "%{mhard-float:%{!mfpu=*:-mfpu=vfp}}   \
 +   %{mfloat-abi=hard:%{!mfpu=*:-mfpu=vfp}}"
  
  #define NETBSD_ENTRY_POINT "__start"
  
  #undef LINK_SPEC
  #define LINK_SPEC \
 -  "-X %{mbig-endian:-EB} %{mlittle-endian:-EL} \
 +  "-X \
 +   %{mbig-endian:-EB %{-mabi=aapcs*:-m armelfb_nbsd_eabi}} \
 +   %{mlittle-endian:-EL %{-mabi=aapcs*:-m armelf_nbsd_eabi}} \
     %(netbsd_link_spec)"
  
  /* Make GCC agree with <machine/ansi.h>.  */
 @@ -84,6 +92,12 @@
  #undef PTRDIFF_TYPE
  #define PTRDIFF_TYPE "long int"
  
 +#undef INTPTR_TYPE
 +#define INTPTR_TYPE PTRDIFF_TYPE
 +
 +#undef UINTPTR_TYPE
 +#define UINTPTR_TYPE SIZE_TYPE
 +
  /* We don't have any limit on the length as out debugger is GDB.  */
  #undef DBX_CONTIN_LENGTH
  
 @@ -153,3 +167,12 @@ do									\
      (void) sysarch (0, &s);						\
    }									\
  while (0)
 +
 +#undef FPUTYPE_DEFAULT
 +#define FPUTYPE_DEFAULT "vfp"
 +
 +/* Ensure that libgcc does not attempt to define __[CD]TOR_LIST__[] for APCS,
 +   which belongs in crtbegin on NetBSD.  */
 +#ifndef __ARM_EABI__
 +#define CTOR_LISTS_DEFINED_EXTERNALLY
 +#endif
 diff --git a/gcc/config/netbsd-elf.h b/gcc/config/netbsd-elf.h
 index 4dc2aa757..98305635b 100644
 --- a/gcc/config/netbsd-elf.h
 +++ b/gcc/config/netbsd-elf.h
 @@ -1,5 +1,5 @@
  /* Common configuration file for NetBSD ELF targets.
 -   Copyright (C) 2002-2018 Free Software Foundation, Inc.
 +   Copyright (C) 2002-2015 Free Software Foundation, Inc.
     Contributed by Wasabi Systems, Inc.
  
  This file is part of GCC.
 @@ -40,8 +40,11 @@ along with GCC; see the file COPYING3.  If not see
         %{!p:crt0%O%s}}}		\
     %:if-exists(crti%O%s)	\
     %{static:%:if-exists-else(crtbeginT%O%s crtbegin%O%s)} \
 -   %{!static: \
 -     %{!shared:crtbegin%O%s} %{shared:crtbeginS%O%s}}"
 +   %{!static:                   \
 +     %{!shared:                 \
 +       %{!pie:crtbegin%O%s}     \
 +       %{pie:crtbeginS%O%s}}    \
 +     %{shared:crtbeginS%O%s}}"
  
  #undef STARTFILE_SPEC
  #define STARTFILE_SPEC NETBSD_STARTFILE_SPEC
 @@ -52,7 +55,10 @@ along with GCC; see the file COPYING3.  If not see
     C++ file-scope static objects deconstructed after exiting "main".  */
  
  #define NETBSD_ENDFILE_SPEC	\
 -  "%{!shared:crtend%O%s} %{shared:crtendS%O%s} \
 +  "%{!shared:                   \
 +    %{!pie:crtend%O%s}          \
 +    %{pie:crtendS%O%s}}         \
 +   %{shared:crtendS%O%s}        \
     %:if-exists(crtn%O%s)"
  
  #undef ENDFILE_SPEC
 @@ -67,6 +73,9 @@ along with GCC; see the file COPYING3.  If not see
  
     Target-specific code must provide the %(netbsd_entry_point) spec.  */
  
 +#define NETBSD_LINK_LD_ELF_SO_SPEC \
 +  "%{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}"
 +
  #define NETBSD_LINK_SPEC_ELF \
    "%{assert*} %{R*} %{rpath*} \
     %{shared:-shared} \
 @@ -78,10 +87,34 @@ along with GCC; see the file COPYING3.  If not see
  	 %{!e*:-e %(netbsd_entry_point)}}} \
       %{!static: \
         %{rdynamic:-export-dynamic} \
 -       -dynamic-linker /usr/libexec/ld.elf_so} \
 -     %{static:-static}}"
 +       %(netbsd_link_ld_elf_so)} \
 +     %{static:-static \
 +       %{pie: %(netbsd_link_ld_elf_so)}}} \
 +   %{!nostdlib:%{!nodefaultlibs:\
 +     %{%:sanitize(address): -lasan } \
 +     %{%:sanitize(undefined): -lubsan}}}"
 +
 +/* Provide the standard list of subtarget extra specs for NetBSD targets.  */
 +#define NETBSD_SUBTARGET_EXTRA_SPECS \
 +  { "netbsd_link_ld_elf_so",    NETBSD_LINK_LD_ELF_SO_SPEC }, \
 +  { "netbsd_cpp_spec",          NETBSD_CPP_SPEC }, \
 +  { "netbsd_link_spec",         NETBSD_LINK_SPEC_ELF }, \
 +  { "netbsd_entry_point",       NETBSD_ENTRY_POINT }, \
 +  { "netbsd_endfile_spec",      NETBSD_ENDFILE_SPEC },
 +
 +#undef SUBTARGET_EXTRA_SPECS
 +#define SUBTARGET_EXTRA_SPECS   NETBSD_SUBTARGET_EXTRA_SPECS
 +
  
  /* Use --as-needed -lgcc_s for eh support.  */
  #ifdef HAVE_LD_AS_NEEDED
  #define USE_LD_AS_NEEDED 1
  #endif
 +
 +#undef TARGET_UNWIND_TABLES_DEFAULT
 +#define TARGET_UNWIND_TABLES_DEFAULT true
 +
 +#undef REAL_LIBGCC_SPEC
 +#define REAL_LIBGCC_SPEC						   \
 +   "%{static|static-libgcc:-lgcc}"					   \
 +   "%{!static:%{!static-libgcc:--as-needed -lgcc_s --no-as-needed -lgcc}}"
 
 --82I3+IH0IqGh5yIs--
 


Home | Main Index | Thread Index | Old Index