Bug#874583: gcc-6: Add support for arm64ilp32 triplet

2017-10-10 Thread Wookey
On 2017-10-10 15:10 +0200, Matthias Klose wrote:
> Control: tags -1 - patch
> Control: tags -1 + wontfix
> 
> closing.  This is not the recent upstream patch, and it's still not applied
> upstream.  Please update the patch for gcc-8 and gcc-7 and resubmit it once 
> it's
> applied upstream.

Fair enough. Sorry I've not got round to that yet. (I've been testing
the whole port and finding other things to fix like coreutils
crossbuild issues and a glibc locking bug).

I agree this is the way to go and will file gcc-7, 8 and upstream
patches as soon as I have them working.

Wouldn't it make sense to leave this bug open for anyone that needs to
fix this for use on stable? I guess it's linked from the arm64ilp32
port page so the fairly small number of people that care can probably
find it even if closed. 

Wookey
-- 
Principal hats:  Linaro, Debian, Wookware, ARM
http://wookware.org/


signature.asc
Description: Digital signature


Bug#874583: gcc-6: Add support for arm64ilp32 triplet

2017-10-10 Thread Matthias Klose
Control: tags -1 - patch
Control: tags -1 + wontfix

closing.  This is not the recent upstream patch, and it's still not applied
upstream.  Please update the patch for gcc-8 and gcc-7 and resubmit it once it's
applied upstream.


On 12.09.2017 21:36, Matthias Klose wrote:
> On 07.09.2017 17:07, Wookey wrote:
>> Package: gcc-6
>> Version: 6.3.0-18
>> Severity: normal
>> Tags: upstream patch
>>
>> gcc has arm64 ILP32 support, but it only works if built as a multilib
>> on arm64 architecture.  This patch allows gcc to also be configured
>> for the aarch64 ILP32 triplet and build the right thing. Without it,
>> gcc defaults to LP64 even when the build is configured as
>> TARGET=aarch64-linux-gnu_ilp32 which is wrong.
>>
>> Note that this uses the newer triplet for this ABI agreed at Linaro
>> Connect (Feb 2018): aarch64-linux-gnu_ilp32, matching the change made
>> in binutils.
>>
>> This support is in gcc-ilp32-default-support.patch
>>
>> The existing debian multiarch support patch has to be modified to
>> match the right triplet and multiarch/multilib paths too. A patch for that 
>> is attached in 
>> gcc-fixup-multilib-patch-for-ilp32-default.patch
>>
>> That is a rather confusing patch-patch, so here is the final file that 
>> should result from it (sans header):
>>
>> LIB1ASMSRC   = aarch64/lib1funcs.asm
>> LIB1ASMFUNCS = _aarch64_sync_cache_range
>>
>> AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
>> ifneq (,$(findstring _ilp32,$(target)))
>> MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call 
>> if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
>> MULTILIB_OSDIRNAMES += mabi.ilp32=../lib$(call 
>> if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
>> MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu_ilp32)
>> else
>> MULTILIB_OSDIRNAMES = mabi.lp64=../lib$(call 
>> if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
>> MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call 
>> if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
>> MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
>> endif
>>
>> These have only been tested on gcc-6, although they should work the same
>> on gcc-7. I will supply separate bug/patches for gcc-7.
> 
> please do. also are all of these accepted upstream?
> 



Bug#874583: gcc-6: Add support for arm64ilp32 triplet

2017-09-12 Thread Matthias Klose
On 07.09.2017 17:07, Wookey wrote:
> Package: gcc-6
> Version: 6.3.0-18
> Severity: normal
> Tags: upstream patch
> 
> gcc has arm64 ILP32 support, but it only works if built as a multilib
> on arm64 architecture.  This patch allows gcc to also be configured
> for the aarch64 ILP32 triplet and build the right thing. Without it,
> gcc defaults to LP64 even when the build is configured as
> TARGET=aarch64-linux-gnu_ilp32 which is wrong.
> 
> Note that this uses the newer triplet for this ABI agreed at Linaro
> Connect (Feb 2018): aarch64-linux-gnu_ilp32, matching the change made
> in binutils.
> 
> This support is in gcc-ilp32-default-support.patch
> 
> The existing debian multiarch support patch has to be modified to
> match the right triplet and multiarch/multilib paths too. A patch for that is 
> attached in 
> gcc-fixup-multilib-patch-for-ilp32-default.patch
> 
> That is a rather confusing patch-patch, so here is the final file that 
> should result from it (sans header):
> 
> LIB1ASMSRC   = aarch64/lib1funcs.asm
> LIB1ASMFUNCS = _aarch64_sync_cache_range
> 
> AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
> ifneq (,$(findstring _ilp32,$(target)))
> MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call 
> if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
> MULTILIB_OSDIRNAMES += mabi.ilp32=../lib$(call 
> if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
> MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu_ilp32)
> else
> MULTILIB_OSDIRNAMES = mabi.lp64=../lib$(call 
> if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
> MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call 
> if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
> MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
> endif
> 
> These have only been tested on gcc-6, although they should work the same
> on gcc-7. I will supply separate bug/patches for gcc-7.

please do. also are all of these accepted upstream?



Bug#874583: gcc-6: Add support for arm64ilp32 triplet

2017-09-07 Thread Wookey
Package: gcc-6
Version: 6.3.0-18
Severity: normal
Tags: upstream patch

gcc has arm64 ILP32 support, but it only works if built as a multilib
on arm64 architecture.  This patch allows gcc to also be configured
for the aarch64 ILP32 triplet and build the right thing. Without it,
gcc defaults to LP64 even when the build is configured as
TARGET=aarch64-linux-gnu_ilp32 which is wrong.

Note that this uses the newer triplet for this ABI agreed at Linaro
Connect (Feb 2018): aarch64-linux-gnu_ilp32, matching the change made
in binutils.

This support is in gcc-ilp32-default-support.patch

The existing debian multiarch support patch has to be modified to
match the right triplet and multiarch/multilib paths too. A patch for that is 
attached in 
gcc-fixup-multilib-patch-for-ilp32-default.patch

That is a rather confusing patch-patch, so here is the final file that 
should result from it (sans header):

LIB1ASMSRC   = aarch64/lib1funcs.asm
LIB1ASMFUNCS = _aarch64_sync_cache_range

AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
ifneq (,$(findstring _ilp32,$(target)))
MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call 
if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
MULTILIB_OSDIRNAMES += mabi.ilp32=../lib$(call 
if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu_ilp32)
else
MULTILIB_OSDIRNAMES = mabi.lp64=../lib$(call 
if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call 
if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
endif

These have only been tested on gcc-6, although they should work the same
on gcc-7. I will supply separate bug/patches for gcc-7.
Date: Sat, 6 May 2017 03:47:38 +0100
Subject: [PATCH 08/16] Add gcc ilp32 default support

--- a/debian/patches/arm64-ilp32-default.diff
+++ b/debian/patches/arm64-ilp32-default.diff
@@ -0,0 +1,42 @@
+--- a/src/gcc/config.gcc
 b/src/gcc/config.gcc
+@@ -515,12 +515,15 @@
+ 	tm_p_file="${tm_p_file} arm/aarch-common-protos.h"
+ 	case ${with_abi} in
+ 	"")
+-		if test "x$with_multilib_list" = xilp32; then
++		case ${target} in
++		aarch64*-*-*_ilp32)
+ 			tm_file="aarch64/biarchilp32.h ${tm_file}"
+-		else
++			;;
++		*)
+ 			tm_file="aarch64/biarchlp64.h ${tm_file}"
+-		fi
+-		;;
++			;;
++		esac
++		;;
+ 	ilp32)
+ 		tm_file="aarch64/biarchilp32.h ${tm_file}"
+ 		;;
+@@ -965,9 +965,16 @@
+ 	esac
+ 	aarch64_multilibs="${with_multilib_list}"
+ 	if test "$aarch64_multilibs" = "default"; then
+-		# TODO: turn on ILP32 multilib build after its support is mature.
+-		# aarch64_multilibs="lp64,ilp32"
+-		aarch64_multilibs="lp64"
++		case $target in
++		aarch64*_ilp32*)
++			aarch64_multilibs="ilp32"
++			;;
++		aarch64*)
++			# TODO: turn on ILP32 multilib build after its support is mature.
++			# aarch64_multilibs="lp64,ilp32"
++			aarch64_multilibs="lp64"
++			;;
++		esac
+ 	fi
+ 	aarch64_multilibs=`echo $aarch64_multilibs | sed -e 's/,/ /g'`
+ 	for aarch64_multilib in ${aarch64_multilibs}; do
--- a/debian/rules.patch
+++ b/debian/rules.patch
@@ -117,6 +117,7 @@
 	pr77857 \
 	pr80533 \
 	pr60818 \
