list(APPEND DFSAN_RUNTIME_LIBRARIES clang_rt.dfsan-${arch})
endif()
+add_custom_target(dfsan_abilist ALL
+ SOURCES ${CLANG_RESOURCE_DIR}/dfsan_abilist.txt)
+add_custom_command(OUTPUT ${CLANG_RESOURCE_DIR}/dfsan_abilist.txt
+ VERBATIM
+ COMMAND
+ cat ${CMAKE_CURRENT_SOURCE_DIR}/done_abilist.txt
+ > ${CLANG_RESOURCE_DIR}/dfsan_abilist.txt
+ DEPENDS done_abilist.txt)
+install(FILES ${CLANG_RESOURCE_DIR}/dfsan_abilist.txt
+ DESTINATION ${LIBCLANG_INSTALL_PATH})
+
add_subdirectory(lit_tests)
return label;
}
+extern "C" SANITIZER_INTERFACE_ATTRIBUTE
+void __dfsan_unimplemented(char *fname) {
+ Report("WARNING: DataFlowSanitizer: call to uninstrumented function %s\n",
+ fname);
+}
+
// Like __dfsan_union, but for use from the client or custom functions. Hence
// the equality comparison is done here before calling __dfsan_union.
SANITIZER_INTERFACE_ATTRIBUTE dfsan_label
__dfsan_label_info[label].l1 = __dfsan_label_info[label].l2 = 0;
__dfsan_label_info[label].desc = desc;
__dfsan_label_info[label].userdata = userdata;
- __dfsan_retval_tls = 0; // Ensures return value is unlabelled in the caller.
return label;
}
*labelp = __dfsan_union(*labelp, label);
}
-SANITIZER_INTERFACE_ATTRIBUTE dfsan_label dfsan_get_label(long data) {
- // The label for 'data' is implicitly passed by the instrumentation pass in
- // the first element of __dfsan_arg_tls. So we can just return it.
- __dfsan_retval_tls = 0; // Ensures return value is unlabelled in the caller.
- return __dfsan_arg_tls[0];
+// Unlike the other dfsan interface functions the behavior of this function
+// depends on the label of one of its arguments. Hence it is implemented as a
+// custom function.
+extern "C" SANITIZER_INTERFACE_ATTRIBUTE dfsan_label
+__dfsw_dfsan_get_label(long data, dfsan_label data_label,
+ dfsan_label *ret_label) {
+ *ret_label = 0;
+ return data_label;
}
SANITIZER_INTERFACE_ATTRIBUTE dfsan_label
SANITIZER_INTERFACE_ATTRIBUTE
const struct dfsan_label_info *dfsan_get_label_info(dfsan_label label) {
- __dfsan_retval_tls = 0; // Ensures return value is unlabelled in the caller.
return &__dfsan_label_info[label];
}
int dfsan_has_label(dfsan_label label, dfsan_label elem) {
- __dfsan_retval_tls = 0; // Ensures return value is unlabelled in the caller.
if (label == elem)
return true;
const dfsan_label_info *info = dfsan_get_label_info(label);
}
dfsan_label dfsan_has_label_with_desc(dfsan_label label, const char *desc) {
- __dfsan_retval_tls = 0; // Ensures return value is unlabelled in the caller.
const dfsan_label_info *info = dfsan_get_label_info(label);
if (info->l1 != 0) {
return dfsan_has_label_with_desc(info->l1, desc) ||
--- /dev/null
+fun:main=uninstrumented
+fun:main=discard
+
+# DFSan interface functions.
+fun:dfsan_union=uninstrumented
+fun:dfsan_union=discard
+
+fun:dfsan_create_label=uninstrumented
+fun:dfsan_create_label=discard
+
+fun:dfsan_set_label=uninstrumented
+fun:dfsan_set_label=discard
+
+fun:dfsan_add_label=uninstrumented
+fun:dfsan_add_label=discard
+
+fun:dfsan_get_label=uninstrumented
+fun:dfsan_get_label=custom
+
+fun:dfsan_read_label=uninstrumented
+fun:dfsan_read_label=discard
+
+fun:dfsan_get_label_info=uninstrumented
+fun:dfsan_get_label_info=discard
+
+fun:dfsan_has_label=uninstrumented
+fun:dfsan_has_label=discard
+
+fun:dfsan_has_label_with_desc=uninstrumented
+fun:dfsan_has_label_with_desc=discard