[sw] Conditionally Provide Some libc Symbols

`memory.h` provides some symbols which are also provided by libc. When
these are used by DIFs, we would prefer to use the host's libc
implementations rather than our own.

This approach is used so that DIFs can depend on `memory.h`, but also be
built for host-side software.

OpenTitan does not access volatile memory using the `memory.h` functions
-- volatile memory must be accessed via the functions in `mmio.h` -- so
this should not affect the functionality of any tests.

Closes #1806.

Signed-off-by: Sam Elliott <selliott@lowrisc.org>
diff --git a/meson.build b/meson.build
index 3ecfccc..452061b 100644
--- a/meson.build
+++ b/meson.build
@@ -91,6 +91,14 @@
   c_cpp_cross_link_args,
   language: ['c', 'cpp'], native: false)
 
+# The following flags are applied only to native builds
+c_cpp_native_args = [
+  # Use a define to exclude libc redefinitions.
+  '-DHOST_BUILD',
+]
+add_project_arguments(
+  c_cpp_native_args,
+  language: ['c', 'cpp'], native: true)
 
 # Common program references.
 prog_python = import('python').find_installation('python3')