Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/share/mk Add a framework for renaming symbols in libc&co for...



details:   https://anonhg.NetBSD.org/src/rev/1094577bbe89
branches:  trunk
changeset: 833444:1094577bbe89
user:      kamil <kamil%NetBSD.org@localhost>
date:      Mon Jun 25 17:58:36 2018 +0000

description:
Add a framework for renaming symbols in libc&co for MKSANITIZER

A new keyword SANITIZER_RENAME_SYMBOL. It's a variable that has specified
a list of symbols to be renamed in a processor in order to remove naming
conflicts with public symbols in libc/m/pthread/rt.

This renaming will occur for libraries and programs.
A symbol with a conflicting 'name', will be renamed to '__mksanitizer_name'.

Based on an idea by <christos>

diffstat:

 share/mk/bsd.lib.mk  |  10 +++++++++-
 share/mk/bsd.prog.mk |   9 ++++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)

diffs (45 lines):

diff -r e41ab993e5ab -r 1094577bbe89 share/mk/bsd.lib.mk
--- a/share/mk/bsd.lib.mk       Mon Jun 25 17:42:34 2018 +0000
+++ b/share/mk/bsd.lib.mk       Mon Jun 25 17:58:36 2018 +0000
@@ -1,9 +1,17 @@
-#      $NetBSD: bsd.lib.mk,v 1.375 2018/06/21 11:24:38 kamil Exp $
+#      $NetBSD: bsd.lib.mk,v 1.376 2018/06/25 17:58:36 kamil Exp $
 #      @(#)bsd.lib.mk  8.3 (Berkeley) 4/22/94
 
 .include <bsd.init.mk>
 .include <bsd.shlib.mk>
 .include <bsd.gcc.mk>
+
+# Rename the local function definitions to not conflict with libc/rt/pthread/m.
+.if ${MKSANITIZER:Uno} == "yes" && defined(SANITIZER_RENAME_SYMBOL)
+.      for _symbol in ${SANITIZER_RENAME_SYMBOL}
+CPPFLAGS+=     -D${_symbol}=__mksanitizer_${_symbol}
+.      endfor
+.endif
+
 # Pull in <bsd.sys.mk> here so we can override its .c.o rule
 .include <bsd.sys.mk>
 
diff -r e41ab993e5ab -r 1094577bbe89 share/mk/bsd.prog.mk
--- a/share/mk/bsd.prog.mk      Mon Jun 25 17:42:34 2018 +0000
+++ b/share/mk/bsd.prog.mk      Mon Jun 25 17:58:36 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.prog.mk,v 1.314 2018/06/21 11:24:38 kamil Exp $
+#      $NetBSD: bsd.prog.mk,v 1.315 2018/06/25 17:58:36 kamil Exp $
 #      @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94
 
 .ifndef HOSTPROG
@@ -13,6 +13,13 @@
 CXXFLAGS+=     ${SANITIZERFLAGS}
 LDFLAGS+=      ${SANITIZERFLAGS}
 
+# Rename the local function definitions to not conflict with libc/rt/pthread/m.
+.if ${MKSANITIZER:Uno} == "yes" && defined(SANITIZER_RENAME_SYMBOL)
+.      for _symbol in ${SANITIZER_RENAME_SYMBOL}
+CPPFLAGS+=     -D${_symbol}=__mksanitizer_${_symbol}
+.      endfor
+.endif
+
 #
 # Definitions and targets shared among all programs built by a single
 # Makefile.



Home | Main Index | Thread Index | Old Index