[llvm-branch-commits] [libc] a0b65a7 - [libc] Switch to use a macro which does not insert a section for every libc function.

Michael Jones via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jan 8 15:58:49 PST 2021


Author: Michael Jones
Date: 2021-01-08T23:52:35Z
New Revision: a0b65a7bcd6065688189b3d678c42ed6af9603db

URL: https://github.com/llvm/llvm-project/commit/a0b65a7bcd6065688189b3d678c42ed6af9603db
DIFF: https://github.com/llvm/llvm-project/commit/a0b65a7bcd6065688189b3d678c42ed6af9603db.diff

LOG: [libc] Switch to use a macro which does not insert a section for every libc function.

Summary:
The new macro also inserts the C alias for the C++ implementations
without needing an objcopy based post processing step. The CMake
rules have been updated to reflect this. More CMake cleanup can be
taken up in future rounds and appropriate TODOs have been added for them.

Reviewers: mcgrathr, sivachandra

Subscribers:

Added: 
    

Modified: 
    libc/cmake/modules/LLVMLibCObjectRules.cmake
    libc/src/__support/common.h.def
    libc/src/assert/__assert_fail.cpp
    libc/src/ctype/isalnum.cpp
    libc/src/ctype/isalpha.cpp
    libc/src/ctype/isblank.cpp
    libc/src/ctype/iscntrl.cpp
    libc/src/ctype/isdigit.cpp
    libc/src/ctype/isgraph.cpp
    libc/src/ctype/islower.cpp
    libc/src/ctype/isprint.cpp
    libc/src/ctype/ispunct.cpp
    libc/src/ctype/isspace.cpp
    libc/src/ctype/isupper.cpp
    libc/src/ctype/isxdigit.cpp
    libc/src/ctype/tolower.cpp
    libc/src/ctype/toupper.cpp
    libc/src/errno/__errno_location.cpp
    libc/src/fenv/feclearexcept.cpp
    libc/src/fenv/fegetround.cpp
    libc/src/fenv/feraiseexcept.cpp
    libc/src/fenv/fesetround.cpp
    libc/src/fenv/fetestexcept.cpp
    libc/src/math/ceil.cpp
    libc/src/math/ceilf.cpp
    libc/src/math/ceill.cpp
    libc/src/math/copysign.cpp
    libc/src/math/copysignf.cpp
    libc/src/math/copysignl.cpp
    libc/src/math/cosf.cpp
    libc/src/math/exp2f.cpp
    libc/src/math/expf.cpp
    libc/src/math/fabs.cpp
    libc/src/math/fabsf.cpp
    libc/src/math/fabsl.cpp
    libc/src/math/fdim.cpp
    libc/src/math/fdimf.cpp
    libc/src/math/fdiml.cpp
    libc/src/math/floor.cpp
    libc/src/math/floorf.cpp
    libc/src/math/floorl.cpp
    libc/src/math/fmaf.cpp
    libc/src/math/fmax.cpp
    libc/src/math/fmaxf.cpp
    libc/src/math/fmaxl.cpp
    libc/src/math/fmin.cpp
    libc/src/math/fminf.cpp
    libc/src/math/fminl.cpp
    libc/src/math/frexp.cpp
    libc/src/math/frexpf.cpp
    libc/src/math/frexpl.cpp
    libc/src/math/hypot.cpp
    libc/src/math/hypotf.cpp
    libc/src/math/ilogb.cpp
    libc/src/math/ilogbf.cpp
    libc/src/math/ilogbl.cpp
    libc/src/math/ldexp.cpp
    libc/src/math/ldexpf.cpp
    libc/src/math/ldexpl.cpp
    libc/src/math/llrint.cpp
    libc/src/math/llrintf.cpp
    libc/src/math/llrintl.cpp
    libc/src/math/llround.cpp
    libc/src/math/llroundf.cpp
    libc/src/math/llroundl.cpp
    libc/src/math/logb.cpp
    libc/src/math/logbf.cpp
    libc/src/math/logbl.cpp
    libc/src/math/lrint.cpp
    libc/src/math/lrintf.cpp
    libc/src/math/lrintl.cpp
    libc/src/math/lround.cpp
    libc/src/math/lroundf.cpp
    libc/src/math/lroundl.cpp
    libc/src/math/modf.cpp
    libc/src/math/modff.cpp
    libc/src/math/modfl.cpp
    libc/src/math/nearbyint.cpp
    libc/src/math/nearbyintf.cpp
    libc/src/math/nearbyintl.cpp
    libc/src/math/nextafter.cpp
    libc/src/math/nextafterf.cpp
    libc/src/math/nextafterl.cpp
    libc/src/math/remainder.cpp
    libc/src/math/remainderf.cpp
    libc/src/math/remainderl.cpp
    libc/src/math/remquo.cpp
    libc/src/math/remquof.cpp
    libc/src/math/remquol.cpp
    libc/src/math/rint.cpp
    libc/src/math/rintf.cpp
    libc/src/math/rintl.cpp
    libc/src/math/round.cpp
    libc/src/math/roundf.cpp
    libc/src/math/roundl.cpp
    libc/src/math/sincosf.cpp
    libc/src/math/sinf.cpp
    libc/src/math/sqrt.cpp
    libc/src/math/sqrtf.cpp
    libc/src/math/sqrtl.cpp
    libc/src/math/trunc.cpp
    libc/src/math/truncf.cpp
    libc/src/math/truncl.cpp
    libc/src/signal/linux/raise.cpp
    libc/src/signal/linux/sigaction.cpp
    libc/src/signal/linux/sigaddset.cpp
    libc/src/signal/linux/sigdelset.cpp
    libc/src/signal/linux/sigemptyset.cpp
    libc/src/signal/linux/sigfillset.cpp
    libc/src/signal/linux/signal.cpp
    libc/src/signal/linux/sigprocmask.cpp
    libc/src/stdlib/abort.cpp
    libc/src/stdlib/abs.cpp
    libc/src/stdlib/labs.cpp
    libc/src/stdlib/linux/_Exit.cpp
    libc/src/stdlib/llabs.cpp
    libc/src/string/bzero.cpp
    libc/src/string/memchr.cpp
    libc/src/string/memcmp.cpp
    libc/src/string/memcpy.cpp
    libc/src/string/memrchr.cpp
    libc/src/string/memset.cpp
    libc/src/string/strcat.cpp
    libc/src/string/strchr.cpp
    libc/src/string/strcmp.cpp
    libc/src/string/strcpy.cpp
    libc/src/string/strcspn.cpp
    libc/src/string/strlen.cpp
    libc/src/string/strncpy.cpp
    libc/src/string/strnlen.cpp
    libc/src/string/strpbrk.cpp
    libc/src/string/strrchr.cpp
    libc/src/string/strspn.cpp
    libc/src/string/strstr.cpp
    libc/src/string/strtok.cpp
    libc/src/string/strtok_r.cpp
    libc/src/string/x86/memcpy.cpp
    libc/src/sys/mman/linux/mmap.cpp
    libc/src/sys/mman/linux/munmap.cpp
    libc/src/threads/linux/call_once.cpp
    libc/src/threads/linux/mtx_init.cpp
    libc/src/threads/linux/mtx_lock.cpp
    libc/src/threads/linux/mtx_unlock.cpp
    libc/src/threads/linux/thrd_create.cpp
    libc/src/threads/linux/thrd_join.cpp
    libc/src/time/mktime.cpp
    libc/src/unistd/linux/write.cpp

Removed: 
    


################################################################################
diff  --git a/libc/cmake/modules/LLVMLibCObjectRules.cmake b/libc/cmake/modules/LLVMLibCObjectRules.cmake
index 32900d825531..93f772d93bb2 100644
--- a/libc/cmake/modules/LLVMLibCObjectRules.cmake
+++ b/libc/cmake/modules/LLVMLibCObjectRules.cmake
@@ -147,10 +147,26 @@ function(add_entrypoint_object target_name)
     message(FATAL_ERROR "`add_entrypoint_object` rule requires HDRS to be specified.")
   endif()
 
-  set(objects_target_name "${fq_target_name}_objects")
+  set(common_compile_options -fpie ${LLVM_CXX_STD_default} -ffreestanding ${ADD_ENTRYPOINT_OBJ_COMPILE_OPTIONS})
+  set(internal_target_name ${fq_target_name}.__internal__)
+  set(include_dirs ${LIBC_BUILD_DIR}/include ${LIBC_SOURCE_DIR} ${LIBC_BUILD_DIR})
+  get_fq_deps_list(fq_deps_list ${ADD_ENTRYPOINT_OBJ_DEPENDS})
+  set(full_deps_list ${fq_deps_list} libc.src.__support.common)
+
+  add_library(
+    ${internal_target_name}
+    # TODO: We don't need an object library for internal consumption.
+    # A future change should switch this to a normal static library.
+    OBJECT
+    ${ADD_ENTRYPOINT_OBJ_SRCS}
+    ${ADD_ENTRYPOINT_OBJ_HDRS}
+  )
+  target_compile_options(${internal_target_name} BEFORE PRIVATE ${common_compile_options})
+  target_include_directories(${internal_target_name} PRIVATE ${include_dirs})
+  add_dependencies(${internal_target_name} ${full_deps_list})
 
   add_library(
-    ${objects_target_name}
+    ${fq_target_name}
     # We want an object library as the objects will eventually get packaged into
     # an archive (like libc.a).
     OBJECT
@@ -158,68 +174,20 @@ function(add_entrypoint_object target_name)
     ${ADD_ENTRYPOINT_OBJ_HDRS}
   )
   target_compile_options(
-    ${objects_target_name}
-    BEFORE
-    PRIVATE
-      -fpie ${LLVM_CXX_STD_default} -ffreestanding
-  )
-  target_include_directories(
-    ${objects_target_name}
-    PRIVATE
-      ${LIBC_BUILD_DIR}/include
-      ${LIBC_SOURCE_DIR}
-      ${LIBC_BUILD_DIR}
+      ${fq_target_name} BEFORE PRIVATE ${common_compile_options} -DLLVM_LIBC_PUBLIC_PACKAGING
   )
-  get_fq_deps_list(fq_deps_list ${ADD_ENTRYPOINT_OBJ_DEPENDS})
-  add_dependencies(
-    ${objects_target_name}
-    libc.src.__support.common
-    ${fq_deps_list}
-  )
-
-  if(ADD_ENTRYPOINT_OBJ_COMPILE_OPTIONS)
-    target_compile_options(
-      ${objects_target_name}
-      PRIVATE ${ADD_ENTRYPOINT_OBJ_COMPILE_OPTIONS}
-    )
-  endif()
+  target_include_directories(${fq_target_name} PRIVATE ${include_dirs})
+  add_dependencies(${fq_target_name} ${full_deps_list})
 
-  set(object_file_raw "${CMAKE_CURRENT_BINARY_DIR}/${target_name}_raw.o")
-  set(object_file "${CMAKE_CURRENT_BINARY_DIR}/${target_name}.o")
-
-  set(input_objects $<TARGET_OBJECTS:${objects_target_name}>)
-  add_custom_command(
-    OUTPUT ${object_file_raw}
-    DEPENDS ${input_objects}
-    COMMAND ${CMAKE_LINKER} -r ${input_objects} -o ${object_file_raw}
-  )
-
-  set(alias_attributes "0,function,global")
-  if(ADD_ENTRYPOINT_OBJ_REDIRECTED)
-    set(alias_attributes "${alias_attributes},hidden")
-  endif()
-
-  add_custom_command(
-    OUTPUT ${object_file}
-    # We llvm-objcopy here as GNU-binutils objcopy does not support the 'hidden' flag.
-    DEPENDS ${object_file_raw} ${llvm-objcopy}
-    COMMAND $<TARGET_FILE:llvm-objcopy> --add-symbol
-            "${entrypoint_name}=.llvm.libc.entrypoint.${entrypoint_name}:${alias_attributes}"
-            ${object_file_raw} ${object_file}
-  )
-
-  add_custom_target(
-    ${fq_target_name}
-    ALL
-    DEPENDS ${object_file}
-  )
   set_target_properties(
     ${fq_target_name}
     PROPERTIES
       "ENTRYPOINT_NAME" ${entrypoint_name}
       "TARGET_TYPE" ${ENTRYPOINT_OBJ_TARGET_TYPE}
-      "OBJECT_FILE" "${object_file}"
-      "OBJECT_FILE_RAW" "${object_file_raw}"
+      "OBJECT_FILE" $<TARGET_OBJECTS:${fq_target_name}>
+      # TODO: We don't need to list internal object files if the internal
+      # target is a normal static library.
+      "OBJECT_FILE_RAW" $<TARGET_OBJECTS:${internal_target_name}>
       "DEPS" "${fq_deps_list}"
   )
 
