[MERGED] osmo-pcu[master]: TBF: override send function via linker option

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Jan 26 02:31:11 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: TBF: override send function via linker option
......................................................................


TBF: override send function via linker option

Use --wrap linker facility to override pcu_sock_send() similar to other
Osmo* projects.

Change-Id: Ia3d436bd3d1fb0ce8e98526bd7457f4c57667ceb
---
M tests/Makefile.am
M tests/tbf/TbfTest.cpp
2 files changed, 4 insertions(+), 1 deletion(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/tests/Makefile.am b/tests/Makefile.am
index 1595a07..e82647f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -33,6 +33,7 @@
 	$(LIBOSMOGSM_LIBS) \
 	$(LIBOSMOCORE_LIBS) \
 	$(COMMON_LA)
+tbf_TbfTest_LDFLAGS = -Wl,--wrap=pcu_sock_send
 
 bitcomp_BitcompTest_SOURCES = bitcomp/BitcompTest.cpp ../src/egprs_rlc_compression.cpp
 bitcomp_BitcompTest_LDADD = \
diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp
index 46863e3..aa1d7ac 100644
--- a/tests/tbf/TbfTest.cpp
+++ b/tests/tbf/TbfTest.cpp
@@ -137,7 +137,9 @@
 
 static uint8_t llc_data[200];
 
-int pcu_sock_send(struct msgb *msg)
+/* override, requires '-Wl,--wrap=pcu_sock_send' */
+int __real_pcu_sock_send(struct msgb *msg);
+int __wrap_pcu_sock_send(struct msgb *msg)
 {
 	return 0;
 }

-- 
To view, visit https://gerrit.osmocom.org/6077
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia3d436bd3d1fb0ce8e98526bd7457f4c57667ceb
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list