/* { dg-do run { target { *-*-linux* } } } */ /* { dg-options "-static-libasan" } */ #include <time.h> static int weak_gettime (clockid_t clk_id, struct timespec *tp) __attribute__((__weakref__("clock_gettime"))); int main() { if (!clock_gettime) return 0; struct timespec ts; return weak_gettime(CLOCK_MONOTONIC, &ts); }
extern "C" __inline __attribute__ ((__gnu_inline__)) int pthread_equal () { } static __typeof (pthread_equal) __gthrw_pthread_equal __attribute__ ((__weakref__ ("pthread_equal"))); int identifierByPthreadHandle () { pthread_equal (); }
#include <cassert> #include <stdexcept> #include <glog/logging.h> #include <folly/experimental/fibers/Fiber.h> #include <folly/experimental/fibers/LoopController.h> #ifdef FOLLY_SANITIZE_ADDRESS #include <dlfcn.h> static void __asan_enter_fiber_weak( void const* fiber_stack_base, size_t fiber_stack_extent) __attribute__((__weakref__("__asan_enter_fiber"))); static void __asan_exit_fiber_weak() __attribute__((__weakref__("__asan_exit_fiber"))); typedef void (*AsanEnterFiberFuncPtr)(void const*, size_t); typedef void (*AsanExitFiberFuncPtr)(); namespace folly { namespace fibers { static AsanEnterFiberFuncPtr getEnterFiberFunc(); static AsanExitFiberFuncPtr getExitFiberFunc(); }} #endif
// RUN: %clang_cc1 -emit-llvm -O1 -o - %s | grep icmp // PR1678 extern void B (void); static __typeof(B) A __attribute__ ((__weakref__("B"))); int active (void) { static void *const p = __extension__ (void *) &A; return p != 0; }
// PR c++/79488 // { dg-do compile { target c++11 } } int f(); static int g __attribute__((__weakref__("f"))); template <typename Fn> struct res { static Fn val(); using type = decltype(val()()); // { dg-error "no match for call" } }; template <typename Fn> struct A { template <typename T> void set_result(T) {} virtual void run() { auto boundfn = []() -> typename res<Fn>::type{}; set_result(boundfn); } }; struct F { void operator()() &; }; A<F> t;
#include <folly/fibers/Fiber.h> #include <folly/fibers/LoopController.h> #include <folly/SingletonThreadLocal.h> #include <folly/portability/SysSyscall.h> #include <folly/portability/Unistd.h> #ifdef FOLLY_SANITIZE_ADDRESS #include <dlfcn.h> static void __sanitizer_start_switch_fiber_weak( void** fake_stack_save, void const* fiber_stack_base, size_t fiber_stack_extent) __attribute__((__weakref__("__sanitizer_start_switch_fiber"))); static void __sanitizer_finish_switch_fiber_weak( void* fake_stack_save, void const** old_stack_base, size_t* old_stack_extent) __attribute__((__weakref__("__sanitizer_finish_switch_fiber"))); static void __asan_unpoison_memory_region_weak( void const /* nolint */ volatile* addr, size_t size) __attribute__((__weakref__("__asan_unpoison_memory_region"))); typedef void (*AsanStartSwitchStackFuncPtr)(void**, void const*, size_t); typedef void (*AsanFinishSwitchStackFuncPtr)(void*, void const**, size_t*); typedef void (*AsanUnpoisonMemoryRegionFuncPtr)( void const /* nolint */ volatile*, size_t);