pkgsrc/lang/gcc5/patches/patch-gcc_config_arm_arm.h
maya 9812853479 lang/gcc5: add patch to avoid declaring a prototype of host_detect_local_cpu
on platforms which do not include driver-arm.o in gcc/config.host, and do
not have this function. such as netbsd/arm.

an alternative would be to add driver-arm.o for the netbsd/arm case too, but
it would be diverging from netbsd base gcc, and /proc/cpuinfo which is needed
for this function to do anything useful is empty at least on my machine.

(I still can't complete a build on ARM)
2016-09-30 04:06:07 +00:00

20 lines
852 B
C

$NetBSD: patch-gcc_config_arm_arm.h,v 1.1 2016/09/30 04:06:07 maya Exp $
needs host_extra_gcc_objs="driver-arm.o" in gcc/config.host.
otherwise you get an error:
undefined reference to `host_detect_local_cpu(int, char const**)
the function relies on /proc/cpuinfo to exist and provide useful
information, and is used for -m{arch,tune,cpu}=native.
--- gcc/config/arm/arm.h.orig 2016-03-29 13:28:34.000000000 +0000
+++ gcc/config/arm/arm.h
@@ -2394,7 +2394,7 @@ extern const char *arm_rewrite_mcpu (int
/* -mcpu=native handling only makes sense with compiler running on
an ARM chip. */
-#if defined(__arm__)
+#if defined(__arm__) && (defined(__linux__) || defined(__FreeBSD__))
extern const char *host_detect_local_cpu (int argc, const char **argv);
# define EXTRA_SPEC_FUNCTIONS \
{ "local_cpu_detect", host_detect_local_cpu }, \