[compiler-rt] fix build on Illumos

- there are additional fields for glob_t struct, thus size check is failing.
- to access old mman.h api based on caddr_t, _XOPEN_SOURCE needs to be not defined
 thus we provide the prototype.
- prxmap_t constified.

Reviewers: ro, eugenis

Reviewed-By: ro

Differential Revision: https://reviews.llvm.org/D84046
This commit is contained in:
David Carlier 2020-07-22 15:15:45 +01:00
parent 45b8f7ec35
commit c61dcb8f62
3 changed files with 10 additions and 2 deletions

View File

@ -202,7 +202,8 @@ CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi_name);
CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi_phdr);
CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi_phnum);
CHECK_TYPE_SIZE(glob_t);
// There are additional fields we are not interested in.
COMPILER_CHECK(sizeof(__sanitizer_glob_t) <= sizeof(glob_t));
CHECK_SIZE_AND_OFFSET(glob_t, gl_pathc);
CHECK_SIZE_AND_OFFSET(glob_t, gl_pathv);
CHECK_SIZE_AND_OFFSET(glob_t, gl_offs);

View File

@ -44,6 +44,12 @@
#define MAP_NORESERVE 0
#endif
#if SANITIZER_SOLARIS
// Illumos' declaration of madvie cannot be made visible if _XOPEN_SOURCE
// is defined as g++ does on Solaris.
extern "C" int madvise(caddr_t, size_t, int);
#endif
typedef void (*sa_sigaction_t)(int, siginfo_t *, void *);
namespace __sanitizer {

View File

@ -35,7 +35,8 @@ bool MemoryMappingLayout::Next(MemoryMappedSegment *segment) {
char *last = data_.proc_self_maps.data + data_.proc_self_maps.len;
if (data_.current >= last) return false;
prxmap_t *xmapentry = (prxmap_t*)data_.current;
prxmap_t *xmapentry =
const_cast<prxmap_t *>(reinterpret_cast<const prxmap_t *>(data_.current));
segment->start = (uptr)xmapentry->pr_vaddr;
segment->end = (uptr)(xmapentry->pr_vaddr + xmapentry->pr_size);