Hi @Jeremy, Please disregard my earlier V2 patches. Based on review feedback, I’ve updated the series and am now submitting V3.
This series still contains three patches: - [PATCH V3 1/3] - Cygwin: gendef: Add support for [arch] entries & handle overwrites - [PATCH V3 2/3] - Cygwin: math: split math sources into 2 groups - [PATCH V3 3/3] - Cygwin: export sqrtl as alias to sqrt on AArch64 Thanks to Evgeny Karpov [[email protected]] for the suggestions. Thanks, Thirumalai Nagalingam In-lined patch 1/3: winsup/cygwin/scripts/gendef | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/scripts/gendef b/winsup/cygwin/scripts/gendef index d60d45431..b7c9eb2dd 100755 --- a/winsup/cygwin/scripts/gendef +++ b/winsup/cygwin/scripts/gendef @@ -39,6 +39,11 @@ my @nosigfuncs = (); my @text = (); for (@in) { chomp; + if (/^\[(\w+)\]\s+(.*)$/) { + my ($arch, $rest) = ($1, $2); + next unless ($cpu eq $arch); # skip if not this arch + $_ = $rest; # strip [arch] prefix + } s/\s+DATA$//o and do { push @data, $_; next; @@ -68,11 +73,23 @@ for (@in) { push @text, $_; } -for (@text) { +# Final processing is done in reverse order to handle overwrites. +my %overwrites; +for (reverse @text) { my ($alias, $func) = /^(\S+)\s+=\s+(\S+)\s*$/o; + # Get the alias or the function name + my $name = ($alias) ? $alias : $_; + if (exists $overwrites{$name}) { + # The alias or function is already defined and should be skipped. + $_ = ""; + next; + } + $overwrites{$name} = 1; $_ = $alias . ' = ' . $sigfe{$func} if defined($func) && $sigfe{$func}; } +# Remove empty lines resulting from overwrites. +@text = grep { $_ ne "" } @text; open OUT, '>', $output_def or die "$0: couldn't open \"$output_def\" - $!\n"; push @top, (map {$_ . " DATA\n"} @data), (map {$_ . "\n"} @text); -- 2.50.1.windows.1 In-lined patch 2/3: winsup/cygwin/Makefile.am | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/Makefile.am b/winsup/cygwin/Makefile.am index 90a7332a8..6d6190488 100644 --- a/winsup/cygwin/Makefile.am +++ b/winsup/cygwin/Makefile.am @@ -243,12 +243,31 @@ MATH_FILES= \ math/sinhl.c \ math/sinl.c \ math/sinl_internal.S \ - math/sqrtl.c \ math/tanhl.c \ math/tanl.S \ math/tgammal.c \ math/truncl.c +# +# The below MATH_FILES are excluded on AArch64 platform, as long double == double +# So aliasing via cygwin.din them instead of duplicating it in cygwin/math +# + +LONG_DOUBLE_MATH_FILES = \ + math/sqrtl.c + +# +# Select the math sources depending on the target architecture. +# On AArch64: only common files are built. +# On other architectures: build common files + long double math files. +# + +if TARGET_AARCH64 +MATH_FILES = $(COMMON_MATH_FILES) +else +MATH_FILES = $(COMMON_MATH_FILES) $(LONG_DOUBLE_MATH_FILES) +endif + MM_FILES = \ mm/cygheap.cc \ mm/heap.cc \ -- 2.50.1.windows.1 In-lined patch 3/3: winsup/cygwin/cygwin.din | 2 ++ 1 file changed, 2 insertions(+) diff --git a/winsup/cygwin/cygwin.din b/winsup/cygwin/cygwin.din index cd71da274..02ec629d2 100644 --- a/winsup/cygwin/cygwin.din +++ b/winsup/cygwin/cygwin.din @@ -1454,6 +1454,8 @@ sprintf SIGFE sqrt NOSIGFE sqrtf NOSIGFE sqrtl NOSIGFE +# On AArch64, long double == double, so aliasing sqrtl → sqrt +[aarch64] sqrtl = sqrt NOSIGFE srand NOSIGFE srand48 NOSIGFE srandom NOSIGFE -- 2.50.1.windows.1
0001-Cygwin-gendef-Add-support-for-arch-entries-handle-ov.patch
Description: 0001-Cygwin-gendef-Add-support-for-arch-entries-handle-ov.patch
0002-Cygwin-math-split-math-sources-into-2-groups.patch
Description: 0002-Cygwin-math-split-math-sources-into-2-groups.patch
0003-Cygwin-export-sqrtl-as-alias-to-sqrt-on-AArch64.patch
Description: 0003-Cygwin-export-sqrtl-as-alias-to-sqrt-on-AArch64.patch
