• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1This enables building on Mac OS and FreeBSD by adding support to their
2variants of the sed utility.
3
4diff -urN gcc-5.2.0.orig/libgcc/config/t-hardfp gcc-5.2.0/libgcc/config/t-hardfp
5--- gcc-5.2.0.orig/libgcc/config/t-hardfp	2015-01-05 04:33:28.000000000 -0800
6+++ gcc-8.1.0/libgcc/config/t-hardfp	2016-04-06 12:04:51.000000000 -0700
7@@ -59,21 +59,52 @@
8
9 hardfp_func_list := $(filter-out $(hardfp_exclusions),$(hardfp_func_list))
10
11+HOST_OS ?= $(shell uname)
12+
13 # Regexp for matching a floating-point mode.
14+ifeq ($(HOST_OS), Darwin)
15+hardfp_mode_regexp := $(shell echo $(hardfp_float_modes) | sed 's/ /|/g')
16+else
17+ifeq ($(HOST_OS), FreeBSD)
18+hardfp_mode_regexp := $(shell echo $(hardfp_float_modes) | sed 's/ /|/g')
19+else
20 hardfp_mode_regexp := $(shell echo $(hardfp_float_modes) | sed 's/ /\\|/g')
21+endif
22+endif
23
24 # Regexp for matching the end of a function name, after the last
25 # floating-point mode.
26+ifeq ($(HOST_OS), Darwin)
27+hardfp_suffix_regexp := $(shell echo $(hardfp_int_modes) 2 3 | sed 's/ /|/g')
28+else
29+ifeq ($(HOST_OS), FreeBSD)
30+hardfp_suffix_regexp := $(shell echo $(hardfp_int_modes) 2 3 | sed 's/ /|/g')
31+else
32 hardfp_suffix_regexp := $(shell echo $(hardfp_int_modes) 2 3 | sed 's/ /\\|/g')
33+endif
34+endif
35
36 # Add -D options to define:
37 #   FUNC: the function name (e.g. __addsf3)
38 #   OP:   the function name without the leading __ and with the last
39 #            floating-point mode removed (e.g. add3)
40 #   TYPE: the last floating-point mode (e.g. sf)
41+
42+ifeq ($(HOST_OS), Darwin)
43 hardfp_defines_for = \
44   $(shell echo $1 | \
45-    sed 's/\(.*\)\($(hardfp_mode_regexp)\)\($(hardfp_suffix_regexp)\|\)$$/-DFUNC=__& -DOP_\1\3 -DTYPE=\2/')
46+    sed -E 's/(.*)($(hardfp_mode_regexp))($(hardfp_suffix_regexp)|.*)$$/-DFUNC=__& -DOP_\1\3 -DTYPE=\2/')
47+else
48+ifeq ($(HOST_OS), FreeBSD)
49+hardfp_defines_for = \
50+  $(shell echo $1 | \
51+    sed -r 's/(.*)($(hardfp_mode_regexp))($(hardfp_suffix_regexp)|.*)$$/-DFUNC=__& -DOP_\1\3 -DTYPE=\2/')
52+else
53+hardfp_defines_for = \
54+  $(shell echo $1 | \
55+    sed 's/\(.*\)\($(hardfp_mode_regexp)\)\($(hardfp_suffix_regexp)\|\)$$/-DFUNC=__& -DOP_\1\3 -DTYPE=\2/')
56+endif
57+endif
58
59 hardfp-o = $(patsubst %,%$(objext),$(hardfp_func_list))
60 $(hardfp-o): %$(objext): $(srcdir)/config/hardfp.c
61