shared: add helper function to add and check for overflow

Use _builtin_uaddll_overflow/_builtin_uaddl_overflow when available,
abstracting the type to use it with uint64_t.

Otherwise fallback to the implementation as added in 67466f2 ("Prevent
offset + size overflow.").

This also adds the tests for this new helper in the testsuite.
diff --git a/m4/attributes.m4 b/m4/attributes.m4
index 7922746..985a3ed 100644
--- a/m4/attributes.m4
+++ b/m4/attributes.m4
@@ -262,6 +262,8 @@
        m4_case([$1],
          [__builtin_clz], [$1(0)],
          [__builtin_types_compatible_p], [$1(int, int)],
+         [__builtin_uaddl_overflow], [$1(0UL, 0UL, (void*)0)],
+         [__builtin_uaddll_overflow], [$1(0ULL, 0ULL, (void*)0)],
          [__builtin_expect], [$1(0, 0)]
        )])],
        [cc_cv_have_$1=yes],