This is an archive of the discontinued LLVM Phabricator instance.

sanitizer_common: Define FP_XSTATE_MAGIC1 for old glibc
ClosedPublic

Authored by burnus on May 4 2022, 7:50 AM.

Details

Summary

D116208 (commit 1298273e8206a8fc2) added FP_XSTATE_MAGIC1.
However, when building with glibc < 2.16 for backward-dependency
compatibility, it is not defined - and the build breaks.

Note: The define comes from Linux's asm/sigcontext.h but the
file uses signal.h which includes glibc's bits/sigcontext.h - which
is synced from the kernel's file but lags behind.

Solution: For backward compatility with ancient systems, define
FP_XSTATE_MAGIC1 if undefined.

For the old systems, we were building with Linux kernel 3.19 but to support really old glibc systems, we build with a sysroot of glibc 2.12. While our kernel (and the users' kernels) have FP_XSTATE_MAGIC1, glibc 2.12 is too old. – With this patch, building the sanitizer libs works again. This showed up for us today as GCC mainline/13 has now synced the sanitizer libs.

Diff Detail

Event Timeline

burnus created this revision.May 4 2022, 7:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 4 2022, 7:50 AM
burnus requested review of this revision.May 4 2022, 7:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 4 2022, 7:50 AM
vitalybuka accepted this revision.May 4 2022, 10:21 AM

Maybe you rather should change build rules to disable sanitizer on such old config?
There is high probability that they are unusable there anyway.

This revision is now accepted and ready to land.May 4 2022, 10:21 AM
This revision was landed with ongoing or failed builds.May 5 2022, 3:07 AM
This revision was automatically updated to reflect the committed changes.
abidh added a subscriber: abidh.May 5 2022, 3:08 AM

Committed with slight whitespace change to keep clang-format happy.