[compiler-rt] [sanitizer] Remove usage of termios ioctl constants on Linux (PR #149140)

Thurston Dang via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 16 20:51:53 PDT 2025


thurstond wrote:

> > > I have seen other usages of struct termios. Do we need to remove them too?
> > 
> > 
> > Please remove as little as possible (only to fix known issues, or if you can been able to test the change against other affected platforms) to avoid potential regressions.
> > For example, @fweimer-rh mentioned that this change could negatively affect POWER; it's a niche case, but let's not break it unnecessarily. There's also other libcs e.g., musl: do we know for sure that the existing termios references are not needed there?
> > > I am confused. Please show me the pesudo code of one constant on how to deal with them. Guard against glibc or remove them completely or use kernel_xxx instead?
> > 
> > 
> > Guarding against glibc would work. Alternatively, maybe something like `#ifdef TCGETS` (plus a comment about glibc).
> 
> Well the problem to use TCGETS macro is that compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h is not supposed to introduce dependencies or it would cause macro pollution.
> 
> And I do not know whether glibc on PowerPC still defines TCGETS either, since i think it does not.
> 
> I have checked the header files an I do not find KERNEL_TCGETS to use either.

How about:
```
#if SANITIZER_LINUX
...
#if !SANITIZER_GLIBC
// move the existing TCGETS stuff here
#endif
...
#endif
```
or logically equivalent rewrite?

That would make it easy to reason that it will not break MUSL on any platform, it will not break glibc on PowerPC, or any other combination we haven't thought about.

https://github.com/llvm/llvm-project/pull/149140


More information about the llvm-commits mailing list