diff --git a/lib/libc/glibc/csu/elf-init-2.33.c b/lib/libc/glibc/csu/elf-init-2.33.c
index b713c8b0fb50..42ce6583fece 100644
--- a/lib/libc/glibc/csu/elf-init-2.33.c
+++ b/lib/libc/glibc/csu/elf-init-2.33.c
@@ -34,6 +34,7 @@
. */
#include
+#include
/* These magic symbols are provided by the linker. */
diff --git a/lib/libc/glibc/sysdeps/generic/elf-initfini.h b/lib/libc/glibc/sysdeps/generic/elf-initfini.h
new file mode 100644
index 000000000000..6630cc8de92e
--- /dev/null
+++ b/lib/libc/glibc/sysdeps/generic/elf-initfini.h
@@ -0,0 +1 @@
+#define NO_INITFINI 1
diff --git a/lib/libc/glibc/sysdeps/generic/sysdep.h b/lib/libc/glibc/sysdeps/generic/sysdep.h
index e77be376f7a8..7caa7d76a95c 100644
--- a/lib/libc/glibc/sysdeps/generic/sysdep.h
+++ b/lib/libc/glibc/sysdeps/generic/sysdep.h
@@ -56,6 +56,12 @@
# define cfi_personality(enc, exp) .cfi_personality enc, exp
# define cfi_lsda(enc, exp) .cfi_lsda enc, exp
+# ifndef __clang__
+# define cfi_label(label) .cfi_label label
+# else
+# define cfi_label(label)
+# endif
+
#else /* ! ASSEMBLER */
# define CFI_STRINGIFY(Name) CFI_STRINGIFY2 (Name)
diff --git a/lib/libc/glibc/sysdeps/riscv/start-2.33.S b/lib/libc/glibc/sysdeps/riscv/start-2.33.S
index 09511b1ef823..8057b4d464ae 100644
--- a/lib/libc/glibc/sysdeps/riscv/start-2.33.S
+++ b/lib/libc/glibc/sysdeps/riscv/start-2.33.S
@@ -45,7 +45,7 @@
ENTRY (ENTRY_POINT)
/* Terminate call stack by noting ra is undefined. Use a dummy
.cfi_label to force starting the FDE. */
- .cfi_label .Ldummy
+ cfi_label (.Ldummy)
cfi_undefined (ra)
call load_gp
mv a5, a0 /* rtld_fini. */
diff --git a/lib/libc/glibc/sysdeps/riscv/start.S b/lib/libc/glibc/sysdeps/riscv/start.S
index 6dfe65273f2e..837031148630 100644
--- a/lib/libc/glibc/sysdeps/riscv/start.S
+++ b/lib/libc/glibc/sysdeps/riscv/start.S
@@ -45,7 +45,7 @@
ENTRY (ENTRY_POINT)
/* Terminate call stack by noting ra is undefined. Use a dummy
.cfi_label to force starting the FDE. */
- .cfi_label .Ldummy
+ cfi_label (.Ldummy)
cfi_undefined (ra)
call load_gp
mv a5, a0 /* rtld_fini. */
diff --git a/lib/libc/include/riscv64-linux-gnu/gnu/stubs-lp64d.h b/lib/libc/include/riscv64-linux-gnu/gnu/stubs-lp64d.h
new file mode 100644
index 000000000000..0ba0dd8b5434
--- /dev/null
+++ b/lib/libc/include/riscv64-linux-gnu/gnu/stubs-lp64d.h
@@ -0,0 +1,24 @@
+/* This file is automatically generated.
+ It defines a symbol `__stub_FUNCTION' for each function
+ in the C library which is a stub, meaning it will fail
+ every time called, usually setting errno to ENOSYS. */
+
+#ifdef _LIBC
+# error Applications may not define the macro _LIBC
+#endif
+
+#define __stub___compat_bdflush
+#define __stub___compat_create_module
+#define __stub___compat_get_kernel_syms
+#define __stub___compat_query_module
+#define __stub___compat_uselib
+#define __stub_chflags
+#define __stub_fchflags
+#define __stub_fedisableexcept
+#define __stub_feenableexcept
+#define __stub_fegetexcept
+#define __stub_gtty
+#define __stub_revoke
+#define __stub_setlogin
+#define __stub_sigreturn
+#define __stub_stty