+arm64-ilp32-default \
 
 ifeq ($(libstdcxx_abi),new)
   debian_patches += libstdc++-functexcept
>From 7a35625da966a0aa0733843fee7d100e2f026808 Mon Sep 17 00:00:00 2001
From: Wookey 
Date: Mon, 8 May 2017 01:58:54 +0100
Subject: [PATCH 09/16] Fixup gcc multilib patch for ilp32 default
--- a/debian/patches/gcc-multiarch.diff
+++ b/debian/patches/gcc-multiarch.diff
@@ -163,17 +163,21 @@
 ===
 --- a/src/gcc/config/aarch64/t-aarch64-linux
 +++ b/src/gcc/config/aarch64/t-aarch64-linux
-@@ -22,7 +22,7 @@ LIB1ASMSRC   = aarch64/lib1funcs.asm
+@@ -22,7 +22,12 @@ LIB1ASMSRC   = aarch64/lib1funcs.asm
  LIB1ASMFUNCS = _aarch64_sync_cache_range
  
  AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
--MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
--MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
++ifneq (,$(findstring _ilp32,$(target)))
+ MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
++MULTILIB_OSDIRNAMES += mabi.ilp32=../lib$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
++MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu_ilp32)
++else
 +MULTILIB_OSDIRNAMES = mabi.lp64=../lib$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
-+MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)_ilp32-linux-gnu)
- 
++MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
+ MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
+-
 -MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32
-+MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
++endif
 Index: