unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#73793] [PATCH] gnu: gcc-9: Fix name conflict for newer glibc versions
@ 2024-10-13 15:22 Rutherther via Guix-patches via
  2024-10-13 17:10 ` [bug#73793] [PATCH v2 0/1] Fixes of the patch for gcc 9 Rutherther via Guix-patches via
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Rutherther via Guix-patches via @ 2024-10-13 15:22 UTC (permalink / raw)
  To: 73793; +Cc: Rutherther, Andreas Enge, Ludovic Courtès

Note: not tested yet, I am currently building it locally.

Since newer glibc version there is a conflict in names.
This uses a patch that was used upstream in llvm to bypass it.

* gnu/packages/patches/gcc-9-glibc-name-conflict.patch: Add gcc 9 glibc patch.
* gnu/local.mk: Register it.
* gnu/packages/gcc.scm (gcc-9)[source]: Use it.

Change-Id: Ibb8446b7bba52f72d82fcf69804cae09215daeed
---
 gnu/local.mk                                  |  1 +
 gnu/packages/gcc.scm                          |  3 +-
 .../patches/gcc-9-glibc-name-conflict.patch   | 54 +++++++++++++++++++
 3 files changed, 57 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/gcc-9-glibc-name-conflict.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 3a35bbca37..c1e878587a 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1349,6 +1349,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/gcc-8-sort-libtool-find-output.patch	\
   %D%/packages/patches/gcc-8-strmov-store-file-names.patch	\
   %D%/packages/patches/gcc-9-asan-fix-limits-include.patch	\
+  %D%/packages/patches/gcc-9-glibc-name-conflict.patch	        \
   %D%/packages/patches/gcc-9-strmov-store-file-names.patch	\
   %D%/packages/patches/gcc-12-strmov-store-file-names.patch	\
   %D%/packages/patches/gcc-10-cross-environment-variables.patch \
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index c6c7730ad1..b014cee6c1 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -724,7 +724,8 @@ (define-public gcc-10
             (sha256
              (base32
               "1h87lcfaga0ydsf4pkhwlnjr8mky5ix8npbv6iy3jvzlzm1ra415"))
-            (patches (search-patches "gcc-9-strmov-store-file-names.patch"
+            (patches (search-patches "gcc-9-glibc-name-conflict.patch"
+                                     "gcc-9-strmov-store-file-names.patch"
                                      "gcc-5.0-libvtv-runpath.patch"
                                      "gcc-10-libsanitizer-no-crypt.patch"))
             (modules '((guix build utils)))
diff --git a/gnu/packages/patches/gcc-9-glibc-name-conflict.patch b/gnu/packages/patches/gcc-9-glibc-name-conflict.patch
new file mode 100644
index 0000000000..3796e86c52
--- /dev/null
+++ b/gnu/packages/patches/gcc-9-glibc-name-conflict.patch
@@ -0,0 +1,54 @@
+From b379129c4beb3f26223288627a1291739f33af02 Mon Sep 17 00:00:00 2001
+From: Fangrui Song <i@maskray.me>
+Date: Mon, 11 Jul 2022 11:38:28 -0700
+Subject: [PATCH] [sanitizer] Remove #include <linux/fs.h> to resolve
+ fsconfig_command/mount_attr conflict with glibc 2.36
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+It is generally not a good idea to mix usage of glibc headers and Linux UAPI
+headers (https://sourceware.org/glibc/wiki/Synchronizing_Headers). In glibc
+since 7eae6a91e9b1670330c9f15730082c91c0b1d570 (milestone: 2.36), sys/mount.h
+defines `fsconfig_command` which conflicts with linux/mount.h:
+
+    .../usr/include/linux/mount.h:95:6: error: redeclaration of ‘enum fsconfig_command’
+
+Remove #include <linux/fs.h> which pulls in linux/mount.h. Expand its 4 macros manually.
+
+Fix https://github.com/llvm/llvm-project/issues/56421
+
+Reviewed By: #sanitizers, vitalybuka, zatrazz
+
+Differential Revision: https://reviews.llvm.org/D129471
+---
+ .../sanitizer_common/sanitizer_platform_limits_posix.cpp | 9 ++++-----
+ 1 file changed, 4 insertions(+), 5 deletions(-)
+
+diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
+index 4bd425435d56d9..81740bf4ab3948 100644
+--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
++++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
+@@ -73,7 +73,6 @@
+ #include <sys/vt.h>
+ #include <linux/cdrom.h>
+ #include <linux/fd.h>
+-#include <linux/fs.h>
+ #include <linux/hdreg.h>
+ #include <linux/input.h>
+ #include <linux/ioctl.h>
+@@ -876,10 +875,10 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
+   unsigned IOCTL_EVIOCGPROP = IOCTL_NOT_PRESENT;
+   unsigned IOCTL_EVIOCSKEYCODE_V2 = IOCTL_NOT_PRESENT;
+ #endif
+-  unsigned IOCTL_FS_IOC_GETFLAGS = FS_IOC_GETFLAGS;
+-  unsigned IOCTL_FS_IOC_GETVERSION = FS_IOC_GETVERSION;
+-  unsigned IOCTL_FS_IOC_SETFLAGS = FS_IOC_SETFLAGS;
+-  unsigned IOCTL_FS_IOC_SETVERSION = FS_IOC_SETVERSION;
++  unsigned IOCTL_FS_IOC_GETFLAGS = _IOR('f', 1, long);
++  unsigned IOCTL_FS_IOC_GETVERSION = _IOR('v', 1, long);
++  unsigned IOCTL_FS_IOC_SETFLAGS = _IOW('f', 2, long);
++  unsigned IOCTL_FS_IOC_SETVERSION = _IOW('v', 2, long);
+   unsigned IOCTL_GIO_CMAP = GIO_CMAP;
+   unsigned IOCTL_GIO_FONT = GIO_FONT;
+   unsigned IOCTL_GIO_UNIMAP = GIO_UNIMAP;

base-commit: 8f0d76152a4496960f4c2ec219839c5a48b0568e
-- 
2.46.0




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#73793] [PATCH v2 0/1] Fixes of the patch for gcc 9
  2024-10-13 15:22 [bug#73793] [PATCH] gnu: gcc-9: Fix name conflict for newer glibc versions Rutherther via Guix-patches via
@ 2024-10-13 17:10 ` Rutherther via Guix-patches via
  2024-10-13 17:10 ` [bug#73793] [PATCH v2] gnu: gcc-9: Fix name conflict for newer glibc versions Rutherther via Guix-patches via
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Rutherther via Guix-patches via @ 2024-10-13 17:10 UTC (permalink / raw)
  To: 73793; +Cc: Rutherther, Rutherther, Andreas Enge, Ludovic Courtès

I forgot to change the name guix has in the source from
the one llvm has. Additionally, I also managed to put the
patch to gcc-10 instead of gcc-9. So fixed that as well

The gcc now builds fine for me on x86_64-linux.

Regards,
Rutherther

Rutherther (1):
  gnu: gcc-9: Fix name conflict for newer glibc versions

 gnu/local.mk                                  |  1 +
 gnu/packages/gcc.scm                          |  3 +-
 .../patches/gcc-9-glibc-name-conflict.patch   | 54 +++++++++++++++++++
 3 files changed, 57 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/gcc-9-glibc-name-conflict.patch


base-commit: 8f0d76152a4496960f4c2ec219839c5a48b0568e
--
2.46.0




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#73793] [PATCH v2] gnu: gcc-9: Fix name conflict for newer glibc versions
  2024-10-13 15:22 [bug#73793] [PATCH] gnu: gcc-9: Fix name conflict for newer glibc versions Rutherther via Guix-patches via
  2024-10-13 17:10 ` [bug#73793] [PATCH v2 0/1] Fixes of the patch for gcc 9 Rutherther via Guix-patches via
@ 2024-10-13 17:10 ` Rutherther via Guix-patches via
  2024-10-14 11:52 ` [bug#73793] [PATCH] " Ludovic Courtès
  2024-10-14 18:00 ` [bug#73793] [PATCH v3] gnu: gcc-9: Add libsanitizer fsconfig command patch Rutherther via Guix-patches via
  3 siblings, 0 replies; 6+ messages in thread
From: Rutherther via Guix-patches via @ 2024-10-13 17:10 UTC (permalink / raw)
  To: 73793; +Cc: Rutherther, Rutherther, Andreas Enge, Ludovic Courtès

Since newer glibc version there is a conflict in names.
This uses a patch that was used upstream in llvm to bypass it.

* gnu/packages/patches/gcc-9-glibc-name-conflict.patch: Add gcc 9 glibc patch.
* gnu/local.mk: Register it.
* gnu/packages/gcc.scm (gcc-9)[source]: Use it.

Change-Id: Ibb8446b7bba52f72d82fcf69804cae09215daeed
---
 gnu/local.mk                                  |  1 +
 gnu/packages/gcc.scm                          |  3 +-
 .../patches/gcc-9-glibc-name-conflict.patch   | 54 +++++++++++++++++++
 3 files changed, 57 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/gcc-9-glibc-name-conflict.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 3a35bbca37..c1e878587a 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1349,6 +1349,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/gcc-8-sort-libtool-find-output.patch	\
   %D%/packages/patches/gcc-8-strmov-store-file-names.patch	\
   %D%/packages/patches/gcc-9-asan-fix-limits-include.patch	\
+  %D%/packages/patches/gcc-9-glibc-name-conflict.patch	        \
   %D%/packages/patches/gcc-9-strmov-store-file-names.patch	\
   %D%/packages/patches/gcc-12-strmov-store-file-names.patch	\
   %D%/packages/patches/gcc-10-cross-environment-variables.patch \
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index c6c7730ad1..f3d4985b75 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -705,7 +705,8 @@ (define-public gcc-9
             (sha256
              (base32
               "13ygjmd938m0wmy946pxdhz9i1wq7z4w10l6pvidak0xxxj9yxi7"))
-            (patches (search-patches "gcc-13.2.0-libstdc++-docbook-xsl-uri.patch"
+            (patches (search-patches "gcc-9-glibc-name-conflict.patch"
+                                     "gcc-13.2.0-libstdc++-docbook-xsl-uri.patch"
                                      "gcc-13.2.0-libstdc++-info-install-fix.patch"
                                      "gcc-9-strmov-store-file-names.patch"
                                      "gcc-9-asan-fix-limits-include.patch"
diff --git a/gnu/packages/patches/gcc-9-glibc-name-conflict.patch b/gnu/packages/patches/gcc-9-glibc-name-conflict.patch
new file mode 100644
index 0000000000..0f398ef136
--- /dev/null
+++ b/gnu/packages/patches/gcc-9-glibc-name-conflict.patch
@@ -0,0 +1,54 @@
+From b379129c4beb3f26223288627a1291739f33af02 Mon Sep 17 00:00:00 2001
+From: Fangrui Song <i@maskray.me>
+Date: Mon, 11 Jul 2022 11:38:28 -0700
+Subject: [PATCH] [sanitizer] Remove #include <linux/fs.h> to resolve
+ fsconfig_command/mount_attr conflict with glibc 2.36
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+It is generally not a good idea to mix usage of glibc headers and Linux UAPI
+headers (https://sourceware.org/glibc/wiki/Synchronizing_Headers). In glibc
+since 7eae6a91e9b1670330c9f15730082c91c0b1d570 (milestone: 2.36), sys/mount.h
+defines `fsconfig_command` which conflicts with linux/mount.h:
+
+    .../usr/include/linux/mount.h:95:6: error: redeclaration of ‘enum fsconfig_command’
+
+Remove #include <linux/fs.h> which pulls in linux/mount.h. Expand its 4 macros manually.
+
+Fix https://github.com/llvm/llvm-project/issues/56421
+
+Reviewed By: #sanitizers, vitalybuka, zatrazz
+
+Differential Revision: https://reviews.llvm.org/D129471
+---
+ .../sanitizer_common/sanitizer_platform_limits_posix.cpp | 9 ++++-----
+ 1 file changed, 4 insertions(+), 5 deletions(-)
+
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+index 4bd425435d56d9..81740bf4ab3948 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -73,7 +73,6 @@
+ #include <sys/vt.h>
+ #include <linux/cdrom.h>
+ #include <linux/fd.h>
+-#include <linux/fs.h>
+ #include <linux/hdreg.h>
+ #include <linux/input.h>
+ #include <linux/ioctl.h>
+@@ -876,10 +875,10 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
+   unsigned IOCTL_EVIOCGPROP = IOCTL_NOT_PRESENT;
+   unsigned IOCTL_EVIOCSKEYCODE_V2 = IOCTL_NOT_PRESENT;
+ #endif
+-  unsigned IOCTL_FS_IOC_GETFLAGS = FS_IOC_GETFLAGS;
+-  unsigned IOCTL_FS_IOC_GETVERSION = FS_IOC_GETVERSION;
+-  unsigned IOCTL_FS_IOC_SETFLAGS = FS_IOC_SETFLAGS;
+-  unsigned IOCTL_FS_IOC_SETVERSION = FS_IOC_SETVERSION;
++  unsigned IOCTL_FS_IOC_GETFLAGS = _IOR('f', 1, long);
++  unsigned IOCTL_FS_IOC_GETVERSION = _IOR('v', 1, long);
++  unsigned IOCTL_FS_IOC_SETFLAGS = _IOW('f', 2, long);
++  unsigned IOCTL_FS_IOC_SETVERSION = _IOW('v', 2, long);
+   unsigned IOCTL_GIO_CMAP = GIO_CMAP;
+   unsigned IOCTL_GIO_FONT = GIO_FONT;
+   unsigned IOCTL_GIO_UNIMAP = GIO_UNIMAP;

base-commit: 8f0d76152a4496960f4c2ec219839c5a48b0568e
-- 
2.46.0




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#73793] [PATCH] gnu: gcc-9: Fix name conflict for newer glibc versions
  2024-10-13 15:22 [bug#73793] [PATCH] gnu: gcc-9: Fix name conflict for newer glibc versions Rutherther via Guix-patches via
  2024-10-13 17:10 ` [bug#73793] [PATCH v2 0/1] Fixes of the patch for gcc 9 Rutherther via Guix-patches via
  2024-10-13 17:10 ` [bug#73793] [PATCH v2] gnu: gcc-9: Fix name conflict for newer glibc versions Rutherther via Guix-patches via
@ 2024-10-14 11:52 ` Ludovic Courtès
  2024-10-14 18:00 ` [bug#73793] [PATCH v3] gnu: gcc-9: Add libsanitizer fsconfig command patch Rutherther via Guix-patches via
  3 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2024-10-14 11:52 UTC (permalink / raw)
  To: Rutherther; +Cc: Andreas Enge, 73793

Rutherther <rutherther@ditigal.xyz> skribis:

> Note: not tested yet, I am currently building it locally.
>
> Since newer glibc version there is a conflict in names.
> This uses a patch that was used upstream in llvm to bypass it.
>
> * gnu/packages/patches/gcc-9-glibc-name-conflict.patch: Add gcc 9 glibc patch.
> * gnu/local.mk: Register it.
> * gnu/packages/gcc.scm (gcc-9)[source]: Use it.
>
> Change-Id: Ibb8446b7bba52f72d82fcf69804cae09215daeed

[...]

> +++ b/gnu/packages/patches/gcc-9-glibc-name-conflict.patch
> @@ -0,0 +1,54 @@
> +From b379129c4beb3f26223288627a1291739f33af02 Mon Sep 17 00:00:00 2001
> +From: Fangrui Song <i@maskray.me>
> +Date: Mon, 11 Jul 2022 11:38:28 -0700
> +Subject: [PATCH] [sanitizer] Remove #include <linux/fs.h> to resolve
> + fsconfig_command/mount_attr conflict with glibc 2.36
> +MIME-Version: 1.0
> +Content-Type: text/plain; charset=UTF-8
> +Content-Transfer-Encoding: 8bit
> +
> +It is generally not a good idea to mix usage of glibc headers and Linux UAPI
> +headers (https://sourceware.org/glibc/wiki/Synchronizing_Headers). In glibc
> +since 7eae6a91e9b1670330c9f15730082c91c0b1d570 (milestone: 2.36), sys/mount.h
> +defines `fsconfig_command` which conflicts with linux/mount.h:
> +
> +    .../usr/include/linux/mount.h:95:6: error: redeclaration of ‘enum fsconfig_command’

Instead of this new patch, could you check whether
‘gcc-7-libsanitizer-fsconfig-command.patch’ applies?

If not, could you make sure the new patch has a name similar to the
other ones in this area and a similar header?

Thanks in advance,
Ludo’.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#73793] [PATCH v3] gnu: gcc-9: Add libsanitizer fsconfig command patch
  2024-10-13 15:22 [bug#73793] [PATCH] gnu: gcc-9: Fix name conflict for newer glibc versions Rutherther via Guix-patches via
                   ` (2 preceding siblings ...)
  2024-10-14 11:52 ` [bug#73793] [PATCH] " Ludovic Courtès
@ 2024-10-14 18:00 ` Rutherther via Guix-patches via
  2024-10-15 15:45   ` bug#73793: " Ludovic Courtès
  3 siblings, 1 reply; 6+ messages in thread
From: Rutherther via Guix-patches via @ 2024-10-14 18:00 UTC (permalink / raw)
  To: 73793
  Cc: ludo, Rutherther, Rutherther, Ludovic Courtès,
	Andreas Enge

Since newer glibc version there is a conflict in names
between kernel module and glibc module.
This uses a patch that was used upstream in llvm to bypass it.
Without this, the build fails with a redefinition error.

* gnu/packages/gcc.scm: Add gcc-7-libsanitizer-fsconfig-command.patch.

Change-Id: Ibb8446b7bba52f72d82fcf69804cae09215daeed
---
 gnu/packages/gcc.scm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index c6c7730ad1..c9e475b676 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -705,7 +705,8 @@ (define-public gcc-9
             (sha256
              (base32
               "13ygjmd938m0wmy946pxdhz9i1wq7z4w10l6pvidak0xxxj9yxi7"))
-            (patches (search-patches "gcc-13.2.0-libstdc++-docbook-xsl-uri.patch"
+            (patches (search-patches "gcc-7-libsanitizer-fsconfig-command.patch"
+                                     "gcc-13.2.0-libstdc++-docbook-xsl-uri.patch"
                                      "gcc-13.2.0-libstdc++-info-install-fix.patch"
                                      "gcc-9-strmov-store-file-names.patch"
                                      "gcc-9-asan-fix-limits-include.patch"

base-commit: 8f0d76152a4496960f4c2ec219839c5a48b0568e
-- 
2.46.0




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#73793: [PATCH v3] gnu: gcc-9: Add libsanitizer fsconfig command patch
  2024-10-14 18:00 ` [bug#73793] [PATCH v3] gnu: gcc-9: Add libsanitizer fsconfig command patch Rutherther via Guix-patches via
@ 2024-10-15 15:45   ` Ludovic Courtès
  0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2024-10-15 15:45 UTC (permalink / raw)
  To: Rutherther; +Cc: 73793-done

Rutherther <rutherther@ditigal.xyz> skribis:

> Since newer glibc version there is a conflict in names
> between kernel module and glibc module.
> This uses a patch that was used upstream in llvm to bypass it.
> Without this, the build fails with a redefinition error.
>
> * gnu/packages/gcc.scm: Add gcc-7-libsanitizer-fsconfig-command.patch.
>
> Change-Id: Ibb8446b7bba52f72d82fcf69804cae09215daeed

I tweaked the commit log to clarify which entities are changed.

Applied, thanks!

Ludo’.




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-10-15 15:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-13 15:22 [bug#73793] [PATCH] gnu: gcc-9: Fix name conflict for newer glibc versions Rutherther via Guix-patches via
2024-10-13 17:10 ` [bug#73793] [PATCH v2 0/1] Fixes of the patch for gcc 9 Rutherther via Guix-patches via
2024-10-13 17:10 ` [bug#73793] [PATCH v2] gnu: gcc-9: Fix name conflict for newer glibc versions Rutherther via Guix-patches via
2024-10-14 11:52 ` [bug#73793] [PATCH] " Ludovic Courtès
2024-10-14 18:00 ` [bug#73793] [PATCH v3] gnu: gcc-9: Add libsanitizer fsconfig command patch Rutherther via Guix-patches via
2024-10-15 15:45   ` bug#73793: " Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).