make install
7. Validation
gcc -v
Problems encountered during compilation:
concern1:error: dereferencing pointer to incomplete type ‘struct ucontext’
in a function‘x86_64_fallback_frame_state’center: ./:65:47: incorrect: dereferencing pointer to incomplete type ‘struct ucontext’
sc = (struct sigcontext *) (void *) &uc_->uc_mcontext;
sc = (struct sigcontext *) (void *) &uc_->uc_mcontext;
Solution:
struct ucontext * uc_ = context->cfa;
modify to
modify to
struct ucontext_t * uc_ = context->cfa;
Recompile make
Recompile make
Issue 2: sanitizer_platform_limits_posix.cc:158:23: Fatal error: sys/: don't have that file or directory
../../.././libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:159:
28: fatal error: sys/: No such file or directory
#include <sys/>
^
compilation terminated.
28: fatal error: sys/: No such file or directory
#include <sys/>
^
compilation terminated.
Solution:
modifications
libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
Documentation:vim libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
First, comment out the
Next, in line 251, change
Comment out line 251 and paste the following after a line break:
First, comment out the
#include <sys/>
:Next, in line 251, change
unsigned struct_ustat_sz = sizeof(struct ustat);
statementComment out line 251 and paste the following after a line break:
// Use pre-computed size of struct ustat to avoid <sys/> which
// has been removed from glibc 2.28.
#if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \
|| defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \
|| defined(__x86_64__)
#define SIZEOF_STRUCT_USTAT 32
#elif defined(__arm__) || defined(__i386__) || defined(__mips__) \
|| defined(__powerpc__) || defined(__s390__)
#define SIZEOF_STRUCT_USTAT 20
#else
#error Unknown size of struct ustat
#endif
unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT;
Remake
// has been removed from glibc 2.28.
#if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \
|| defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \
|| defined(__x86_64__)
#define SIZEOF_STRUCT_USTAT 32
#elif defined(__arm__) || defined(__i386__) || defined(__mips__) \
|| defined(__powerpc__) || defined(__s390__)
#define SIZEOF_STRUCT_USTAT 20
#else
#error Unknown size of struct ustat
#endif
unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT;
Remake
Question 3:
... /... /... /. /libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc:270:22: Error: polymerize
Hop 'sigaltstack handler_stack' type is incomplete and can't be defined
struct sigaltstack handler_stack;
^~~~~~~~~~~~~
Solution:
1. Open libsanitizer/sanitizer_common/sanitizer_linux.h file, comment line 22 of struct sigaltstack.
2. Amend line 31.32:
uptr internal_sigaltstack(const struct sigaltstack* ss,
struct sigaltstack* oss);
modify to
uptr internal_sigaltstack(const void* ss, void* oss);
3. Modify libsanitizer/sanitizer_common/sanitizer_linux.cc file line 549, 550
uptr internal_sigaltstack(const struct sigaltstack *ss,
struct sigaltstack *oss) {
modify to
uptr internal_sigaltstack(const void *ss, void *oss) {
4.modificationslibsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc270classifier for objects in rows such as words
struct sigaltstack handler_stack;
modify to
stack_t handler_stack;
5. Modify libsanitizer/tsan/tsan_platform_linux.cc294 line
__res_state *statp = (__res_state*)state;
modify to
struct __res_state *statp = (struct __res_state*)state;
Remake
... /... /... /. /libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc:270:22: Error: polymerize
Hop 'sigaltstack handler_stack' type is incomplete and can't be defined
struct sigaltstack handler_stack;
^~~~~~~~~~~~~
Solution:
1. Open libsanitizer/sanitizer_common/sanitizer_linux.h file, comment line 22 of struct sigaltstack.
2. Amend line 31.32:
uptr internal_sigaltstack(const struct sigaltstack* ss,
struct sigaltstack* oss);
modify to
uptr internal_sigaltstack(const void* ss, void* oss);
3. Modify libsanitizer/sanitizer_common/sanitizer_linux.cc file line 549, 550
uptr internal_sigaltstack(const struct sigaltstack *ss,
struct sigaltstack *oss) {
modify to
uptr internal_sigaltstack(const void *ss, void *oss) {
4.modificationslibsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc270classifier for objects in rows such as words
struct sigaltstack handler_stack;
modify to
stack_t handler_stack;
5. Modify libsanitizer/tsan/tsan_platform_linux.cc294 line
__res_state *statp = (__res_state*)state;
modify to
struct __res_state *statp = (struct __res_state*)state;
Remake
concern4:sanitizer_common/sanitizer_internal_defs.h:254:72: error: size of array ‘assertion_failed__1142’ is negative
Solution:
Modify the /gcc-6.3.0/configure file.
Remove target-libsanitizer \ from the file, it's about 2,000 lines.
Remake
Solution:
Modify the /gcc-6.3.0/configure file.
Remove target-libsanitizer \ from the file, it's about 2,000 lines.
Remake