@@ -273,7 +241,7 @@ function(add_entrypoint_object target_name)
       # crossplatform touch.
       COMMAND "${CMAKE_COMMAND}" -E touch ${lint_timestamp}
       COMMENT "Linting... ${target_name}"
-      DEPENDS clang-tidy ${objects_target_name} ${ADD_ENTRYPOINT_OBJ_SRCS}
+      DEPENDS clang-tidy ${internal_target_name} ${ADD_ENTRYPOINT_OBJ_SRCS}
       WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
     )
 

diff  --git a/libc/src/__support/common.h.def b/libc/src/__support/common.h.def
index a1bb78d5b00f..48c63de08718 100644
--- a/libc/src/__support/common.h.def
+++ b/libc/src/__support/common.h.def
@@ -15,8 +15,19 @@
 #define unlikely(x) __builtin_expect (x, 0)
 #define UNUSED __attribute__((unused))
 
-<!> Include the platform specific definitions at build time. For example, that
-<!> of entrypoint macro.
-%%include_file(${platform_defs})
+#ifndef LLVM_LIBC_FUNCTION_ATTR
+  #define LLVM_LIBC_FUNCTION_ATTR
+#endif
+
+#ifdef LLVM_LIBC_PUBLIC_PACKAGING
+#define LLVM_LIBC_FUNCTION(type, name, arglist) \
+  type name arglist; \
+  LLVM_LIBC_FUNCTION_ATTR decltype(__llvm_libc::name) __##name##_impl__ __asm__(#name); \
+  decltype(__llvm_libc::name) name [[gnu::alias(#name)]]; \
+  type __##name##_impl__ arglist                                        
+#else
+#define LLVM_LIBC_FUNCTION(type, name, arglist)\
+  type name arglist
+#endif
 
 #endif // LLVM_LIBC_SUPPORT_COMMON_H

diff  --git a/libc/src/assert/__assert_fail.cpp b/libc/src/assert/__assert_fail.cpp
index 114a368da033..614e13027633 100644
--- a/libc/src/assert/__assert_fail.cpp
+++ b/libc/src/assert/__assert_fail.cpp
@@ -24,8 +24,9 @@ static void writeToStderr(const char *s) {
   __llvm_libc::syscall(SYS_write, 2, s, length);
 }
 
-void LLVM_LIBC_ENTRYPOINT(__assert_fail)(const char *assertion, const char *file,
-                                         unsigned line, const char *function) {
+LLVM_LIBC_FUNCTION(void, __assert_fail,
+                   (const char *assertion, const char *file, unsigned line,
+                    const char *function)) {
   writeToStderr(file);
   writeToStderr(": Assertion failed: '");
   writeToStderr(assertion);

diff  --git a/libc/src/ctype/isalnum.cpp b/libc/src/ctype/isalnum.cpp
index 54c4f8098419..3e8da722c674 100644
--- a/libc/src/ctype/isalnum.cpp
+++ b/libc/src/ctype/isalnum.cpp
@@ -15,6 +15,6 @@ namespace __llvm_libc {
 
 // TODO: Currently restricted to default locale.
 // These should be extended using locale information.
-int LLVM_LIBC_ENTRYPOINT(isalnum)(int c) { return internal::isalnum(c); }
+LLVM_LIBC_FUNCTION(int, isalnum, (int c)) { return internal::isalnum(c); }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/ctype/isalpha.cpp b/libc/src/ctype/isalpha.cpp
index 4b3725477a7d..cecf1b516939 100644
--- a/libc/src/ctype/isalpha.cpp
+++ b/libc/src/ctype/isalpha.cpp
@@ -15,6 +15,6 @@ namespace __llvm_libc {
 
 // TODO: Currently restricted to default locale.
 // These should be extended using locale information.
-int LLVM_LIBC_ENTRYPOINT(isalpha)(int c) { return internal::isalpha(c); }
+LLVM_LIBC_FUNCTION(int, isalpha, (int c)) { return internal::isalpha(c); }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/ctype/isblank.cpp b/libc/src/ctype/isblank.cpp
index fa28d84c03bd..b29d19aef2f1 100644
--- a/libc/src/ctype/isblank.cpp
+++ b/libc/src/ctype/isblank.cpp
@@ -14,7 +14,7 @@ namespace __llvm_libc {
 
 // TODO: Currently restricted to default locale.
 // These should be extended using locale information.
-int LLVM_LIBC_ENTRYPOINT(isblank)(int c) {
+LLVM_LIBC_FUNCTION(int, isblank, (int c)) {
   const unsigned char ch = c;
   return ch == ' ' || ch == '\t';
 }

diff  --git a/libc/src/ctype/iscntrl.cpp b/libc/src/ctype/iscntrl.cpp
index 06ee7cc0d970..8962bcae0a84 100644
--- a/libc/src/ctype/iscntrl.cpp
+++ b/libc/src/ctype/iscntrl.cpp
@@ -14,7 +14,7 @@ namespace __llvm_libc {
 
 // TODO: Currently restricted to default locale.
 // These should be extended using locale information.
-int LLVM_LIBC_ENTRYPOINT(iscntrl)(int c) {
+LLVM_LIBC_FUNCTION(int, iscntrl, (int c)) {
   const unsigned char ch = c;
   return ch < 0x20 || ch == 0x7f;
 }

diff  --git a/libc/src/ctype/isdigit.cpp b/libc/src/ctype/isdigit.cpp
index 94ec42a0a3d8..8471e4b5569a 100644
--- a/libc/src/ctype/isdigit.cpp
+++ b/libc/src/ctype/isdigit.cpp
@@ -14,6 +14,6 @@ namespace __llvm_libc {
 
 // TODO: Currently restricted to default locale.
 // These should be extended using locale information.
-int LLVM_LIBC_ENTRYPOINT(isdigit)(int c) { return internal::isdigit(c); }
+LLVM_LIBC_FUNCTION(int, isdigit, (int c)) { return internal::isdigit(c); }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/ctype/isgraph.cpp b/libc/src/ctype/isgraph.cpp
index c7a488cbfdea..2bb6a57da407 100644
--- a/libc/src/ctype/isgraph.cpp
+++ b/libc/src/ctype/isgraph.cpp
@@ -15,6 +15,6 @@ namespace __llvm_libc {
 
 // TODO: Currently restricted to default locale.
 // These should be extended using locale information.
-int LLVM_LIBC_ENTRYPOINT(isgraph)(int c) { return internal::isgraph(c); }
+LLVM_LIBC_FUNCTION(int, isgraph, (int c)) { return internal::isgraph(c); }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/ctype/islower.cpp b/libc/src/ctype/islower.cpp
index ae1291b5eda4..907a32217496 100644
--- a/libc/src/ctype/islower.cpp
+++ b/libc/src/ctype/islower.cpp
@@ -15,6 +15,6 @@ namespace __llvm_libc {
 
 // TODO: Currently restricted to default locale.
 // These should be extended using locale information.
-int LLVM_LIBC_ENTRYPOINT(islower)(int c) { return internal::islower(c); }
+LLVM_LIBC_FUNCTION(int, islower, (int c)) { return internal::islower(c); }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/ctype/isprint.cpp b/libc/src/ctype/isprint.cpp
index 6d0ebbb2b95c..a80500b133c4 100644
--- a/libc/src/ctype/isprint.cpp
+++ b/libc/src/ctype/isprint.cpp
@@ -14,7 +14,7 @@ namespace __llvm_libc {
 
 // TODO: Currently restricted to default locale.
 // These should be extended using locale information.
-int LLVM_LIBC_ENTRYPOINT(isprint)(int c) {
+LLVM_LIBC_FUNCTION(int, isprint, (int c)) {
   const unsigned ch = c;
   return (ch - ' ') < 95;
 }

diff  --git a/libc/src/ctype/ispunct.cpp b/libc/src/ctype/ispunct.cpp
index a810c6471e79..064b7b07c6e6 100644
--- a/libc/src/ctype/ispunct.cpp
+++ b/libc/src/ctype/ispunct.cpp
@@ -15,7 +15,7 @@ namespace __llvm_libc {
 
 // TODO: Currently restricted to default locale.
 // These should be extended using locale information.
-int LLVM_LIBC_ENTRYPOINT(ispunct)(int c) {
+LLVM_LIBC_FUNCTION(int, ispunct, (int c)) {
   return !internal::isalnum(c) && internal::isgraph(c);
 }
 

diff  --git a/libc/src/ctype/isspace.cpp b/libc/src/ctype/isspace.cpp
index ed6e1610bd63..4a269ef29bf2 100644
--- a/libc/src/ctype/isspace.cpp
+++ b/libc/src/ctype/isspace.cpp
@@ -14,7 +14,7 @@ namespace __llvm_libc {
 
 // TODO: Currently restricted to default locale.
 // These should be extended using locale information.
-int LLVM_LIBC_ENTRYPOINT(isspace)(int c) {
+LLVM_LIBC_FUNCTION(int, isspace, (int c)) {
   const unsigned ch = c;
   return ch == ' ' || (ch - '\t') < 5;
 }

diff  --git a/libc/src/ctype/isupper.cpp b/libc/src/ctype/isupper.cpp
index 9b0e5232f1f9..f1c56fc942f6 100644
--- a/libc/src/ctype/isupper.cpp
+++ b/libc/src/ctype/isupper.cpp
@@ -15,6 +15,6 @@ namespace __llvm_libc {
 
 // TODO: Currently restricted to default locale.
 // These should be extended using locale information.
-int LLVM_LIBC_ENTRYPOINT(isupper)(int c) { return internal::isupper(c); }
+LLVM_LIBC_FUNCTION(int, isupper, (int c)) { return internal::isupper(c); }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/ctype/isxdigit.cpp b/libc/src/ctype/isxdigit.cpp
index 497cf469a360..5ee1b1090b77 100644
--- a/libc/src/ctype/isxdigit.cpp
+++ b/libc/src/ctype/isxdigit.cpp
@@ -15,7 +15,7 @@ namespace __llvm_libc {
 
 // TODO: Currently restricted to default locale.
 // These should be extended using locale information.
-int LLVM_LIBC_ENTRYPOINT(isxdigit)(int c) {
+LLVM_LIBC_FUNCTION(int, isxdigit, (int c)) {
   const unsigned ch = c;
   return internal::isdigit(ch) || (ch | 32) - 'a' < 6;
 }

diff  --git a/libc/src/ctype/tolower.cpp b/libc/src/ctype/tolower.cpp
index 6fd300680179..c01f4f0ded81 100644
--- a/libc/src/ctype/tolower.cpp
+++ b/libc/src/ctype/tolower.cpp
@@ -15,7 +15,7 @@ namespace __llvm_libc {
 
 // TODO: Currently restricted to default locale.
 // These should be extended using locale information.
-int LLVM_LIBC_ENTRYPOINT(tolower)(int c) {
+LLVM_LIBC_FUNCTION(int, tolower, (int c)) {
   if (internal::isupper(c))
     return c + 'a' - 'A';
   return c;

diff  --git a/libc/src/ctype/toupper.cpp b/libc/src/ctype/toupper.cpp
index 8d591c20be67..254befc38f30 100644
--- a/libc/src/ctype/toupper.cpp
+++ b/libc/src/ctype/toupper.cpp
@@ -15,7 +15,7 @@ namespace __llvm_libc {
 
 // TODO: Currently restricted to default locale.
 // These should be extended using locale information.
-int LLVM_LIBC_ENTRYPOINT(toupper)(int c) {
+LLVM_LIBC_FUNCTION(int, toupper, (int c)) {
   if (internal::islower(c))
     return c + 'A' - 'a';
   return c;

diff  --git a/libc/src/errno/__errno_location.cpp b/libc/src/errno/__errno_location.cpp
index 3e7c769483b0..54c5acb08448 100644
--- a/libc/src/errno/__errno_location.cpp
+++ b/libc/src/errno/__errno_location.cpp
@@ -17,6 +17,6 @@ static thread_local int __errno = 0;
 // __errno_location is not really an entry point but we still want it to behave
 // like an entry point because the errno macro resolves to the C symbol
 // "__errno_location".
-int *LLVM_LIBC_ENTRYPOINT(__errno_location)() { return &__errno; }
+LLVM_LIBC_FUNCTION(int *, __errno_location, ()) { return &__errno; }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/fenv/feclearexcept.cpp b/libc/src/fenv/feclearexcept.cpp
index c407ac48220a..be180f6decb9 100644
--- a/libc/src/fenv/feclearexcept.cpp
+++ b/libc/src/fenv/feclearexcept.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-int LLVM_LIBC_ENTRYPOINT(feclearexcept)(int e) {
+LLVM_LIBC_FUNCTION(int, feclearexcept, (int e)) {
   return fputil::clearExcept(e);
 }
 

diff  --git a/libc/src/fenv/fegetround.cpp b/libc/src/fenv/fegetround.cpp
index 0eb92243a15e..669b861c7db4 100644
--- a/libc/src/fenv/fegetround.cpp
+++ b/libc/src/fenv/fegetround.cpp
@@ -11,6 +11,6 @@
 
 namespace __llvm_libc {
 
-int LLVM_LIBC_ENTRYPOINT(fegetround)() { return fputil::getRound(); }
+LLVM_LIBC_FUNCTION(int, fegetround, ()) { return fputil::getRound(); }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/fenv/feraiseexcept.cpp b/libc/src/fenv/feraiseexcept.cpp
index a9e93e6a2ec4..cc3f11ad0fda 100644
--- a/libc/src/fenv/feraiseexcept.cpp
+++ b/libc/src/fenv/feraiseexcept.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-int LLVM_LIBC_ENTRYPOINT(feraiseexcept)(int e) {
+LLVM_LIBC_FUNCTION(int, feraiseexcept, (int e)) {
   return fputil::raiseExcept(e);
 }
 

diff  --git a/libc/src/fenv/fesetround.cpp b/libc/src/fenv/fesetround.cpp
index 3f6077d977d3..50e726f924b4 100644
--- a/libc/src/fenv/fesetround.cpp
+++ b/libc/src/fenv/fesetround.cpp
@@ -11,6 +11,6 @@
 
 namespace __llvm_libc {
 
-int LLVM_LIBC_ENTRYPOINT(fesetround)(int m) { return fputil::setRound(m); }
+LLVM_LIBC_FUNCTION(int, fesetround, (int m)) { return fputil::setRound(m); }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/fenv/fetestexcept.cpp b/libc/src/fenv/fetestexcept.cpp
index 38ec17b016f0..d4f5e1e96807 100644
--- a/libc/src/fenv/fetestexcept.cpp
+++ b/libc/src/fenv/fetestexcept.cpp
@@ -11,6 +11,6 @@
 
 namespace __llvm_libc {
 
-int LLVM_LIBC_ENTRYPOINT(fetestexcept)(int e) { return fputil::testExcept(e); }
+LLVM_LIBC_FUNCTION(int, fetestexcept, (int e)) { return fputil::testExcept(e); }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/math/ceil.cpp b/libc/src/math/ceil.cpp
index 06ef903655a8..7d603e7b4922 100644
--- a/libc/src/math/ceil.cpp
+++ b/libc/src/math/ceil.cpp
@@ -11,6 +11,6 @@
 
 namespace __llvm_libc {
 
-double LLVM_LIBC_ENTRYPOINT(ceil)(double x) { return fputil::ceil(x); }
+LLVM_LIBC_FUNCTION(double, ceil, (double x)) { return fputil::ceil(x); }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/math/ceilf.cpp b/libc/src/math/ceilf.cpp
index d44e27336439..361f50755962 100644
--- a/libc/src/math/ceilf.cpp
+++ b/libc/src/math/ceilf.cpp
@@ -11,6 +11,6 @@
 
 namespace __llvm_libc {
 
-float LLVM_LIBC_ENTRYPOINT(ceilf)(float x) { return fputil::ceil(x); }
+LLVM_LIBC_FUNCTION(float, ceilf, (float x)) { return fputil::ceil(x); }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/math/ceill.cpp b/libc/src/math/ceill.cpp
index 8ac806d730c4..525e40b2ae25 100644
--- a/libc/src/math/ceill.cpp
+++ b/libc/src/math/ceill.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long double LLVM_LIBC_ENTRYPOINT(ceill)(long double x) {
+LLVM_LIBC_FUNCTION(long double, ceill, (long double x)) {
   return fputil::ceil(x);
 }
 

diff  --git a/libc/src/math/copysign.cpp b/libc/src/math/copysign.cpp
index 5eee71f98123..5d7af2528b05 100644
--- a/libc/src/math/copysign.cpp
+++ b/libc/src/math/copysign.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-double LLVM_LIBC_ENTRYPOINT(copysign)(double x, double y) {
+LLVM_LIBC_FUNCTION(double, copysign, (double x, double y)) {
   return fputil::copysign(x, y);
 }
 

diff  --git a/libc/src/math/copysignf.cpp b/libc/src/math/copysignf.cpp
index c730dd37b7ae..beec120d54ab 100644
--- a/libc/src/math/copysignf.cpp
+++ b/libc/src/math/copysignf.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-float LLVM_LIBC_ENTRYPOINT(copysignf)(float x, float y) {
+LLVM_LIBC_FUNCTION(float, copysignf, (float x, float y)) {
   return fputil::copysign(x, y);
 }
 

diff  --git a/libc/src/math/copysignl.cpp b/libc/src/math/copysignl.cpp
index b165b8f29091..c00b7a70646f 100644
--- a/libc/src/math/copysignl.cpp
+++ b/libc/src/math/copysignl.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long double LLVM_LIBC_ENTRYPOINT(copysignl)(long double x, long double y) {
+LLVM_LIBC_FUNCTION(long double, copysignl, (long double x, long double y)) {
   return fputil::copysign(x, y);
 }
 

diff  --git a/libc/src/math/cosf.cpp b/libc/src/math/cosf.cpp
index 762e931870a5..ad0dfedd99fb 100644
--- a/libc/src/math/cosf.cpp
+++ b/libc/src/math/cosf.cpp
@@ -20,7 +20,7 @@ namespace __llvm_libc {
 // error is 0.5303 * 2^-23. A single-step range reduction is used for
 // small values. Large inputs have their range reduced using fast integer
 // arithmetic.
-float LLVM_LIBC_ENTRYPOINT(cosf)(float y) {
+LLVM_LIBC_FUNCTION(float, cosf, (float y)) {
   double x = y;
   double s;
   int n;

diff  --git a/libc/src/math/exp2f.cpp b/libc/src/math/exp2f.cpp
index 38db872f652e..012cb82b344f 100644
--- a/libc/src/math/exp2f.cpp
+++ b/libc/src/math/exp2f.cpp
@@ -20,7 +20,7 @@
 
 namespace __llvm_libc {
 
-float LLVM_LIBC_ENTRYPOINT(exp2f)(float x) {
+LLVM_LIBC_FUNCTION(float, exp2f, (float x)) {
   uint32_t abstop;
   uint64_t ki, t;
   // double_t for better performance on targets with FLT_EVAL_METHOD==2.

diff  --git a/libc/src/math/expf.cpp b/libc/src/math/expf.cpp
index 61c861366ccc..df10e4e1ed16 100644
--- a/libc/src/math/expf.cpp
+++ b/libc/src/math/expf.cpp
@@ -21,7 +21,7 @@
 
 namespace __llvm_libc {
 
-float LLVM_LIBC_ENTRYPOINT(expf)(float x) {
+LLVM_LIBC_FUNCTION(float, expf, (float x)) {
   uint32_t abstop;
   uint64_t ki, t;
   // double_t for better performance on targets with FLT_EVAL_METHOD == 2.

diff  --git a/libc/src/math/fabs.cpp b/libc/src/math/fabs.cpp
index ff78f1b16872..7069e1dd0788 100644
--- a/libc/src/math/fabs.cpp
+++ b/libc/src/math/fabs.cpp
@@ -11,6 +11,6 @@
 
 namespace __llvm_libc {
 
-double LLVM_LIBC_ENTRYPOINT(fabs)(double x) { return fputil::abs(x); }
+LLVM_LIBC_FUNCTION(double, fabs, (double x)) { return fputil::abs(x); }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/math/fabsf.cpp b/libc/src/math/fabsf.cpp
index 9aa1419f0aaf..6ed9ef7aa431 100644
--- a/libc/src/math/fabsf.cpp
+++ b/libc/src/math/fabsf.cpp
@@ -11,6 +11,6 @@
 
 namespace __llvm_libc {
 
-float LLVM_LIBC_ENTRYPOINT(fabsf)(float x) { return fputil::abs(x); }
+LLVM_LIBC_FUNCTION(float, fabsf, (float x)) { return fputil::abs(x); }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/math/fabsl.cpp b/libc/src/math/fabsl.cpp
index 6e8f72873a25..3a3645990642 100644
--- a/libc/src/math/fabsl.cpp
+++ b/libc/src/math/fabsl.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long double LLVM_LIBC_ENTRYPOINT(fabsl)(long double x) {
+LLVM_LIBC_FUNCTION(long double, fabsl, (long double x)) {
   return fputil::abs(x);
 }
 

diff  --git a/libc/src/math/fdim.cpp b/libc/src/math/fdim.cpp
index 23b475c94b91..ebc998e75d0a 100644
--- a/libc/src/math/fdim.cpp
+++ b/libc/src/math/fdim.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-double LLVM_LIBC_ENTRYPOINT(fdim)(double x, double y) {
+LLVM_LIBC_FUNCTION(double, fdim, (double x, double y)) {
   return fputil::fdim(x, y);
 }
 

diff  --git a/libc/src/math/fdimf.cpp b/libc/src/math/fdimf.cpp
index 84f307b917a3..d922bb9cfce9 100644
--- a/libc/src/math/fdimf.cpp
+++ b/libc/src/math/fdimf.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-float LLVM_LIBC_ENTRYPOINT(fdimf)(float x, float y) {
+LLVM_LIBC_FUNCTION(float, fdimf, (float x, float y)) {
   return fputil::fdim(x, y);
 }
 

diff  --git a/libc/src/math/fdiml.cpp b/libc/src/math/fdiml.cpp
index 60c0a74984d4..5149484073fa 100644
--- a/libc/src/math/fdiml.cpp
+++ b/libc/src/math/fdiml.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long double LLVM_LIBC_ENTRYPOINT(fdiml)(long double x, long double y) {
+LLVM_LIBC_FUNCTION(long double, fdiml, (long double x, long double y)) {
   return fputil::fdim(x, y);
 }
 

diff  --git a/libc/src/math/floor.cpp b/libc/src/math/floor.cpp
index cc2fde50e816..a7a7d784ab7c 100644
--- a/libc/src/math/floor.cpp
+++ b/libc/src/math/floor.cpp
@@ -11,6 +11,6 @@
 
 namespace __llvm_libc {
 
-double LLVM_LIBC_ENTRYPOINT(floor)(double x) { return fputil::floor(x); }
+LLVM_LIBC_FUNCTION(double, floor, (double x)) { return fputil::floor(x); }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/math/floorf.cpp b/libc/src/math/floorf.cpp
index e220ab470e3e..da464b6f8bd6 100644
--- a/libc/src/math/floorf.cpp
+++ b/libc/src/math/floorf.cpp
@@ -11,6 +11,6 @@
 
 namespace __llvm_libc {
 
-float LLVM_LIBC_ENTRYPOINT(floorf)(float x) { return fputil::floor(x); }
+LLVM_LIBC_FUNCTION(float, floorf, (float x)) { return fputil::floor(x); }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/math/floorl.cpp b/libc/src/math/floorl.cpp
index 1e7d7b161f20..38d30b8ecacf 100644
--- a/libc/src/math/floorl.cpp
+++ b/libc/src/math/floorl.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long double LLVM_LIBC_ENTRYPOINT(floorl)(long double x) {
+LLVM_LIBC_FUNCTION(long double, floorl, (long double x)) {
   return fputil::floor(x);
 }
 

diff  --git a/libc/src/math/fmaf.cpp b/libc/src/math/fmaf.cpp
index 1860d887d630..6b989c70b8c7 100644
--- a/libc/src/math/fmaf.cpp
+++ b/libc/src/math/fmaf.cpp
@@ -13,7 +13,7 @@
 
 namespace __llvm_libc {
 
-float LLVM_LIBC_ENTRYPOINT(fmaf)(float x, float y, float z) {
+LLVM_LIBC_FUNCTION(float, fmaf, (float x, float y, float z)){
   // Product is exact.
   double prod = static_cast<double>(x) * static_cast<double>(y);
   double z_d = static_cast<double>(z);

diff  --git a/libc/src/math/fmax.cpp b/libc/src/math/fmax.cpp
index ba5d93388998..8090126a62ff 100644
--- a/libc/src/math/fmax.cpp
+++ b/libc/src/math/fmax.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-double LLVM_LIBC_ENTRYPOINT(fmax)(double x, double y) {
+LLVM_LIBC_FUNCTION(double, fmax, (double x, double y)) {
   return fputil::fmax(x, y);
 }
 

diff  --git a/libc/src/math/fmaxf.cpp b/libc/src/math/fmaxf.cpp
index 55629040eba6..c4932c4c444a 100644
--- a/libc/src/math/fmaxf.cpp
+++ b/libc/src/math/fmaxf.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-float LLVM_LIBC_ENTRYPOINT(fmaxf)(float x, float y) {
+LLVM_LIBC_FUNCTION(float, fmaxf, (float x, float y)) {
   return fputil::fmax(x, y);
 }
 

diff  --git a/libc/src/math/fmaxl.cpp b/libc/src/math/fmaxl.cpp
index c944187f26b7..acfa9f2ffd2a 100644
--- a/libc/src/math/fmaxl.cpp
+++ b/libc/src/math/fmaxl.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long double LLVM_LIBC_ENTRYPOINT(fmaxl)(long double x, long double y) {
+LLVM_LIBC_FUNCTION(long double, fmaxl, (long double x, long double y)) {
   return fputil::fmax(x, y);
 }
 

diff  --git a/libc/src/math/fmin.cpp b/libc/src/math/fmin.cpp
index ef5efad59811..f4a005684850 100644
--- a/libc/src/math/fmin.cpp
+++ b/libc/src/math/fmin.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-double LLVM_LIBC_ENTRYPOINT(fmin)(double x, double y) {
+LLVM_LIBC_FUNCTION(double, fmin, (double x, double y)) {
   return fputil::fmin(x, y);
 }
 

diff  --git a/libc/src/math/fminf.cpp b/libc/src/math/fminf.cpp
index 97ad399f4a2b..a5c857975eb6 100644
--- a/libc/src/math/fminf.cpp
+++ b/libc/src/math/fminf.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-float LLVM_LIBC_ENTRYPOINT(fminf)(float x, float y) {
+LLVM_LIBC_FUNCTION(float, fminf, (float x, float y)) {
   return fputil::fmin(x, y);
 }
 

diff  --git a/libc/src/math/fminl.cpp b/libc/src/math/fminl.cpp
index e66f0d72bfc3..9324c14dc864 100644
--- a/libc/src/math/fminl.cpp
+++ b/libc/src/math/fminl.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long double LLVM_LIBC_ENTRYPOINT(fminl)(long double x, long double y) {
+LLVM_LIBC_FUNCTION(long double, fminl, (long double x, long double y)) {
   return fputil::fmin(x, y);
 }
 

diff  --git a/libc/src/math/frexp.cpp b/libc/src/math/frexp.cpp
index 8449929347bb..81d5f9ec3813 100644
--- a/libc/src/math/frexp.cpp
+++ b/libc/src/math/frexp.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-double LLVM_LIBC_ENTRYPOINT(frexp)(double x, int *exp) {
+LLVM_LIBC_FUNCTION(double, frexp, (double x, int *exp)) {
   return fputil::frexp(x, *exp);
 }
 

diff  --git a/libc/src/math/frexpf.cpp b/libc/src/math/frexpf.cpp
index 94dac9f59030..5d9a5b5556ea 100644
--- a/libc/src/math/frexpf.cpp
+++ b/libc/src/math/frexpf.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-float LLVM_LIBC_ENTRYPOINT(frexpf)(float x, int *exp) {
+LLVM_LIBC_FUNCTION(float, frexpf, (float x, int *exp)) {
   return fputil::frexp(x, *exp);
 }
 

diff  --git a/libc/src/math/frexpl.cpp b/libc/src/math/frexpl.cpp
index 939ac71e31d7..ccdc18475159 100644
--- a/libc/src/math/frexpl.cpp
+++ b/libc/src/math/frexpl.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long double LLVM_LIBC_ENTRYPOINT(frexpl)(long double x, int *exp) {
+LLVM_LIBC_FUNCTION(long double, frexpl, (long double x, int *exp)) {
   return fputil::frexp(x, *exp);
 }
 

diff  --git a/libc/src/math/hypot.cpp b/libc/src/math/hypot.cpp
index 9d59365ce3f2..77a83d89ceb3 100644
--- a/libc/src/math/hypot.cpp
+++ b/libc/src/math/hypot.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-double LLVM_LIBC_ENTRYPOINT(hypot)(double x, double y) {
+LLVM_LIBC_FUNCTION(double, hypot, (double x, double y)) {
   return __llvm_libc::fputil::hypot(x, y);
 }
 

diff  --git a/libc/src/math/hypotf.cpp b/libc/src/math/hypotf.cpp
index ebe7e97ee184..eefc47e6cffd 100644
--- a/libc/src/math/hypotf.cpp
+++ b/libc/src/math/hypotf.cpp
@@ -10,7 +10,7 @@
 
 namespace __llvm_libc {
 
-float LLVM_LIBC_ENTRYPOINT(hypotf)(float x, float y) {
+LLVM_LIBC_FUNCTION(float, hypotf, (float x, float y)) {
   return __llvm_libc::fputil::hypot(x, y);
 }
 

diff  --git a/libc/src/math/ilogb.cpp b/libc/src/math/ilogb.cpp
index 001925b0d481..d2d3772db7ce 100644
--- a/libc/src/math/ilogb.cpp
+++ b/libc/src/math/ilogb.cpp
@@ -11,6 +11,6 @@
 
 namespace __llvm_libc {
 
-int LLVM_LIBC_ENTRYPOINT(ilogb)(double x) { return fputil::ilogb(x); }
+LLVM_LIBC_FUNCTION(int, ilogb, (double x)) { return fputil::ilogb(x); }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/math/ilogbf.cpp b/libc/src/math/ilogbf.cpp
index d62b22b5159f..529530d670bc 100644
--- a/libc/src/math/ilogbf.cpp
+++ b/libc/src/math/ilogbf.cpp
@@ -11,6 +11,6 @@
 
 namespace __llvm_libc {
 
-int LLVM_LIBC_ENTRYPOINT(ilogbf)(float x) { return fputil::ilogb(x); }
+LLVM_LIBC_FUNCTION(int, ilogbf, (float x)) { return fputil::ilogb(x); }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/math/ilogbl.cpp b/libc/src/math/ilogbl.cpp
index 0ad791f80dfd..92d9936f9de2 100644
--- a/libc/src/math/ilogbl.cpp
+++ b/libc/src/math/ilogbl.cpp
@@ -11,6 +11,6 @@
 
 namespace __llvm_libc {
 
-int LLVM_LIBC_ENTRYPOINT(ilogbl)(long double x) { return fputil::ilogb(x); }
+LLVM_LIBC_FUNCTION(int, ilogbl, (long double x)) { return fputil::ilogb(x); }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/math/ldexp.cpp b/libc/src/math/ldexp.cpp
index 1eefd1037cde..9d8ffb5281ad 100644
--- a/libc/src/math/ldexp.cpp
+++ b/libc/src/math/ldexp.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-double LLVM_LIBC_ENTRYPOINT(ldexp)(double x, int exp) {
+LLVM_LIBC_FUNCTION(double, ldexp, (double x, int exp)) {
   return fputil::ldexp(x, exp);
 }
 

diff  --git a/libc/src/math/ldexpf.cpp b/libc/src/math/ldexpf.cpp
index 5c4425450430..94030c0057aa 100644
--- a/libc/src/math/ldexpf.cpp
+++ b/libc/src/math/ldexpf.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-float LLVM_LIBC_ENTRYPOINT(ldexpf)(float x, int exp) {
+LLVM_LIBC_FUNCTION(float, ldexpf, (float x, int exp)) {
   return fputil::ldexp(x, exp);
 }
 

diff  --git a/libc/src/math/ldexpl.cpp b/libc/src/math/ldexpl.cpp
index 10ec66024fc0..08aba33622b8 100644
--- a/libc/src/math/ldexpl.cpp
+++ b/libc/src/math/ldexpl.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long double LLVM_LIBC_ENTRYPOINT(ldexpl)(long double x, int exp) {
+LLVM_LIBC_FUNCTION(long double, ldexpl, (long double x, int exp)) {
   return fputil::ldexp(x, exp);
 }
 

diff  --git a/libc/src/math/llrint.cpp b/libc/src/math/llrint.cpp
index 182eaa5c2da0..2f415268b384 100644
--- a/libc/src/math/llrint.cpp
+++ b/libc/src/math/llrint.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long long LLVM_LIBC_ENTRYPOINT(llrint)(double x) {
+LLVM_LIBC_FUNCTION(long long, llrint, (double x)) {
   return fputil::roundToSignedIntegerUsingCurrentRoundingMode<double,
                                                               long long>(x);
 }

diff  --git a/libc/src/math/llrintf.cpp b/libc/src/math/llrintf.cpp
index 33f6cb679179..35dca58bc995 100644
--- a/libc/src/math/llrintf.cpp
+++ b/libc/src/math/llrintf.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long long LLVM_LIBC_ENTRYPOINT(llrintf)(float x) {
+LLVM_LIBC_FUNCTION(long long, llrintf, (float x)) {
   return fputil::roundToSignedIntegerUsingCurrentRoundingMode<float, long long>(
       x);
 }

diff  --git a/libc/src/math/llrintl.cpp b/libc/src/math/llrintl.cpp
index 725b3d5959e8..962886314f00 100644
--- a/libc/src/math/llrintl.cpp
+++ b/libc/src/math/llrintl.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long long LLVM_LIBC_ENTRYPOINT(llrintl)(long double x) {
+LLVM_LIBC_FUNCTION(long long, llrintl, (long double x)) {
   return fputil::roundToSignedIntegerUsingCurrentRoundingMode<long double,
                                                               long long>(x);
 }

diff  --git a/libc/src/math/llround.cpp b/libc/src/math/llround.cpp
index 25f7e91cf129..79042cfccf26 100644
--- a/libc/src/math/llround.cpp
+++ b/libc/src/math/llround.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long long LLVM_LIBC_ENTRYPOINT(llround)(double x) {
+LLVM_LIBC_FUNCTION(long long, llround, (double x)) {
   return fputil::roundToSignedInteger<double, long long>(x);
 }
 

diff  --git a/libc/src/math/llroundf.cpp b/libc/src/math/llroundf.cpp
index e0b34710594a..560167696fde 100644
--- a/libc/src/math/llroundf.cpp
+++ b/libc/src/math/llroundf.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long long LLVM_LIBC_ENTRYPOINT(llroundf)(float x) {
+LLVM_LIBC_FUNCTION(long long, llroundf, (float x)) {
   return fputil::roundToSignedInteger<float, long long>(x);
 }
 

diff  --git a/libc/src/math/llroundl.cpp b/libc/src/math/llroundl.cpp
index 4df0b8138bf7..88bd6994749d 100644
--- a/libc/src/math/llroundl.cpp
+++ b/libc/src/math/llroundl.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long long LLVM_LIBC_ENTRYPOINT(llroundl)(long double x) {
+LLVM_LIBC_FUNCTION(long long, llroundl, (long double x)) {
   return fputil::roundToSignedInteger<long double, long long>(x);
 }
 

diff  --git a/libc/src/math/logb.cpp b/libc/src/math/logb.cpp
index 7475785ebf7e..d1f5a5e69a8a 100644
--- a/libc/src/math/logb.cpp
+++ b/libc/src/math/logb.cpp
@@ -11,6 +11,6 @@
 
 namespace __llvm_libc {
 
-double LLVM_LIBC_ENTRYPOINT(logb)(double x) { return fputil::logb(x); }
+LLVM_LIBC_FUNCTION(double, logb, (double x)) { return fputil::logb(x); }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/math/logbf.cpp b/libc/src/math/logbf.cpp
index bfe8e8590b97..03a4c6dc284e 100644
--- a/libc/src/math/logbf.cpp
+++ b/libc/src/math/logbf.cpp
@@ -11,6 +11,6 @@
 
 namespace __llvm_libc {
 
-float LLVM_LIBC_ENTRYPOINT(logbf)(float x) { return fputil::logb(x); }
+LLVM_LIBC_FUNCTION(float, logbf, (float x)) { return fputil::logb(x); }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/math/logbl.cpp b/libc/src/math/logbl.cpp
index 57255e773f1b..386a50427456 100644
--- a/libc/src/math/logbl.cpp
+++ b/libc/src/math/logbl.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long double LLVM_LIBC_ENTRYPOINT(logbl)(long double x) {
+LLVM_LIBC_FUNCTION(long double, logbl, (long double x)) {
   return fputil::logb(x);
 }
 

diff  --git a/libc/src/math/lrint.cpp b/libc/src/math/lrint.cpp
index f7ac0266a35f..2cfdf340eac2 100644
--- a/libc/src/math/lrint.cpp
+++ b/libc/src/math/lrint.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long LLVM_LIBC_ENTRYPOINT(lrint)(double x) {
+LLVM_LIBC_FUNCTION(long, lrint, (double x)) {
   return fputil::roundToSignedIntegerUsingCurrentRoundingMode<double, long>(x);
 }
 

diff  --git a/libc/src/math/lrintf.cpp b/libc/src/math/lrintf.cpp
index ab5911945ab2..a5eb5f036385 100644
--- a/libc/src/math/lrintf.cpp
+++ b/libc/src/math/lrintf.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long LLVM_LIBC_ENTRYPOINT(lrintf)(float x) {
+LLVM_LIBC_FUNCTION(long, lrintf, (float x)) {
   return fputil::roundToSignedIntegerUsingCurrentRoundingMode<float, long>(x);
 }
 

diff  --git a/libc/src/math/lrintl.cpp b/libc/src/math/lrintl.cpp
index ae0e699d9f28..0157ed136463 100644
--- a/libc/src/math/lrintl.cpp
+++ b/libc/src/math/lrintl.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long LLVM_LIBC_ENTRYPOINT(lrintl)(long double x) {
+LLVM_LIBC_FUNCTION(long, lrintl, (long double x)) {
   return fputil::roundToSignedIntegerUsingCurrentRoundingMode<long double,
                                                               long>(x);
 }

diff  --git a/libc/src/math/lround.cpp b/libc/src/math/lround.cpp
index 3fb9028f84fa..669b5c4dfb53 100644
--- a/libc/src/math/lround.cpp
+++ b/libc/src/math/lround.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long LLVM_LIBC_ENTRYPOINT(lround)(double x) {
+LLVM_LIBC_FUNCTION(long, lround, (double x)) {
   return fputil::roundToSignedInteger<double, long>(x);
 }
 

diff  --git a/libc/src/math/lroundf.cpp b/libc/src/math/lroundf.cpp
index 0388bdffcd69..ae696371ee03 100644
--- a/libc/src/math/lroundf.cpp
+++ b/libc/src/math/lroundf.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long LLVM_LIBC_ENTRYPOINT(lroundf)(float x) {
+LLVM_LIBC_FUNCTION(long, lroundf, (float x)) {
   return fputil::roundToSignedInteger<float, long>(x);
 }
 

diff  --git a/libc/src/math/lroundl.cpp b/libc/src/math/lroundl.cpp
index 27310ae68d68..36ea2ae36802 100644
--- a/libc/src/math/lroundl.cpp
+++ b/libc/src/math/lroundl.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long LLVM_LIBC_ENTRYPOINT(lroundl)(long double x) {
+LLVM_LIBC_FUNCTION(long, lroundl, (long double x)) {
   return fputil::roundToSignedInteger<long double, long>(x);
 }
 

diff  --git a/libc/src/math/modf.cpp b/libc/src/math/modf.cpp
index 51466004111b..1942f8f0e455 100644
--- a/libc/src/math/modf.cpp
+++ b/libc/src/math/modf.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-double LLVM_LIBC_ENTRYPOINT(modf)(double x, double *iptr) {
+LLVM_LIBC_FUNCTION(double, modf, (double x, double *iptr)) {
   return fputil::modf(x, *iptr);
 }
 

diff  --git a/libc/src/math/modff.cpp b/libc/src/math/modff.cpp
index 4847fe24a9ec..603f2c73d579 100644
--- a/libc/src/math/modff.cpp
+++ b/libc/src/math/modff.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-float LLVM_LIBC_ENTRYPOINT(modff)(float x, float *iptr) {
+LLVM_LIBC_FUNCTION(float, modff, (float x, float *iptr)) {
   return fputil::modf(x, *iptr);
 }
 

diff  --git a/libc/src/math/modfl.cpp b/libc/src/math/modfl.cpp
index 83a0746c5c3d..8102bc5e1b9b 100644
--- a/libc/src/math/modfl.cpp
+++ b/libc/src/math/modfl.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long double LLVM_LIBC_ENTRYPOINT(modfl)(long double x, long double *iptr) {
+LLVM_LIBC_FUNCTION(long double, modfl, (long double x, long double *iptr)) {
   return fputil::modf(x, *iptr);
 }
 

diff  --git a/libc/src/math/nearbyint.cpp b/libc/src/math/nearbyint.cpp
index 0938952752dd..26ff0f431ddc 100644
--- a/libc/src/math/nearbyint.cpp
+++ b/libc/src/math/nearbyint.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-double LLVM_LIBC_ENTRYPOINT(nearbyint)(double x) {
+LLVM_LIBC_FUNCTION(double, nearbyint, (double x)) {
   return fputil::roundUsingCurrentRoundingMode(x);
 }
 

diff  --git a/libc/src/math/nearbyintf.cpp b/libc/src/math/nearbyintf.cpp
index cc19da6f3814..d073dc1c2285 100644
--- a/libc/src/math/nearbyintf.cpp
+++ b/libc/src/math/nearbyintf.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-float LLVM_LIBC_ENTRYPOINT(nearbyintf)(float x) {
+LLVM_LIBC_FUNCTION(float, nearbyintf, (float x)) {
   return fputil::roundUsingCurrentRoundingMode(x);
 }
 

diff  --git a/libc/src/math/nearbyintl.cpp b/libc/src/math/nearbyintl.cpp
index 561883223948..d10e1dbabbd6 100644
--- a/libc/src/math/nearbyintl.cpp
+++ b/libc/src/math/nearbyintl.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long double LLVM_LIBC_ENTRYPOINT(nearbyintl)(long double x) {
+LLVM_LIBC_FUNCTION(long double, nearbyintl, (long double x)) {
   return fputil::roundUsingCurrentRoundingMode(x);
 }
 

diff  --git a/libc/src/math/nextafter.cpp b/libc/src/math/nextafter.cpp
index 8ba15539d639..80eabbd28753 100644
--- a/libc/src/math/nextafter.cpp
+++ b/libc/src/math/nextafter.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-double LLVM_LIBC_ENTRYPOINT(nextafter)(double x, double y) {
+LLVM_LIBC_FUNCTION(double, nextafter, (double x, double y)) {
   return fputil::nextafter(x, y);
 }
 

diff  --git a/libc/src/math/nextafterf.cpp b/libc/src/math/nextafterf.cpp
index dab591ef0368..acde903923f8 100644
--- a/libc/src/math/nextafterf.cpp
+++ b/libc/src/math/nextafterf.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-float LLVM_LIBC_ENTRYPOINT(nextafterf)(float x, float y) {
+LLVM_LIBC_FUNCTION(float, nextafterf, (float x, float y)) {
   return fputil::nextafter(x, y);
 }
 

diff  --git a/libc/src/math/nextafterl.cpp b/libc/src/math/nextafterl.cpp
index 4a9b64c601cd..c4eee4ceb75f 100644
--- a/libc/src/math/nextafterl.cpp
+++ b/libc/src/math/nextafterl.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long double LLVM_LIBC_ENTRYPOINT(nextafterl)(long double x, long double y) {
+LLVM_LIBC_FUNCTION(long double, nextafterl, (long double x, long double y)) {
   return fputil::nextafter(x, y);
 }
 

diff  --git a/libc/src/math/remainder.cpp b/libc/src/math/remainder.cpp
index 880e6a60f4a1..d8e254b01dd1 100644
--- a/libc/src/math/remainder.cpp
+++ b/libc/src/math/remainder.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-double LLVM_LIBC_ENTRYPOINT(remainder)(double x, double y) {
+LLVM_LIBC_FUNCTION(double, remainder, (double x, double y)) {
   int quotient;
   return fputil::remquo(x, y, quotient);
 }

diff  --git a/libc/src/math/remainderf.cpp b/libc/src/math/remainderf.cpp
index bab320101d58..3c4e5644ff03 100644
--- a/libc/src/math/remainderf.cpp
+++ b/libc/src/math/remainderf.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-float LLVM_LIBC_ENTRYPOINT(remainderf)(float x, float y) {
+LLVM_LIBC_FUNCTION(float, remainderf, (float x, float y)) {
   int quotient;
   return fputil::remquo(x, y, quotient);
 }

diff  --git a/libc/src/math/remainderl.cpp b/libc/src/math/remainderl.cpp
index bd9bc4985d96..842595e3064e 100644
--- a/libc/src/math/remainderl.cpp
+++ b/libc/src/math/remainderl.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long double LLVM_LIBC_ENTRYPOINT(remainderl)(long double x, long double y) {
+LLVM_LIBC_FUNCTION(long double, remainderl, (long double x, long double y)) {
   int quotient;
   return fputil::remquo(x, y, quotient);
 }

diff  --git a/libc/src/math/remquo.cpp b/libc/src/math/remquo.cpp
index b61d7d4d1bed..89803ba636ea 100644
--- a/libc/src/math/remquo.cpp
+++ b/libc/src/math/remquo.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-double LLVM_LIBC_ENTRYPOINT(remquo)(double x, double y, int *exp) {
+LLVM_LIBC_FUNCTION(double, remquo, (double x, double y, int *exp)) {
   return fputil::remquo(x, y, *exp);
 }
 

diff  --git a/libc/src/math/remquof.cpp b/libc/src/math/remquof.cpp
index 246bee038f11..0330c430316a 100644
--- a/libc/src/math/remquof.cpp
+++ b/libc/src/math/remquof.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-float LLVM_LIBC_ENTRYPOINT(remquof)(float x, float y, int *exp) {
+LLVM_LIBC_FUNCTION(float, remquof, (float x, float y, int *exp)) {
   return fputil::remquo(x, y, *exp);
 }
 

diff  --git a/libc/src/math/remquol.cpp b/libc/src/math/remquol.cpp
index 8e0287682dbf..9a30acd5139b 100644
--- a/libc/src/math/remquol.cpp
+++ b/libc/src/math/remquol.cpp
@@ -11,8 +11,8 @@
 
 namespace __llvm_libc {
 
-long double LLVM_LIBC_ENTRYPOINT(remquol)(long double x, long double y,
-                                          int *exp) {
+LLVM_LIBC_FUNCTION(long double, remquol,
+                   (long double x, long double y, int *exp)) {
   return fputil::remquo(x, y, *exp);
 }
 

diff  --git a/libc/src/math/rint.cpp b/libc/src/math/rint.cpp
index 5081d0ad28fb..056d05af4322 100644
--- a/libc/src/math/rint.cpp
+++ b/libc/src/math/rint.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-double LLVM_LIBC_ENTRYPOINT(rint)(double x) {
+LLVM_LIBC_FUNCTION(double, rint, (double x)) {
   return fputil::roundUsingCurrentRoundingMode(x);
 }
 

diff  --git a/libc/src/math/rintf.cpp b/libc/src/math/rintf.cpp
index 7535ee61f123..77a28c8ed6c8 100644
--- a/libc/src/math/rintf.cpp
+++ b/libc/src/math/rintf.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-float LLVM_LIBC_ENTRYPOINT(rintf)(float x) {
+LLVM_LIBC_FUNCTION(float, rintf, (float x)) {
   return fputil::roundUsingCurrentRoundingMode(x);
 }
 

diff  --git a/libc/src/math/rintl.cpp b/libc/src/math/rintl.cpp
index cc617a2c78bb..fb4819a3f087 100644
--- a/libc/src/math/rintl.cpp
+++ b/libc/src/math/rintl.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long double LLVM_LIBC_ENTRYPOINT(rintl)(long double x) {
+LLVM_LIBC_FUNCTION(long double, rintl, (long double x)) {
   return fputil::roundUsingCurrentRoundingMode(x);
 }
 

diff  --git a/libc/src/math/round.cpp b/libc/src/math/round.cpp
index 44a1119ae559..ed36a128fe3d 100644
--- a/libc/src/math/round.cpp
+++ b/libc/src/math/round.cpp
@@ -11,6 +11,6 @@
 
 namespace __llvm_libc {
 
-double LLVM_LIBC_ENTRYPOINT(round)(double x) { return fputil::round(x); }
+LLVM_LIBC_FUNCTION(double, round, (double x)) { return fputil::round(x); }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/math/roundf.cpp b/libc/src/math/roundf.cpp
index 8cbb3155fa4d..a2be7094177d 100644
--- a/libc/src/math/roundf.cpp
+++ b/libc/src/math/roundf.cpp
@@ -11,6 +11,6 @@
 
 namespace __llvm_libc {
 
-float LLVM_LIBC_ENTRYPOINT(roundf)(float x) { return fputil::round(x); }
+LLVM_LIBC_FUNCTION(float, roundf, (float x)) { return fputil::round(x); }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/math/roundl.cpp b/libc/src/math/roundl.cpp
index afb1a895ccec..7e3ba5e4ebce 100644
--- a/libc/src/math/roundl.cpp
+++ b/libc/src/math/roundl.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long double LLVM_LIBC_ENTRYPOINT(roundl)(long double x) {
+LLVM_LIBC_FUNCTION(long double, roundl, (long double x)) {
   return fputil::round(x);
 }
 

diff  --git a/libc/src/math/sincosf.cpp b/libc/src/math/sincosf.cpp
index a52af1709123..4903af3e93ef 100644
--- a/libc/src/math/sincosf.cpp
+++ b/libc/src/math/sincosf.cpp
@@ -20,7 +20,7 @@ namespace __llvm_libc {
 // error is 0.5303 * 2^-23. A single-step range reduction is used for
 // small values. Large inputs have their range reduced using fast integer
 // arithmetic.
-void LLVM_LIBC_ENTRYPOINT(sincosf)(float y, float *sinp, float *cosp) {
+LLVM_LIBC_FUNCTION(void, sincosf, (float y, float *sinp, float *cosp)) {
   double x = y;
   double s;
   int n;

diff  --git a/libc/src/math/sinf.cpp b/libc/src/math/sinf.cpp
index 49496f3173f2..40bdc4452f36 100644
--- a/libc/src/math/sinf.cpp
+++ b/libc/src/math/sinf.cpp
@@ -20,7 +20,7 @@ namespace __llvm_libc {
 // error is 0.5303 * 2^-23. A single-step range reduction is used for
 // small values. Large inputs have their range reduced using fast integer
 // arithmetic.
-float LLVM_LIBC_ENTRYPOINT(sinf)(float y) {
+LLVM_LIBC_FUNCTION(float, sinf, (float y)) {
   double x = y;
   double s;
   int n;

diff  --git a/libc/src/math/sqrt.cpp b/libc/src/math/sqrt.cpp
index 32d38e61463d..7c6a1157b8eb 100644
--- a/libc/src/math/sqrt.cpp
+++ b/libc/src/math/sqrt.cpp
@@ -11,6 +11,6 @@
 
 namespace __llvm_libc {
 
-double LLVM_LIBC_ENTRYPOINT(sqrt)(double x) { return fputil::sqrt(x); }
+LLVM_LIBC_FUNCTION(double, sqrt, (double x)) { return fputil::sqrt(x); }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/math/sqrtf.cpp b/libc/src/math/sqrtf.cpp
index 391fa6a3281a..5383e93cbcd8 100644
--- a/libc/src/math/sqrtf.cpp
+++ b/libc/src/math/sqrtf.cpp
@@ -11,6 +11,6 @@
 
 namespace __llvm_libc {
 
-float LLVM_LIBC_ENTRYPOINT(sqrtf)(float x) { return fputil::sqrt(x); }
+LLVM_LIBC_FUNCTION(float, sqrtf, (float x)) { return fputil::sqrt(x); }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/math/sqrtl.cpp b/libc/src/math/sqrtl.cpp
index 16450349d23a..a526e5e62c59 100644
--- a/libc/src/math/sqrtl.cpp
+++ b/libc/src/math/sqrtl.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long double LLVM_LIBC_ENTRYPOINT(sqrtl)(long double x) {
+LLVM_LIBC_FUNCTION(long double, sqrtl, (long double x)) {
   return fputil::sqrt(x);
 }
 

diff  --git a/libc/src/math/trunc.cpp b/libc/src/math/trunc.cpp
index 0749e114e274..68b5b8529351 100644
--- a/libc/src/math/trunc.cpp
+++ b/libc/src/math/trunc.cpp
@@ -11,6 +11,6 @@
 
 namespace __llvm_libc {
 
-double LLVM_LIBC_ENTRYPOINT(trunc)(double x) { return fputil::trunc(x); }
+LLVM_LIBC_FUNCTION(double, trunc, (double x)) { return fputil::trunc(x); }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/math/truncf.cpp b/libc/src/math/truncf.cpp
index 03725718c88d..8b9949f3c6c9 100644
--- a/libc/src/math/truncf.cpp
+++ b/libc/src/math/truncf.cpp
@@ -11,6 +11,6 @@
 
 namespace __llvm_libc {
 
-float LLVM_LIBC_ENTRYPOINT(truncf)(float x) { return fputil::trunc(x); }
+LLVM_LIBC_FUNCTION(float, truncf, (float x)) { return fputil::trunc(x); }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/math/truncl.cpp b/libc/src/math/truncl.cpp
index 0eb557a804f4..f78a19347a35 100644
--- a/libc/src/math/truncl.cpp
+++ b/libc/src/math/truncl.cpp
@@ -11,7 +11,7 @@
 
 namespace __llvm_libc {
 
-long double LLVM_LIBC_ENTRYPOINT(truncl)(long double x) {
+LLVM_LIBC_FUNCTION(long double, truncl, (long double x)) {
   return fputil::trunc(x);
 }
 

diff  --git a/libc/src/signal/linux/raise.cpp b/libc/src/signal/linux/raise.cpp
index 15f748cd09a2..eccc4f7c996a 100644
--- a/libc/src/signal/linux/raise.cpp
+++ b/libc/src/signal/linux/raise.cpp
@@ -13,7 +13,7 @@
 
 namespace __llvm_libc {
 
-int LLVM_LIBC_ENTRYPOINT(raise)(int sig) {
+LLVM_LIBC_FUNCTION(int, raise, (int sig)) {
   __llvm_libc::Sigset sigset;
   __llvm_libc::block_all_signals(sigset);
   long pid = __llvm_libc::syscall(SYS_getpid);

diff  --git a/libc/src/signal/linux/sigaction.cpp b/libc/src/signal/linux/sigaction.cpp
index 47e907249abc..602fc71bf390 100644
--- a/libc/src/signal/linux/sigaction.cpp
+++ b/libc/src/signal/linux/sigaction.cpp
@@ -28,9 +28,9 @@ static void copySigaction(T &dest, const V &source) {
   dest.sa_restorer = source.sa_restorer;
 }
 
-int LLVM_LIBC_ENTRYPOINT(sigaction)(
-    int signal, const struct __sigaction *__restrict libc_new,
-    struct __sigaction *__restrict libc_old) {
+LLVM_LIBC_FUNCTION(int, sigaction,
+                   (int signal, const struct __sigaction *__restrict libc_new,
+                    struct __sigaction *__restrict libc_old)) {
   struct sigaction kernel_new;
   if (libc_new) {
     copySigaction(kernel_new, *libc_new);

diff  --git a/libc/src/signal/linux/sigaddset.cpp b/libc/src/signal/linux/sigaddset.cpp
index 2afb83cb3aa3..bc51ef67e0b3 100644
--- a/libc/src/signal/linux/sigaddset.cpp
+++ b/libc/src/signal/linux/sigaddset.cpp
@@ -15,7 +15,7 @@
 
 namespace __llvm_libc {
 
-int LLVM_LIBC_ENTRYPOINT(sigaddset)(sigset_t *set, int signum) {
+LLVM_LIBC_FUNCTION(int, sigaddset, (sigset_t * set, int signum)) {
   if (!set || (unsigned)(signum - 1) >= (8 * sizeof(sigset_t))) {
     llvmlibc_errno = EINVAL;
     return -1;

diff  --git a/libc/src/signal/linux/sigdelset.cpp b/libc/src/signal/linux/sigdelset.cpp
index 7eb3a602326c..f870f7156007 100644
--- a/libc/src/signal/linux/sigdelset.cpp
+++ b/libc/src/signal/linux/sigdelset.cpp
@@ -15,7 +15,7 @@
 
 namespace __llvm_libc {
 
-int LLVM_LIBC_ENTRYPOINT(sigdelset)(sigset_t *set, int signum) {
+LLVM_LIBC_FUNCTION(int, sigdelset, (sigset_t * set, int signum)) {
   if (!set || (unsigned)(signum - 1) >= (8 * sizeof(sigset_t))) {
     llvmlibc_errno = EINVAL;
     return -1;

diff  --git a/libc/src/signal/linux/sigemptyset.cpp b/libc/src/signal/linux/sigemptyset.cpp
index d5818327bea0..bce5fea7c963 100644
--- a/libc/src/signal/linux/sigemptyset.cpp
+++ b/libc/src/signal/linux/sigemptyset.cpp
@@ -15,7 +15,7 @@
 
 namespace __llvm_libc {
 
-int LLVM_LIBC_ENTRYPOINT(sigemptyset)(sigset_t *set) {
+LLVM_LIBC_FUNCTION(int, sigemptyset, (sigset_t * set)) {
   if (!set) {
     llvmlibc_errno = EINVAL;
     return -1;

diff  --git a/libc/src/signal/linux/sigfillset.cpp b/libc/src/signal/linux/sigfillset.cpp
index bb4281a0a8aa..1b908f199264 100644
--- a/libc/src/signal/linux/sigfillset.cpp
+++ b/libc/src/signal/linux/sigfillset.cpp
@@ -15,7 +15,7 @@
 
 namespace __llvm_libc {
 
-int LLVM_LIBC_ENTRYPOINT(sigfillset)(sigset_t *set) {
+LLVM_LIBC_FUNCTION(int, sigfillset, (sigset_t * set)) {
   if (!set) {
     llvmlibc_errno = EINVAL;
     return -1;

diff  --git a/libc/src/signal/linux/signal.cpp b/libc/src/signal/linux/signal.cpp
index 5de51ea0c18d..fc0487709007 100644
--- a/libc/src/signal/linux/signal.cpp
+++ b/libc/src/signal/linux/signal.cpp
@@ -14,7 +14,7 @@
 
 namespace __llvm_libc {
 
-sighandler_t LLVM_LIBC_ENTRYPOINT(signal)(int signum, sighandler_t handler) {
+LLVM_LIBC_FUNCTION(sighandler_t, signal, (int signum, sighandler_t handler)) {
   struct __sigaction action, old;
   action.sa_handler = handler;
   action.sa_flags = SA_RESTART;

diff  --git a/libc/src/signal/linux/sigprocmask.cpp b/libc/src/signal/linux/sigprocmask.cpp
index e4c7059e3a3b..e4b101c49094 100644
--- a/libc/src/signal/linux/sigprocmask.cpp
+++ b/libc/src/signal/linux/sigprocmask.cpp
@@ -14,8 +14,9 @@
 
 namespace __llvm_libc {
 
-int LLVM_LIBC_ENTRYPOINT(sigprocmask)(int how, const sigset_t *__restrict set,
-                                      sigset_t *__restrict oldset) {
+LLVM_LIBC_FUNCTION(int, sigprocmask,
+                   (int how, const sigset_t *__restrict set,
+                    sigset_t *__restrict oldset)) {
   int ret = __llvm_libc::syscall(SYS_rt_sigprocmask, how, set, oldset,
                                  sizeof(sigset_t));
   if (!ret)

diff  --git a/libc/src/stdlib/abort.cpp b/libc/src/stdlib/abort.cpp
index e21e74f7b9aa..1da81611273d 100644
--- a/libc/src/stdlib/abort.cpp
+++ b/libc/src/stdlib/abort.cpp
@@ -14,7 +14,7 @@
 
 namespace __llvm_libc {
 
-void LLVM_LIBC_ENTRYPOINT(abort)() {
+LLVM_LIBC_FUNCTION(void, abort, ()) {
   // TODO: When sigprocmask and sigaction land:
   // Unblock SIGABRT, raise it, if it was ignored or the handler returned,
   // change its action to SIG_DFL, raise it again.

diff  --git a/libc/src/stdlib/abs.cpp b/libc/src/stdlib/abs.cpp
index 74c47cdb242d..eba2b7d47db3 100644
--- a/libc/src/stdlib/abs.cpp
+++ b/libc/src/stdlib/abs.cpp
@@ -12,7 +12,7 @@
 
 namespace __llvm_libc {
 
-int LLVM_LIBC_ENTRYPOINT(abs)(int n) {
+LLVM_LIBC_FUNCTION(int, abs, (int n)) {
   // integer_abs from abs_utils.h.
   return integer_abs(n);
 }

diff  --git a/libc/src/stdlib/labs.cpp b/libc/src/stdlib/labs.cpp
index 427cb9d841ef..d2aa8164ea98 100644
--- a/libc/src/stdlib/labs.cpp
+++ b/libc/src/stdlib/labs.cpp
@@ -12,7 +12,7 @@
 
 namespace __llvm_libc {
 
-long LLVM_LIBC_ENTRYPOINT(labs)(long n) {
+LLVM_LIBC_FUNCTION(long, labs, (long n)) {
   // integer_abs from abs_utils.h.
   return integer_abs(n);
 }

diff  --git a/libc/src/stdlib/linux/_Exit.cpp b/libc/src/stdlib/linux/_Exit.cpp
index 1c5f60a17a27..7fdd60ffe9bc 100644
--- a/libc/src/stdlib/linux/_Exit.cpp
+++ b/libc/src/stdlib/linux/_Exit.cpp
@@ -14,7 +14,7 @@
 
 namespace __llvm_libc {
 
-void LLVM_LIBC_ENTRYPOINT(_Exit)(int status) {
+LLVM_LIBC_FUNCTION(void, _Exit, (int status)) {
   for (;;) {
     __llvm_libc::syscall(SYS_exit_group, status);
     __llvm_libc::syscall(SYS_exit, status);

diff  --git a/libc/src/stdlib/llabs.cpp b/libc/src/stdlib/llabs.cpp
index 8878ce41c76b..7a83fcb77f53 100644
--- a/libc/src/stdlib/llabs.cpp
+++ b/libc/src/stdlib/llabs.cpp
@@ -12,7 +12,7 @@
 
 namespace __llvm_libc {
 
-long long LLVM_LIBC_ENTRYPOINT(llabs)(long long n) {
+LLVM_LIBC_FUNCTION(long long, llabs, (long long n)) {
   // integer_abs from abs_utils.h.
   return integer_abs(n);
 }

diff  --git a/libc/src/string/bzero.cpp b/libc/src/string/bzero.cpp
index 60c059ae4061..3c76ef64eed5 100644
--- a/libc/src/string/bzero.cpp
+++ b/libc/src/string/bzero.cpp
@@ -12,7 +12,7 @@
 
 namespace __llvm_libc {
 
-void LLVM_LIBC_ENTRYPOINT(bzero)(void *ptr, size_t count) {
+LLVM_LIBC_FUNCTION(void, bzero, (void *ptr, size_t count)) {
   GeneralPurposeMemset(reinterpret_cast<char *>(ptr), 0, count);
 }
 

diff  --git a/libc/src/string/memchr.cpp b/libc/src/string/memchr.cpp
index c95e2724f1a1..02b401639841 100644
--- a/libc/src/string/memchr.cpp
+++ b/libc/src/string/memchr.cpp
@@ -15,7 +15,7 @@
 namespace __llvm_libc {
 
 // TODO: Look at performance benefits of comparing words.
-void *LLVM_LIBC_ENTRYPOINT(memchr)(const void *src, int c, size_t n) {
+LLVM_LIBC_FUNCTION(void *, memchr, (const void *src, int c, size_t n)) {
   return internal::find_first_character(
       reinterpret_cast<const unsigned char *>(src), c, n);
 }

diff  --git a/libc/src/string/memcmp.cpp b/libc/src/string/memcmp.cpp
index 1bd1c60ee1be..5569ab29f765 100644
--- a/libc/src/string/memcmp.cpp
+++ b/libc/src/string/memcmp.cpp
@@ -13,8 +13,8 @@
 namespace __llvm_libc {
 
 // TODO: It is a simple implementation, an optimized version is preparing.
-int LLVM_LIBC_ENTRYPOINT(memcmp)(const void *lhs, const void *rhs,
-                                 size_t count) {
+LLVM_LIBC_FUNCTION(int, memcmp,
+                   (const void *lhs, const void *rhs, size_t count)) {
   const unsigned char *_lhs = reinterpret_cast<const unsigned char *>(lhs);
   const unsigned char *_rhs = reinterpret_cast<const unsigned char *>(rhs);
   for (size_t i = 0; i < count; ++i)

diff  --git a/libc/src/string/memcpy.cpp b/libc/src/string/memcpy.cpp
index 00d66ea677d2..a145b904b87d 100644
--- a/libc/src/string/memcpy.cpp
+++ b/libc/src/string/memcpy.cpp
@@ -55,8 +55,9 @@ static void memcpy_impl(char *__restrict dst, const char *__restrict src,
   return CopyAlignedBlocks<32>(dst, src, count);
 }
 
-void *LLVM_LIBC_ENTRYPOINT(memcpy)(void *__restrict dst,
-                                   const void *__restrict src, size_t size) {
+LLVM_LIBC_FUNCTION(void *, memcpy,
+                   (void *__restrict dst, const void *__restrict src,
+                    size_t size)) {
   memcpy_impl(reinterpret_cast<char *>(dst),
               reinterpret_cast<const char *>(src), size);
   return dst;

diff  --git a/libc/src/string/memrchr.cpp b/libc/src/string/memrchr.cpp
index 81b034505202..b010b8ad87c5 100644
--- a/libc/src/string/memrchr.cpp
+++ b/libc/src/string/memrchr.cpp
@@ -12,7 +12,7 @@
 
 namespace __llvm_libc {
 
-void *LLVM_LIBC_ENTRYPOINT(memrchr)(const void *src, int c, size_t n) {
+LLVM_LIBC_FUNCTION(void *, memrchr, (const void *src, int c, size_t n)) {
   const unsigned char *str = reinterpret_cast<const unsigned char *>(src);
   const unsigned char ch = c;
   for (; n != 0; --n) {

diff  --git a/libc/src/string/memset.cpp b/libc/src/string/memset.cpp
index cf1be5e42c6c..945aeda234e6 100644
--- a/libc/src/string/memset.cpp
+++ b/libc/src/string/memset.cpp
@@ -12,7 +12,7 @@
 
 namespace __llvm_libc {
 
-void *LLVM_LIBC_ENTRYPOINT(memset)(void *dst, int value, size_t count) {
+LLVM_LIBC_FUNCTION(void *, memset, (void *dst, int value, size_t count)) {
   GeneralPurposeMemset(reinterpret_cast<char *>(dst),
                        static_cast<unsigned char>(value), count);
   return dst;

diff  --git a/libc/src/string/strcat.cpp b/libc/src/string/strcat.cpp
index f5e8616f022a..176a42a2c751 100644
--- a/libc/src/string/strcat.cpp
+++ b/libc/src/string/strcat.cpp
@@ -14,8 +14,8 @@
 
 namespace __llvm_libc {
 
-char *LLVM_LIBC_ENTRYPOINT(strcat)(char *__restrict dest,
-                                   const char *__restrict src) {
+LLVM_LIBC_FUNCTION(char *, strcat,
+                   (char *__restrict dest, const char *__restrict src)) {
   __llvm_libc::strcpy(dest + internal::string_length(dest), src);
   return dest;
 }

diff  --git a/libc/src/string/strchr.cpp b/libc/src/string/strchr.cpp
index eac0e512a8fb..6288b64b7462 100644
--- a/libc/src/string/strchr.cpp
+++ b/libc/src/string/strchr.cpp
@@ -13,7 +13,7 @@
 namespace __llvm_libc {
 
 // TODO: Look at performance benefits of comparing words.
-char *LLVM_LIBC_ENTRYPOINT(strchr)(const char *src, int c) {
+LLVM_LIBC_FUNCTION(char *, strchr, (const char *src, int c)) {
   unsigned char *str =
       const_cast<unsigned char *>(reinterpret_cast<const unsigned char *>(src));
   const unsigned char ch = c;

diff  --git a/libc/src/string/strcmp.cpp b/libc/src/string/strcmp.cpp
index 4ef7a77363e5..8468b3c4a2c1 100644
--- a/libc/src/string/strcmp.cpp
+++ b/libc/src/string/strcmp.cpp
@@ -13,7 +13,7 @@
 namespace __llvm_libc {
 
 // TODO: Look at benefits for comparing words at a time.
-int LLVM_LIBC_ENTRYPOINT(strcmp)(const char *left, const char *right) {
+LLVM_LIBC_FUNCTION(int, strcmp, (const char *left, const char *right)) {
   for (; *left && *left == *right; ++left, ++right)
     ;
   return *reinterpret_cast<const unsigned char *>(left) -

diff  --git a/libc/src/string/strcpy.cpp b/libc/src/string/strcpy.cpp
index 69a40c9f5392..d081d6c497df 100644
--- a/libc/src/string/strcpy.cpp
+++ b/libc/src/string/strcpy.cpp
@@ -14,8 +14,8 @@
 
 namespace __llvm_libc {
 
-char *LLVM_LIBC_ENTRYPOINT(strcpy)(char *__restrict dest,
-                                   const char *__restrict src) {
+LLVM_LIBC_FUNCTION(char *, strcpy,
+                   (char *__restrict dest, const char *__restrict src)) {
   return reinterpret_cast<char *>(
       __llvm_libc::memcpy(dest, src, internal::string_length(src) + 1));
 }

diff  --git a/libc/src/string/strcspn.cpp b/libc/src/string/strcspn.cpp
index a19b3fb16820..d4929c56a9b3 100644
--- a/libc/src/string/strcspn.cpp
+++ b/libc/src/string/strcspn.cpp
@@ -13,7 +13,7 @@
 
 namespace __llvm_libc {
 
-size_t LLVM_LIBC_ENTRYPOINT(strcspn)(const char *src, const char *segment) {
+LLVM_LIBC_FUNCTION(size_t, strcspn, (const char *src, const char *segment)) {
   return internal::complementary_span(src, segment);
 }
 

diff  --git a/libc/src/string/strlen.cpp b/libc/src/string/strlen.cpp
index 81e1f17e7c11..c7b192bff250 100644
--- a/libc/src/string/strlen.cpp
+++ b/libc/src/string/strlen.cpp
@@ -15,7 +15,7 @@ namespace __llvm_libc {
 
 // TODO: investigate the performance of this function.
 // There might be potential for compiler optimization.
-size_t LLVM_LIBC_ENTRYPOINT(strlen)(const char *src) {
+LLVM_LIBC_FUNCTION(size_t, strlen, (const char *src)) {
   return internal::string_length(src);
 }
 

diff  --git a/libc/src/string/strncpy.cpp b/libc/src/string/strncpy.cpp
index 45255e30ac52..274950230f51 100644
--- a/libc/src/string/strncpy.cpp
+++ b/libc/src/string/strncpy.cpp
@@ -13,8 +13,9 @@
 
 namespace __llvm_libc {
 
-char *LLVM_LIBC_ENTRYPOINT(strncpy)(char *__restrict dest,
-                                    const char *__restrict src, size_t n) {
+LLVM_LIBC_FUNCTION(char *, strncpy,
+                   (char *__restrict dest, const char *__restrict src,
+                    size_t n)) {
   size_t i = 0;
   // Copy up until \0 is found.
   for (; i < n && src[i] != '\0'; ++i)

diff  --git a/libc/src/string/strnlen.cpp b/libc/src/string/strnlen.cpp
index ea8fa9c26d54..dc208b0ac66b 100644
--- a/libc/src/string/strnlen.cpp
+++ b/libc/src/string/strnlen.cpp
@@ -14,7 +14,7 @@
 
 namespace __llvm_libc {
 
-size_t LLVM_LIBC_ENTRYPOINT(strnlen)(const char *src, size_t n) {
+LLVM_LIBC_FUNCTION(size_t, strnlen, (const char *src, size_t n)) {
   const void *temp = internal::find_first_character(
       reinterpret_cast<const unsigned char *>(src), '\0', n);
   return temp ? reinterpret_cast<const char *>(temp) - src : n;

diff  --git a/libc/src/string/strpbrk.cpp b/libc/src/string/strpbrk.cpp
index bbd2cec9188f..fc2cadc27523 100644
--- a/libc/src/string/strpbrk.cpp
+++ b/libc/src/string/strpbrk.cpp
@@ -13,7 +13,7 @@
 
 namespace __llvm_libc {
 
-char *LLVM_LIBC_ENTRYPOINT(strpbrk)(const char *src, const char *breakset) {
+LLVM_LIBC_FUNCTION(char *, strpbrk, (const char *src, const char *breakset)) {
   src += internal::complementary_span(src, breakset);
   return *src ? const_cast<char *>(src) : nullptr;
 }

diff  --git a/libc/src/string/strrchr.cpp b/libc/src/string/strrchr.cpp
index 374a802fbb9e..33a638bacd86 100644
--- a/libc/src/string/strrchr.cpp
+++ b/libc/src/string/strrchr.cpp
@@ -12,7 +12,7 @@
 
 namespace __llvm_libc {
 
-char *LLVM_LIBC_ENTRYPOINT(strrchr)(const char *src, int c) {
+LLVM_LIBC_FUNCTION(char *, strrchr, (const char *src, int c)) {
   const char ch = c;
   char *last_occurrence = nullptr;
   do {

diff  --git a/libc/src/string/strspn.cpp b/libc/src/string/strspn.cpp
index c85fc8b69ee0..893b2c988a39 100644
--- a/libc/src/string/strspn.cpp
+++ b/libc/src/string/strspn.cpp
@@ -14,7 +14,7 @@
 
 namespace __llvm_libc {
 
-size_t LLVM_LIBC_ENTRYPOINT(strspn)(const char *src, const char *segment) {
+LLVM_LIBC_FUNCTION(size_t, strspn, (const char *src, const char *segment)) {
   const char *initial = src;
   cpp::Bitset<256> bitset;
 

diff  --git a/libc/src/string/strstr.cpp b/libc/src/string/strstr.cpp
index a598f6610621..3ec32fddd942 100644
--- a/libc/src/string/strstr.cpp
+++ b/libc/src/string/strstr.cpp
@@ -15,7 +15,7 @@ namespace __llvm_libc {
 
 // TODO: This is a simple brute force implementation. This can be
 // improved upon using well known string matching algorithms.
-char *LLVM_LIBC_ENTRYPOINT(strstr)(const char *haystack, const char *needle) {
+LLVM_LIBC_FUNCTION(char *, strstr, (const char *haystack, const char *needle)) {
   for (size_t i = 0; haystack[i]; ++i) {
     size_t j;
     for (j = 0; haystack[i + j] && haystack[i + j] == needle[j]; ++j)

diff  --git a/libc/src/string/strtok.cpp b/libc/src/string/strtok.cpp
index 3a8ab9919334..281197e07971 100644
--- a/libc/src/string/strtok.cpp
+++ b/libc/src/string/strtok.cpp
@@ -15,8 +15,9 @@ namespace __llvm_libc {
 
 static char *strtok_str = nullptr;
 
-char *LLVM_LIBC_ENTRYPOINT(strtok)(char *__restrict src,
-                                   const char *__restrict delimiter_string) {
+LLVM_LIBC_FUNCTION(char *, strtok,
+                   (char *__restrict src,
+                    const char *__restrict delimiter_string)) {
   return internal::string_token(src, delimiter_string, &strtok_str);
 }
 

diff  --git a/libc/src/string/strtok_r.cpp b/libc/src/string/strtok_r.cpp
index 4f9ab34ee4f5..d1cc675ead32 100644
--- a/libc/src/string/strtok_r.cpp
+++ b/libc/src/string/strtok_r.cpp
@@ -13,9 +13,10 @@
 
 namespace __llvm_libc {
 
-char *LLVM_LIBC_ENTRYPOINT(strtok_r)(char *__restrict src,
-                                     const char *__restrict delimiter_string,
-                                     char **__restrict saveptr) {
+LLVM_LIBC_FUNCTION(char *, strtok_r,
+                   (char *__restrict src,
+                    const char *__restrict delimiter_string,
+                    char **__restrict saveptr)) {
   return internal::string_token(src, delimiter_string, saveptr);
 }
 

diff  --git a/libc/src/string/x86/memcpy.cpp b/libc/src/string/x86/memcpy.cpp
index 2e2148eb7289..7c5740ba00e8 100644
--- a/libc/src/string/x86/memcpy.cpp
+++ b/libc/src/string/x86/memcpy.cpp
@@ -80,8 +80,9 @@ static void memcpy_x86(char *__restrict dst, const char *__restrict src,
   return CopyRepMovsb(dst, src, count);
 }
 
-void *LLVM_LIBC_ENTRYPOINT(memcpy)(void *__restrict dst,
-                                   const void *__restrict src, size_t size) {
+LLVM_LIBC_FUNCTION(void *, memcpy,
+                   (void *__restrict dst, const void *__restrict src,
+                    size_t size)) {
   memcpy_x86(reinterpret_cast<char *>(dst), reinterpret_cast<const char *>(src),
              size);
   return dst;

diff  --git a/libc/src/sys/mman/linux/mmap.cpp b/libc/src/sys/mman/linux/mmap.cpp
index 616cd98561a5..31e114a7f66b 100644
--- a/libc/src/sys/mman/linux/mmap.cpp
+++ b/libc/src/sys/mman/linux/mmap.cpp
@@ -19,8 +19,9 @@ namespace __llvm_libc {
 
 // This function is currently linux only. It has to be refactored suitably if
 // mmap is to be supported on non-linux operating systems also.
-void *LLVM_LIBC_ENTRYPOINT(mmap)(void *addr, size_t size, int prot, int flags,
-                                 int fd, off_t offset) {
+LLVM_LIBC_FUNCTION(void *, mmap,
+                   (void *addr, size_t size, int prot, int flags, int fd,
+                    off_t offset)) {
   // A lot of POSIX standard prescribed validation of the parameters is not
   // done in this function as modern linux versions do it in the syscall.
   // TODO: Perform argument validation not done by the linux syscall.

diff  --git a/libc/src/sys/mman/linux/munmap.cpp b/libc/src/sys/mman/linux/munmap.cpp
index 1f112f8f1281..fd89773cc829 100644
--- a/libc/src/sys/mman/linux/munmap.cpp
+++ b/libc/src/sys/mman/linux/munmap.cpp
@@ -17,7 +17,7 @@ namespace __llvm_libc {
 
 // This function is currently linux only. It has to be refactored suitably if
 // mmap is to be supported on non-linux operating systems also.
-int LLVM_LIBC_ENTRYPOINT(munmap)(void *addr, size_t size) {
+LLVM_LIBC_FUNCTION(int, munmap, (void *addr, size_t size)) {
   long ret_val =
       __llvm_libc::syscall(SYS_munmap, reinterpret_cast<long>(addr), size);
 

diff  --git a/libc/src/threads/linux/call_once.cpp b/libc/src/threads/linux/call_once.cpp
index 058f3700ef7e..9e1d9359ad37 100644
--- a/libc/src/threads/linux/call_once.cpp
+++ b/libc/src/threads/linux/call_once.cpp
@@ -22,7 +22,8 @@ static constexpr unsigned START = 0x11;
 static constexpr unsigned WAITING = 0x22;
 static constexpr unsigned FINISH = 0x33;
 
-void LLVM_LIBC_ENTRYPOINT(call_once)(once_flag *flag, __call_once_func_t func) {
+LLVM_LIBC_FUNCTION(void, call_once,
+                   (once_flag * flag, __call_once_func_t func)) {
   FutexData *futex_word = reinterpret_cast<FutexData *>(flag);
   unsigned int not_called = ONCE_FLAG_INIT;
 

diff  --git a/libc/src/threads/linux/mtx_init.cpp b/libc/src/threads/linux/mtx_init.cpp
index 329843c10c6a..610098a5f02d 100644
--- a/libc/src/threads/linux/mtx_init.cpp
+++ b/libc/src/threads/linux/mtx_init.cpp
@@ -12,7 +12,7 @@
 
 namespace __llvm_libc {
 
-int LLVM_LIBC_ENTRYPOINT(mtx_init)(mtx_t *mutex, int type) {
+LLVM_LIBC_FUNCTION(int, mtx_init, (mtx_t * mutex, int type)) {
   *(reinterpret_cast<uint32_t *>(mutex->__internal_data)) = MS_Free;
   mutex->__mtx_type = type;
   return thrd_success;

diff  --git a/libc/src/threads/linux/mtx_lock.cpp b/libc/src/threads/linux/mtx_lock.cpp
index 44a82dfaa70c..923b1b6197a5 100644
--- a/libc/src/threads/linux/mtx_lock.cpp
+++ b/libc/src/threads/linux/mtx_lock.cpp
@@ -18,7 +18,7 @@
 namespace __llvm_libc {
 
 // The implementation currently handles only plain mutexes.
-int LLVM_LIBC_ENTRYPOINT(mtx_lock)(mtx_t *mutex) {
+LLVM_LIBC_FUNCTION(int, mtx_lock, (mtx_t * mutex)) {
   FutexData *futex_data = reinterpret_cast<FutexData *>(mutex->__internal_data);
   while (true) {
     uint32_t mutex_status = MS_Free;

diff  --git a/libc/src/threads/linux/mtx_unlock.cpp b/libc/src/threads/linux/mtx_unlock.cpp
index 25170638968a..370e1b1a9c8b 100644
--- a/libc/src/threads/linux/mtx_unlock.cpp
+++ b/libc/src/threads/linux/mtx_unlock.cpp
@@ -18,7 +18,7 @@
 namespace __llvm_libc {
 
 // The implementation currently handles only plain mutexes.
-int LLVM_LIBC_ENTRYPOINT(mtx_unlock)(mtx_t *mutex) {
+LLVM_LIBC_FUNCTION(int, mtx_unlock, (mtx_t * mutex)) {
   FutexData *futex_word = reinterpret_cast<FutexData *>(mutex->__internal_data);
   while (true) {
     uint32_t mutex_status = MS_Waiting;

diff  --git a/libc/src/threads/linux/thrd_create.cpp b/libc/src/threads/linux/thrd_create.cpp
index 946000eb17d4..ff47e53c4872 100644
--- a/libc/src/threads/linux/thrd_create.cpp
+++ b/libc/src/threads/linux/thrd_create.cpp
@@ -35,8 +35,8 @@ static __attribute__((noinline)) void start_thread() {
                                      start_args->func(start_args->arg));
 }
 
-int LLVM_LIBC_ENTRYPOINT(thrd_create)(thrd_t *thread, thrd_start_t func,
-                                      void *arg) {
+LLVM_LIBC_FUNCTION(int, thrd_create,
+                   (thrd_t * thread, thrd_start_t func, void *arg)) {
   unsigned clone_flags =
       CLONE_VM        // Share the memory space with the parent.
       | CLONE_FS      // Share the file system with the parent.

diff  --git a/libc/src/threads/linux/thrd_join.cpp b/libc/src/threads/linux/thrd_join.cpp
index 18e6b6fcfa98..c0ad33c8f447 100644
--- a/libc/src/threads/linux/thrd_join.cpp
+++ b/libc/src/threads/linux/thrd_join.cpp
@@ -18,7 +18,7 @@
 
 namespace __llvm_libc {
 
-int LLVM_LIBC_ENTRYPOINT(thrd_join)(thrd_t *thread, int *retval) {
+LLVM_LIBC_FUNCTION(int, thrd_join, (thrd_t * thread, int *retval)) {
   FutexData *clear_tid_address =
       reinterpret_cast<FutexData *>(thread->__clear_tid);
 

diff  --git a/libc/src/time/mktime.cpp b/libc/src/time/mktime.cpp
index 418797158968..c99cf8733223 100644
--- a/libc/src/time/mktime.cpp
+++ b/libc/src/time/mktime.cpp
@@ -42,7 +42,7 @@ static inline time_t outOfRange() {
   return static_cast<time_t>(-1);
 }
 
-time_t LLVM_LIBC_ENTRYPOINT(mktime)(struct tm *t1) {
+LLVM_LIBC_FUNCTION(time_t, mktime, (struct tm * t1)) {
   // Unlike most C Library functions, mktime doesn't just die on bad input.
   // TODO(rtenneti); Handle leap seconds. Handle out of range time and date
   // values that don't overflow or underflow.

diff  --git a/libc/src/unistd/linux/write.cpp b/libc/src/unistd/linux/write.cpp
index 2778346fa5b5..de0efb9bf8de 100644
--- a/libc/src/unistd/linux/write.cpp
+++ b/libc/src/unistd/linux/write.cpp
@@ -15,7 +15,7 @@
 
 namespace __llvm_libc {
 
-ssize_t LLVM_LIBC_ENTRYPOINT(write)(int fd, const void *buf, size_t count) {
+LLVM_LIBC_FUNCTION(ssize_t, write, (int fd, const void *buf, size_t count)) {
   long ret = __llvm_libc::syscall(SYS_write, fd, buf, count);
   if (ret < 0) {
     llvmlibc_errno = -ret;


        


More information about the llvm-branch-commits mailing list