summaryrefslogtreecommitdiff
path: root/src/pal
diff options
context:
space:
mode:
authorOmair Majid <omair.majid@gmail.com>2017-09-05 19:22:55 -0400
committerJan Vorlicek <janvorli@microsoft.com>2017-09-06 01:22:55 +0200
commita8f83b615708c529b112898e7d2fbc3f618b26ee (patch)
tree0528c79675cd64d823fc6eb841dbaa3786a2af9d /src/pal
parent342db113af0fe0743f5a3baf7b2390c80b0a8969 (diff)
downloadcoreclr-a8f83b615708c529b112898e7d2fbc3f618b26ee.tar.gz
coreclr-a8f83b615708c529b112898e7d2fbc3f618b26ee.tar.bz2
coreclr-a8f83b615708c529b112898e7d2fbc3f618b26ee.zip
Add support for building under glibc 2.26 (#13785)
glibc 2.26 renames a number of identifiers so they are reserved under POSIX. Specifically, `padding` becomes `__glibc_reserved1`. Add a configure test for it and use the appropriate field name. See https://sourceware.org/bugzilla/show_bug.cgi?id=21457 for more information. Resolves #13009
Diffstat (limited to 'src/pal')
-rw-r--r--src/pal/src/config.h.in1
-rw-r--r--src/pal/src/configure.cmake1
-rw-r--r--src/pal/src/include/pal/context.h10
3 files changed, 10 insertions, 2 deletions
diff --git a/src/pal/src/config.h.in b/src/pal/src/config.h.in
index 664ae59158..0052880d68 100644
--- a/src/pal/src/config.h.in
+++ b/src/pal/src/config.h.in
@@ -77,6 +77,7 @@
#cmakedefine01 HAVE_PT_REGS
#cmakedefine01 HAVE_GREGSET_T
#cmakedefine01 HAVE___GREGSET_T
+#cmakedefine01 HAVE_FPSTATE_GLIBC_RESERVED1
#cmakedefine01 HAVE_SIGINFO_T
#cmakedefine01 HAVE_UCONTEXT_T
#cmakedefine01 HAVE_PTHREAD_RWLOCK_T
diff --git a/src/pal/src/configure.cmake b/src/pal/src/configure.cmake
index 233cbb12b7..b797caf55f 100644
--- a/src/pal/src/configure.cmake
+++ b/src/pal/src/configure.cmake
@@ -136,6 +136,7 @@ check_struct_has_member ("struct stat" st_atimensec "sys/types.h;sys/stat.h" HAV
check_struct_has_member ("struct tm" tm_gmtoff time.h HAVE_TM_GMTOFF)
check_struct_has_member ("ucontext_t" uc_mcontext.gregs[0] ucontext.h HAVE_GREGSET_T)
check_struct_has_member ("ucontext_t" uc_mcontext.__gregs[0] ucontext.h HAVE___GREGSET_T)
+check_struct_has_member ("ucontext_t" uc_mcontext.fpregs->__glibc_reserved1[0] ucontext.h HAVE_FPSTATE_GLIBC_RESERVED1)
check_struct_has_member ("struct sysinfo" mem_unit "sys/sysinfo.h" HAVE_SYSINFO_WITH_MEM_UNIT)
set(CMAKE_EXTRA_INCLUDE_FILES machine/reg.h)
diff --git a/src/pal/src/include/pal/context.h b/src/pal/src/include/pal/context.h
index 2c86a03d69..bd6797760d 100644
--- a/src/pal/src/include/pal/context.h
+++ b/src/pal/src/include/pal/context.h
@@ -151,15 +151,21 @@ using asm_sigcontext::_xstate;
#ifdef XSTATE_SUPPORTED
+#if HAVE_FPSTATE_GLIBC_RESERVED1
+#define FPSTATE_RESERVED __glibc_reserved1
+#else
+#define FPSTATE_RESERVED padding
+#endif
+
inline _fpx_sw_bytes *FPREG_FpxSwBytes(const ucontext_t *uc)
{
// Bytes 464..511 in the FXSAVE format are available for software to use for any purpose. In this case, they are used to
// indicate information about extended state.
- _ASSERTE(reinterpret_cast<UINT8 *>(&FPREG_Fpstate(uc)->padding[12]) - reinterpret_cast<UINT8 *>(FPREG_Fpstate(uc)) == 464);
+ _ASSERTE(reinterpret_cast<UINT8 *>(&FPREG_Fpstate(uc)->FPSTATE_RESERVED[12]) - reinterpret_cast<UINT8 *>(FPREG_Fpstate(uc)) == 464);
_ASSERTE(FPREG_Fpstate(uc) != nullptr);
- return reinterpret_cast<_fpx_sw_bytes *>(&FPREG_Fpstate(uc)->padding[12]);
+ return reinterpret_cast<_fpx_sw_bytes *>(&FPREG_Fpstate(uc)->FPSTATE_RESERVED[12]);
}
inline UINT32 FPREG_ExtendedSize(const ucontext_t *uc)