summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSathees Balya <sathees.balya@arm.com>2018-10-18 19:14:21 +0100
committerSathees Balya <sathees.balya@arm.com>2018-11-22 17:26:57 +0000
commit6baf85b3e01a6c8295a53798bd92e26d517a4196 (patch)
tree13c635bbe86e4419489d00ca8f04a855bf6aac4f
parentc385955764f1bbd297c233d727d3ecc1c161163a (diff)
romlib: Allow patching of romlib functions
This change allows patching of functions in the romlib. This can be done by adding "patch" at the end of the jump table entry for the function that needs to be patched in the file jmptbl.i. Functions patched in the jump table list will be built as part of the BL image and the romlib version will not be used Change-Id: Iefb200cb86e2a4b61ad3ee6180d3ecc39bad537f Signed-off-by: Sathees Balya <sathees.balya@arm.com>
-rwxr-xr-xlib/romlib/genwrappers.sh2
-rw-r--r--lib/romlib/jmptbl.i6
-rw-r--r--make_helpers/build_macros.mk4
3 files changed, 8 insertions, 4 deletions
diff --git a/lib/romlib/genwrappers.sh b/lib/romlib/genwrappers.sh
index bcf670b9..48ee5a43 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 338cd8a7..5e33e0e1 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 e186fc10..d60a5bf0 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 $$@"