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

Bug#1057004: gcc-13: hurd-amd64 support



Package: gcc-13
Version: 13.2.0-7
Severity: important
Tags: patch
X-Debbugs-Cc: debian-hurd@lists.debian.org
User: debian-hurd@lists.debian.org
Usertags: hurd

Hello,

The attached patch adds support for hurd-amd64, could you apply it?

The part in hurd-amd64.diff comes from the upstream master commits,
which will thus be included in gcc 14.

The parts in hurd-multiarch.diff and hurd-multilib-multiarch.diff are
for long term, like gcc-multiarch.diff and gcc-multilib-multiarch.diff
for other archs.

Thanks,
Samuel

-- System Information:
Debian Release: trixie/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 'unreleased'), (500, 'testing-debug'), (500, 'stable-security'), (500, 'stable-debug'), (500, 'oldstable-proposed-updates-debug'), (500, 'oldstable-proposed-updates'), (500, 'oldoldstable-proposed-updates'), (500, 'oldoldstable'), (500, 'buildd-unstable'), (500, 'unstable'), (500, 'stable'), (500, 'oldstable'), (1, 'experimental-debug'), (1, 'buildd-experimental'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, arm64

Kernel: Linux 6.5.0-1-amd64 (SMP w/8 CPU threads; PREEMPT)
Kernel taint flags: TAINT_WARN, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages gcc-13 depends on:
ii  binutils       2.41-7
ii  cpp-13         13.2.0-7
ii  gcc-13-base    13.2.0-7
ii  libc6          2.37-12+b1
ii  libcc1-0       13.2.0-7
ii  libgcc-13-dev  13.2.0-7
ii  libgcc-s1      13.2.0-7
ii  libgmp10       2:6.3.0+dfsg-2
ii  libisl23       0.26-3
ii  libmpc3        1.3.1-1
ii  libmpfr6       4.2.1-1
ii  libstdc++6     13.2.0-7
ii  libzstd1       1.5.5+dfsg2-2
ii  zlib1g         1:1.2.13.dfsg-3

Versions of packages gcc-13 recommends:
ii  libc6-dev  2.37-12+b1

Versions of packages gcc-13 suggests:
ii  gcc-13-doc       13.2.0-1
pn  gcc-13-locales   <none>
ii  gcc-13-multilib  13.2.0-7

-- no debconf information

-- 
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.
diff --git a/debian/patches/hurd-amd64.diff b/debian/patches/hurd-amd64.diff
new file mode 100644
index 0000000..e7288ea
--- /dev/null
+++ b/debian/patches/hurd-amd64.diff
@@ -0,0 +1,127 @@
+commit 5707e9db9c398d311defc80c5b7822c9a07ead60
+Author: Samuel Thibault <samuel.thibault@gnu.org>
+Date:   Sat May 6 13:50:36 2023 +0200
+
+    hurd: Add multilib paths for gnu-x86_64
+    
+    We need the multilib paths in gcc to find e.g. glibc crt files on
+    Debian.  This is essentially based on t-linux64 version.
+    
+    gcc/ChangeLog:
+    
+            * config/i386/t-gnu64: New file.
+            * config.gcc [x86_64-*-gnu*]: Add i386/t-gnu64 to
+            tmake_file.
+
+commit c768917402d4cba69a92c737e56e177f5b8ab0df
+Author: Samuel Thibault <samuel.thibault@gnu.org>
+Date:   Sat May 6 13:55:44 2023 +0200
+
+    hurd: Ad default-pie and static-pie support
+    
+    This fixes the Hurd spec in the default-pie case, and adds static-pie
+    support.
+    
+    gcc/ChangeLog:
+    
+            * config/i386/gnu.h: Use PIE_SPEC, add static-pie case.
+            * config/i386/gnu64.h: Use PIE_SPEC, add static-pie case.
+
+diff --git a/src/gcc/config.gcc b/src/gcc/config.gcc
+index 3000379cafc..e62849c1230 100644
+--- a/src/gcc/config.gcc
++++ b/src/gcc/config.gcc
+@@ -5973,6 +5973,9 @@ case ${target} in
+ 	visium-*-*)
+ 		target_cpu_default2="TARGET_CPU_$with_cpu"
+ 		;;
++	x86_64-*-gnu*)
++		tmake_file="$tmake_file i386/t-gnu64"
++		;;
+ esac
+ 
+ t=
+diff --git a/src/gcc/config/i386/t-gnu64 b/src/gcc/config/i386/t-gnu64
+new file mode 100644
+index 00000000000..23ee6823d65
+--- /dev/null
++++ b/src/gcc/config/i386/t-gnu64
+@@ -0,0 +1,38 @@
++# Copyright (C) 2002-2023 Free Software Foundation, 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/>.
++
++# On Debian, Ubuntu and other derivative distributions, the 32bit libraries
++# are found in /lib32 and /usr/lib32, /lib64 and /usr/lib64 are symlinks to
++# /lib and /usr/lib, while other distributions install libraries into /lib64
++# and /usr/lib64.  The LSB does not enforce the use of /lib64 and /usr/lib64,
++# it doesn't tell anything about the 32bit libraries on those systems.  Set
++# MULTILIB_OSDIRNAMES according to what is found on the target.
++
++# To support i386, x86-64 and x32 libraries, the directory structrue
++# should be:
++#
++# 	/lib has i386 libraries.
++# 	/lib64 has x86-64 libraries.
++# 	/libx32 has x32 libraries.
++#
++comma=,
++MULTILIB_OPTIONS    = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
++MULTILIB_DIRNAMES   = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
++MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-gnu)
++MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-gnu)
++MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-gnux32)
+
+
+diff --git a/src/gcc/config/i386/gnu.h b/src/gcc/config/i386/gnu.h
+index 8dc6d9ee4e3..e776144f96c 100644
+--- a/src/gcc/config/i386/gnu.h
++++ b/src/gcc/config/i386/gnu.h
+@@ -27,12 +27,12 @@ along with GCC.  If not, see <http://www.gnu.org/licenses/>.
+ #undef	STARTFILE_SPEC
+ #if defined HAVE_LD_PIE
+ #define STARTFILE_SPEC \
+-  "%{!shared: %{pg|p|profile:%{static:gcrt0.o%s;:gcrt1.o%s};pie:Scrt1.o%s;static:crt0.o%s;:crt1.o%s}} \
+-   crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++  "%{!shared: %{pg|p|profile:%{static-pie:grcrt0.o%s;static:gcrt0.o%s;:gcrt1.o%s};static-pie:rcrt0.o%s;static:crt0.o%s;" PIE_SPEC ":Scrt1.o%s;:crt1.o%s}} \
++   crti.o%s %{static:crtbeginT.o%s;shared|static-pie|" PIE_SPEC ":crtbeginS.o%s;:crtbegin.o%s}"
+ #else
+ #define STARTFILE_SPEC \
+   "%{!shared: %{pg|p|profile:%{static:gcrt0.o%s;:gcrt1.o%s};static:crt0.o%s;:crt1.o%s}} \
+-   crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++   crti.o%s %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}"
+ #endif
+ 
+ #ifdef TARGET_LIBC_PROVIDES_SSP
+diff --git a/src/gcc/config/i386/gnu64.h b/src/gcc/config/i386/gnu64.h
+index a411f0e802a..332372fa067 100644
+--- a/src/gcc/config/i386/gnu64.h
++++ b/src/gcc/config/i386/gnu64.h
+@@ -31,10 +31,10 @@ along with GCC.  If not, see <http://www.gnu.org/licenses/>.
+ #undef	STARTFILE_SPEC
+ #if defined HAVE_LD_PIE
+ #define STARTFILE_SPEC \
+-  "%{!shared: %{pg|p|profile:%{static:gcrt0.o%s;:gcrt1.o%s};pie:Scrt1.o%s;static:crt0.o%s;:crt1.o%s}} \
+-   crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++  "%{!shared: %{pg|p|profile:%{static-pie:grcrt0.o%s;static:gcrt0.o%s;:gcrt1.o%s};static-pie:rcrt0.o%s;static:crt0.o%s;" PIE_SPEC ":Scrt1.o%s;:crt1.o%s}} \
++   crti.o%s %{static:crtbeginT.o%s;shared|static-pie|" PIE_SPEC ":crtbeginS.o%s;:crtbegin.o%s}"
+ #else
+ #define STARTFILE_SPEC \
+   "%{!shared: %{pg|p|profile:%{static:gcrt0.o%s;:gcrt1.o%s};static:crt0.o%s;:crt1.o%s}} \
+-   crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++   crti.o%s %{static:crtbeginT.o%s;shared|static-pie|" PIE_SPEC ":crtbeginS.o%s;:crtbegin.o%s}"
+ #endif
diff --git a/debian/patches/hurd-multiarch.diff b/debian/patches/hurd-multiarch.diff
new file mode 100644
index 0000000..d814c6e
--- /dev/null
+++ b/debian/patches/hurd-multiarch.diff
@@ -0,0 +1,16 @@
+--- a/src/gcc/config/i386/t-gnu64	2023-05-06 22:43:39.395795420 +0200
++++ b/src/gcc/config/i386/t-gnu64	2023-05-06 22:43:39.395795420 +0200
+@@ -36,3 +36,13 @@
+ MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-gnu)
+ MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-gnu)
+ MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-gnux32)
++
++ifneq (,$(findstring x86_64,$(target)))
++  ifneq (,$(findstring biarchx32.h,$(tm_include_list)))
++  MULTIARCH_DIRNAME = $(call if_multiarch,x86_64-gnux32)
++  else
++  MULTIARCH_DIRNAME = $(call if_multiarch,x86_64-gnu)
++  endif
++else
++  MULTIARCH_DIRNAME = $(call if_multiarch,i386-gnu)
++endif
diff --git a/debian/patches/hurd-multilib-multiarch.diff b/debian/patches/hurd-multilib-multiarch.diff
new file mode 100644
index 0000000..6975ce8
--- /dev/null
+++ b/debian/patches/hurd-multilib-multiarch.diff
@@ -0,0 +1,23 @@
+--- a/src/gcc/config/i386/t-gnu64	2023-05-06 22:43:39.395795420 +0200
++++ b/src/gcc/config/i386/t-gnu64	2023-05-06 22:43:39.395795420 +0200
+@@ -33,9 +33,19 @@
+ comma=,
+ MULTILIB_OPTIONS    = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
+ MULTILIB_DIRNAMES   = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
++ifneq (,$(findstring gnux32,$(target)))
+ MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-gnu)
+-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-gnu)
++MULTILIB_OSDIRNAMES+= m32=../lib32$(call if_multiarch,:i386-gnu)
++MULTILIB_OSDIRNAMES+= mx32=../lib$(call if_multiarch,:x86_64-gnux32)
++else ifneq (,$(findstring x86_64,$(target)))
++MULTILIB_OSDIRNAMES = m64=../lib$(call if_multiarch,:x86_64-gnu)
++MULTILIB_OSDIRNAMES+= m32=../lib32$(call if_multiarch,:i386-gnu)
+ MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-gnux32)
++else
++MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-gnu)
++MULTILIB_OSDIRNAMES+= m32=../lib$(call if_multiarch,:i386-gnu)
++MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-gnux32)
++endif
+ 
+ ifneq (,$(findstring x86_64,$(target)))
+   ifneq (,$(findstring biarchx32.h,$(tm_include_list)))
diff --git a/debian/rules.patch b/debian/rules.patch
index 213dafd..a762ac0 100644
--- a/debian/rules.patch
+++ b/debian/rules.patch
@@ -203,6 +203,9 @@ endif
 
 ifeq ($(DEB_TARGET_ARCH_OS),hurd)
   debian_patches += hurd-changes
+  debian_patches += hurd-amd64
+  debian_patches += hurd-multiarch
+  debian_patches += hurd-multilib-multiarch
   # FIXME: #1005297, PR 104660
   debian_patches += libgo-hurd-hack
 endif

Reply to: