This is an archive of the discontinued LLVM Phabricator instance.

[Sanitizers] Solaris largefile fixes
ClosedPublic

Authored by ro on Nov 5 2018, 5:34 AM.

Details

Summary

While testing the Solaris libsanitizer port on GCC mainline, I found that I'd messed up
the largefile checks in various ways, some of which showed as compile failures
(wrong structure sizes and member offsets), others at runtime, some of those only
on sparc as a big-endian target.

This patch fixes all of them:

  • OFF_T is now correctly defined for 32-bit largefile and traditional environments, and 64-bit.
  • The definition of __sanitizer_dirent now checks the correct conditionals.
  • sanitizer_procmaps_solaris.cc undefines `_FILE_OFFSET_BITS``: before Solaris 11.4 `<procfs.h>` doesn't even compile with largefile support enabled, but the use at hand doesn't need it anyway while g++ 9 will define`_FILE_OFFSET_BITS=64`` out of the box.
  • With full largefile support enabled, one needs to use e.g. `mmap64`` instead of `mmap``; this is hidden behind macros.

With this patch I could bootstrap gcc mainline on both sparc-sun-solaris2.11 and
i386-pc-solaris2.11. In addition, I've successfully built llvm on i386-pc-solaris2.11.

Diff Detail

Repository
rL LLVM

Event Timeline

ro created this revision.Nov 5 2018, 5:34 AM
krytarowski accepted this revision.Nov 5 2018, 6:09 AM
This revision is now accepted and ready to land.Nov 5 2018, 6:09 AM
This revision was automatically updated to reflect the committed changes.