You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2020/09/09 09:04:49 UTC

[incubator-nuttx] 02/03: sim/Make.defs: add -fvisibility=hidden to CFLAGS

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 21cff9fc4fcec80b321c7a0d507d40ba34b4148e
Author: ligd <li...@xiaomi.com>
AuthorDate: Wed Sep 2 10:35:37 2020 +0800

    sim/Make.defs: add -fvisibility=hidden to CFLAGS
    
    This can hidden all nuttx's symbols,
    and DO NOT export nuttx's symbols to share libraries.
    
    e.g.
    wrong:
    
    NUTTX       PC       NUTTX
    ffmpeg -> asound -> sysconf
    
    right:
    
    NUTTX       PC       PC
    ffmpeg -> asound -> sysconf
    
    Signed-off-by: ligd <li...@xiaomi.com>
---
 boards/sim/sim/sim/scripts/Make.defs | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/boards/sim/sim/sim/scripts/Make.defs b/boards/sim/sim/sim/scripts/Make.defs
index 179da75..d374c90 100644
--- a/boards/sim/sim/sim/scripts/Make.defs
+++ b/boards/sim/sim/sim/scripts/Make.defs
@@ -41,6 +41,16 @@ ARCHPICFLAGS = -fpic
 ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
 ARCHWARNINGSXX = -Wall -Wshadow -Wundef
 
+# Add -fvisibility=hidden
+# Because we don't want export nuttx's symbols to share libraries
+
+ARCHCPUFLAGS += -fvisibility=hidden
+ARCHCPUFLAGSXX += -fvisibility=hidden
+
+ifeq ($(CONFIG_HOST_MACOS),y)
+  LDLINKFLAGS += -keep_private_externs
+endif
+
 # Add -fno-common because macOS "ld -r" doesn't seem to pick objects
 # for common symbols.
 ARCHCPUFLAGS += -fno-common