NuxiNL / cloudlibc

CloudABI's standard C library
BSD 2-Clause "Simplified" License
295 stars 17 forks source link

Make many functions interceptable as necessary for Address Sanitizer support. #11

Closed sgielen closed 1 year ago

sgielen commented 5 years ago

In this commit, many standard libc functions are renamed, e.g. from memcpy to __cloudlibc_memcpy. Also, weak aliases are added from the old name to the new name. In normal linking, this makes no difference and the renamed symbols are used automatically.

This change is necessary to allow Address Sanitizer to intercept these functions statically. An Address Sanitizer version of memcpy will exist, which checks its parameters for validity, then proceeds to call __cloudlibc_memcpy to perform the actual operation.

From this commit onwards, the test sources will be compiled with Address Sanitizer support enabled. For this, an updated compiler-rt from cloudabi-ports is necessary. Also, since Address Sanitizer uses C++ internally, this means the unittest binary must be linked with clang++ in order to include all necessary libraries.