[Bug sanitizer/90337] sanitizer_linux.cc Fails to compile on Illumos-derived Solaris
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90337 --- Comment #6 from Fazal Majid --- @Andrew Pinski I looked for the files in question at https://github.com/google/sanitizers and couldn't find them, so I assumed they were the GCC-specific port of the LLVM sanitizer code.
[Bug sanitizer/90337] sanitizer_linux.cc Fails to compile on Illumos-derived Solaris
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90337 --- Comment #5 from Fazal Majid --- Yet another compile issue: mordac ~/build/gcc-9.1.0/obj/x86_64-pc-solaris2.11/libsanitizer/sanitizer_common>/bin/ksh ../libtool --tag=CXX --mode=compile /home/majid/build/gcc-9.1.0/obj/./gcc/xgcc -shared-libgcc -B/home/majid/build/gcc-9.1.0/obj/./gcc -nostdinc++ -L/home/majid/build/gcc-9.1.0/obj/x86_64-pc-solaris2.11/libstdc++-v3/src -L/home/majid/build/gcc-9.1.0/obj/x86_64-pc-solaris2.11/libstdc++-v3/src/.libs -L/home/majid/build/gcc-9.1.0/obj/x86_64-pc-solaris2.11/libstdc++-v3/libsupc++/.libs -B/usr/local/x86_64-pc-solaris2.11/bin/ -B/usr/local/x86_64-pc-solaris2.11/lib/ -isystem /usr/local/x86_64-pc-solaris2.11/include -isystem /usr/local/x86_64-pc-solaris2.11/sys-include -fchecking=1 -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DHAVE_RPC_XDR_H=1 -DHAVE_TIRPC_RPC_XDR_H=0 -I. -I../../../../libsanitizer/sanitizer_common -I.. -I ../../../../libsanitizer/include -isystem ../../../../libsanitizer/include/system -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -I../../libstdc++-v3/include -I../../libstdc++-v3/include/x86_64-pc-solaris2.11 -I../../../../libsanitizer/../libstdc++-v3/libsupc++ -std=gnu++11 -DSANITIZER_LIBBACKTRACE -DSANITIZER_CP_DEMANGLE -I ../../../../libsanitizer/../libbacktrace -I ../libbacktrace -I ../../../../libsanitizer/../include -include ../../../../libsanitizer/libbacktrace/backtrace-rename.h -g -O2 -MT sanitizer_posix_libcdep.lo -MD -MP -MF .deps/sanitizer_posix_libcdep.Tpo -c -o sanitizer_posix_libcdep.lo ../../../../libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cc libtool: compile: /home/majid/build/gcc-9.1.0/obj/./gcc/xgcc -shared-libgcc -B/home/majid/build/gcc-9.1.0/obj/./gcc -nostdinc++ -L/home/majid/build/gcc-9.1.0/obj/x86_64-pc-solaris2.11/libstdc++-v3/src -L/home/majid/build/gcc-9.1.0/obj/x86_64-pc-solaris2.11/libstdc++-v3/src/.libs -L/home/majid/build/gcc-9.1.0/obj/x86_64-pc-solaris2.11/libstdc++-v3/libsupc++/.libs -B/usr/local/x86_64-pc-solaris2.11/bin/ -B/usr/local/x86_64-pc-solaris2.11/lib/ -isystem /usr/local/x86_64-pc-solaris2.11/include -isystem /usr/local/x86_64-pc-solaris2.11/sys-include -fchecking=1 -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DHAVE_RPC_XDR_H=1 -DHAVE_TIRPC_RPC_XDR_H=0 -I. -I../../../../libsanitizer/sanitizer_common -I.. -I ../../../../libsanitizer/include -isystem ../../../../libsanitizer/include/system -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -I../../libstdc++-v3/include -I../../libstdc++-v3/include/x86_64-pc-solaris2.11 -I../../../../libsanitizer/../libstdc++-v3/libsupc++ -std=gnu++11 -DSANITIZER_LIBBACKTRACE -DSANITIZER_CP_DEMANGLE -I ../../../../libsanitizer/../libbacktrace -I ../libbacktrace -I ../../../../libsanitizer/../include -include ../../../../libsanitizer/libbacktrace/backtrace-rename.h -g -O2 -MT sanitizer_posix_libcdep.lo -MD -MP -MF .deps/sanitizer_posix_libcdep.Tpo -c ../../../../libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cc -fPIC -DPIC -o .libs/sanitizer_posix_libcdep.o ../../../../libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cc: In function 'void __sanitizer::ReleaseMemoryPagesToOS(__sanitizer::uptr, __sanitizer::uptr)': ../../../../libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cc:66:5: error: 'madvise' was not declared in this scope 66 | madvise((char *)beg_aligned, end_aligned - beg_aligned, | ^~~ That's because with these settings /usr/include/mman.h defines posix_madvise() but not advise().
[Bug sanitizer/90337] sanitizer_linux.cc Fails to compile on Illumos-derived Solaris
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90337 --- Comment #3 from Fazal Majid --- Created attachment 46283 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46283&action=edit Patch for the glob_t issue
[Bug sanitizer/90337] sanitizer_linux.cc Fails to compile on Illumos-derived Solaris
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90337 --- Comment #2 from Fazal Majid --- Created attachment 46282 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46282&action=edit Patch for the O_DIRECTORY issue
[Bug sanitizer/90337] sanitizer_linux.cc Fails to compile on Illumos-derived Solaris
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90337 --- Comment #1 from Fazal Majid --- Another error, due to glob_t having gained some extra fields in newer versions of Illumos (apparently based on BSD code contributed by Guide van Rossum). Oracle Solaris: typedef struct glob_t { size_t gl_pathc; /* Count of paths matched by pattern */ char**gl_pathv; /* List of matched pathnames */ size_t gl_offs;/* # of slots reserved in gl_pathv */ /* following are internal to the implementation */ char**gl_pathp; /* gl_pathv + gl_offs */ int gl_pathn; /* # of elements allocated */ } glob_t; Illumos (see also: https://github.com/illumos/illumos-gate/commit/a5229c74bcec7e2b136379c59a46f4b0717fd516) typedef struct glob_t { /* * Members specified by POSIX */ size_t gl_pathc; /* Total count of paths matched by pattern */ char**gl_pathv; /* List of matched pathnames */ size_t gl_offs;/* # of slots reserved in gl_pathv */ /* * Internal-use members: * * NB: The next two members are carried in both the * libc backward compatibility wrapper functions and * the extended functions. */ char**gl_pathp; /* gl_pathv + gl_offs */ int gl_pathn; /* # of elements allocated */ /* * Non-POSIX extensions * * NB: The following members are not carried in * the libc backward compatibility wrapper functions. */ int gl_matchc; /* Count of paths matching pattern. */ int gl_flags; /* Copy of flags parameter to glob. */ struct stat **gl_statv; /* Stat entries corresponding to gl_pathv */ /* * Alternate filesystem access methods for glob; replacement * versions of closedir(3), readdir(3), opendir(3), stat(2) * and lstat(2). */ void (*gl_closedir)(void *); struct dirent *(*gl_readdir)(void *); void *(*gl_opendir)(const char *); int (*gl_lstat)(const char *, struct stat *); int (*gl_stat)(const char *, struct stat *); } glob_t; Patch p2.txt addresses this
[Bug sanitizer/90337] New: sanitizer_linux.cc Fails to compile on Illumos-derived Solaris
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90337 Bug ID: 90337 Summary: sanitizer_linux.cc Fails to compile on Illumos-derived Solaris Product: gcc Version: 9.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: gcc at sentfrom dot com CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org, jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at gcc dot gnu.org Target Milestone: --- sanitizer_linux.cc fails to compile on SmartOS (based on the Illumos fork of OpenSolaris), The reason is that O_DIRECTORY was added to Oracle Solaris 11 post-fork but is not present in Illumos distributions. My workaround is: --- sanitizer_linux.cc.dist Fri May 3 13:25:45 2019 +++ sanitizer_linux.cc Fri May 3 13:27:33 2019 @@ -929,6 +929,11 @@ char task_directory_path[80]; internal_snprintf(task_directory_path, sizeof(task_directory_path), "/proc/%d/task/", pid); +#if SANITIZER_SOLARIS +#ifndef O_DIRECTORY +#define O_DIRECTORY 0 +#endif +#endif descriptor_ = internal_open(task_directory_path, O_RDONLY | O_DIRECTORY); if (internal_iserror(descriptor_)) { Report("Can't open /proc/%d/task for reading.\n", pid); Here is the error: mordac ~/build/gcc-9.1.0/obj/x86_64-pc-solaris2.11/libsanitizer/sanitizer_common>/bin/ksh ../libtool --tag=CXX --mode=compile /home/majid/build/gcc-9.1.0/obj/./gcc/xgcc -shared-libgcc -B/home/majid/build/gcc-9.1.0/obj/./gcc -nostdinc++ -L/home/majid/build/gcc-9.1.0/obj/x86_64-pc-solaris2.11/libstdc++-v3/src -L/home/majid/build/gcc-9.1.0/obj/x86_64-pc-solaris2.11/libstdc++-v3/src/.libs -L/home/majid/build/gcc-9.1.0/obj/x86_64-pc-solaris2.11/libstdc++-v3/libsupc++/.libs -B/usr/local/x86_64-pc-solaris2.11/bin/ -B/usr/local/x86_64-pc-solaris2.11/lib/ -isystem /usr/local/x86_64-pc-solaris2.11/include -isystem /usr/local/x86_64-pc-solaris2.11/sys-include -fchecking=1 -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DHAVE_RPC_XDR_H=1 -DHAVE_TIRPC_RPC_XDR_H=0 -I. -I../../../../libsanitizer/sanitizer_common -I.. -I ../../../../libsanitizer/include -isystem ../../../../libsanitizer/include/system -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -I../../libstdc++-v3/include -I../../libstdc++-v3/include/x86_64-pc-solaris2.11 -I../../../../libsanitizer/../libstdc++-v3/libsupc++ -std=gnu++11 -DSANITIZER_LIBBACKTRACE -DSANITIZER_CP_DEMANGLE -I ../../../../libsanitizer/../libbacktrace -I ../libbacktrace -I ../../../../libsanitizer/../include -include ../../../../libsanitizer/libbacktrace/backtrace-rename.h -g -O2 -MT sanitizer_linux.lo -MD -MP -MF .deps/sanitizer_linux.Tpo -c -o sanitizer_linux.lo ../../../../libsanitizer/sanitizer_common/sanitizer_linux.cc libtool: compile: /home/majid/build/gcc-9.1.0/obj/./gcc/xgcc -shared-libgcc -B/home/majid/build/gcc-9.1.0/obj/./gcc -nostdinc++ -L/home/majid/build/gcc-9.1.0/obj/x86_64-pc-solaris2.11/libstdc++-v3/src -L/home/majid/build/gcc-9.1.0/obj/x86_64-pc-solaris2.11/libstdc++-v3/src/.libs -L/home/majid/build/gcc-9.1.0/obj/x86_64-pc-solaris2.11/libstdc++-v3/libsupc++/.libs -B/usr/local/x86_64-pc-solaris2.11/bin/ -B/usr/local/x86_64-pc-solaris2.11/lib/ -isystem /usr/local/x86_64-pc-solaris2.11/include -isystem /usr/local/x86_64-pc-solaris2.11/sys-include -fchecking=1 -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DHAVE_RPC_XDR_H=1 -DHAVE_TIRPC_RPC_XDR_H=0 -I. -I../../../../libsanitizer/sanitizer_common -I.. -I ../../../../libsanitizer/include -isystem ../../../../libsanitizer/include/system -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -I../../libstdc++-v3/include -I../../libstdc++-v3/include/x86_64-pc-solaris2.11 -I../../../../libsanitizer/../libstdc++-v3/libsupc++ -std=gnu++11 -DSANITIZER_LIBBACKTRACE -DSANITIZER_CP_DEMANGLE -I ../../../../libsanitizer/../libbacktrace -I ../libbacktrace -I ../../../../libsanitizer/../include -include ../../../../libsanitizer/libbacktrace/backtrace-rename.h -g -O2 -MT sanitizer_linux.lo -MD -MP -MF .deps/sanitizer_linux.Tpo -c ../../../../libsanitizer/sanitizer_common/sanitizer_linux.cc -fPIC -DPIC -o .libs/sanitizer_linux.o ../../../../libsanitizer/sanitizer_common/sanitizer_linux.cc: In constructor '__sanitizer::ThreadLister::ThreadLister(__sanitizer::pid_t)': ../../../../libsanitizer/sanitizer_common/sanitizer_linux.cc:932:63: error: 'O_DIRECTORY' was not declared in this scope 932 | descriptor_ = internal_