Skip to content

Commit

Permalink
Fix libsanitizer for older GCC in newer machines.
Browse files Browse the repository at this point in the history
When compiling older GCC versions in newer machines, libsanitizer
does not compile, showing a error: `multiple definition of
'enum fsconfig_command'` (e.g.
llvm/llvm-project#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.
  • Loading branch information
vnmabus committed May 15, 2024
1 parent 76642bf commit df45bfe
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
4 changes: 4 additions & 0 deletions component/gcc/buildout.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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;


0 comments on commit df45bfe

Please sign in to comment.