diff --git a/lib/romlib/genwrappers.sh b/lib/romlib/genwrappers.sh
index bcf670b980fefde374d3866617fe3fb1d06521ae..48ee5a43b438ace4753aaa96766ccdf40dc01bd6 100755
--- a/lib/romlib/genwrappers.sh
+++ b/lib/romlib/genwrappers.sh
@@ -31,7 +31,7 @@ do
 done
 
 awk  '{sub(/[:blank:]*#.*/,"")}
-!/^$/ {print $1*4, $2, $3}' "$@" |
+!/^$/ && !/\\tpatch$/ {print $1*4, $2, $3}' "$@" |
 while read idx lib sym
 do
 	file=$build/${lib}_$sym
diff --git a/lib/romlib/jmptbl.i b/lib/romlib/jmptbl.i
index 338cd8a7143d078ff2a173a67157fbfe37544f99..5e33e0e1b1c6bc065727a9a1d8d389d116bcd1fb 100644
--- a/lib/romlib/jmptbl.i
+++ b/lib/romlib/jmptbl.i
@@ -3,6 +3,10 @@
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
+# Format:
+# index	lib	function	[patch]
+# Add "patch" at the end of the line to patch a function. For example:
+# 14	mbedtls	mbedtls_memory_buffer_alloc_init	patch
 
 0	rom	rom_lib_init
 1	fdt	fdt_getprop_namelen
@@ -32,4 +36,4 @@
 25	mbedtls	mbedtls_x509_get_sig_alg
 26	mbedtls	mbedtls_md_info_from_type
 27	c	exit
-28	c	atexit
+28	c	atexit
\ No newline at end of file
diff --git a/make_helpers/build_macros.mk b/make_helpers/build_macros.mk
index e186fc100019064b64abe04316443398fb2b08f7..d60a5bf0ee8dc9d1629f197922d213e6f081e2f7 100644
--- a/make_helpers/build_macros.mk
+++ b/make_helpers/build_macros.mk
@@ -338,7 +338,7 @@ LDPATHS = -L${LIB_DIR}
 LDLIBS += -l$(1)
 
 ifeq ($(USE_ROMLIB),1)
-LDLIBS := -lwrappers -lc
+LIBWRAPPER = -lwrappers
 endif
 
 all: ${LIB_DIR}/lib$(1).a
@@ -402,7 +402,7 @@ else
 endif
 	$$(Q)$$(LD) -o $$@ $$(TF_LDFLAGS) $$(LDFLAGS) -Map=$(MAPFILE) \
 		--script $(LINKERFILE) $(BUILD_DIR)/build_message.o \
-		$(OBJS) $(LDPATHS) $(LDLIBS) $(BL_LIBS)
+		$(OBJS) $(LDPATHS) $(LIBWRAPPER) $(LDLIBS) $(BL_LIBS)
 
 $(DUMP): $(ELF)
 	$${ECHO} "  OD      $$@"