Commit 9c8f7b52 authored by Carlos Ramos Carreño's avatar Carlos Ramos Carreño

Fix libsanitizer for older GCC in newer machines.

When compiling older GCC versions in newer machines, libsanitizer
does not compile, showing a error: `multiple definition of
'enum fsconfig_command'` (e.g.
https://github.com/llvm/llvm-project/issues/56421).
This is because starting from Glibc 2.36, it is not possible to include
both "linux/fs.h" and "sys/mount.h".

We can apply a patch, similar to the one in
https://reviews.llvm.org/D129471 , but with the extension and lines
changed to match the file. This is also similar to the upstream fix.

See merge request !1579
parent e7e65e8a
Pipeline #34593 passed with stage
in 0 seconds
......@@ -67,6 +67,10 @@ extra-configure-options =
<= gcc-common
version = 8.5.0
md5sum = 0c1f625768840187ef3b10adebe8e3b0
patch-binary = ${patch:location}/bin/patch
patch-options = -p1
patches =
${:_profile_base_location_}/gcc-libsanitizer-multiple-definition-fsconfig_command.patch#2135c53c901d67ce230f5c94352b7780
[gcc-10.5]
<= gcc-common
......
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -65,7 +65,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>
@@ -855,10 +854,10 @@
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;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment