From be7b1ef7c8e58b454e20f7f70d0e316528e2c823 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Tue, 29 Apr 2025 21:35:57 +0000 Subject: [PATCH] [sanitizer_common] Disable termio ioctls on PowerPC glibc-2.42 removed the termio.h header, but there are refrences to it still in the kernel's ioctl.h, so we need disable these ioctls to fix this build. --- .../sanitizer_platform_limits_posix.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 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 7a89bf1c7498..7b81951f82ae 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp @@ -182,6 +182,12 @@ typedef struct user_fpregs elf_fpregset_t; #include #endif +// Work around struct termio usage in ioctl.h on ppc64le. +#if SANITIZER_GLIBC && !__has_include() && defined(__powerpc64__) + #define DISABLE_TERMIO_IOCTLS 1 +#endif + + // Include these after system headers to avoid name clashes and ambiguities. # include "sanitizer_common.h" # include "sanitizer_internal_defs.h" @@ -779,13 +785,15 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); unsigned IOCTL_SOUND_PCM_WRITE_FILTER = SOUND_PCM_WRITE_FILTER; #endif // SOUND_VERSION unsigned IOCTL_TCFLSH = TCFLSH; +#if !defined(DISABLE_TERMIO_IOCTLS) unsigned IOCTL_TCGETA = TCGETA; - unsigned IOCTL_TCGETS = TCGETS; - unsigned IOCTL_TCSBRK = TCSBRK; - unsigned IOCTL_TCSBRKP = TCSBRKP; unsigned IOCTL_TCSETA = TCSETA; unsigned IOCTL_TCSETAF = TCSETAF; unsigned IOCTL_TCSETAW = TCSETAW; +#endif + unsigned IOCTL_TCGETS = TCGETS; + unsigned IOCTL_TCSBRK = TCSBRK; + unsigned IOCTL_TCSBRKP = TCSBRKP; unsigned IOCTL_TCSETS = TCSETS; unsigned IOCTL_TCSETSF = TCSETSF; unsigned IOCTL_TCSETSW = TCSETSW; -- 2.48.1