You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2024/06/13 02:21:23 UTC

(nuttx) 02/04: Add flags for building shared objects for architectures supporting dynamic loading

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

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

commit 5033966d8ce3f51f441562b5b458f687cf7a13ed
Author: Neale Ferguson <ne...@sinenomine.net>
AuthorDate: Mon Oct 9 16:36:02 2023 -0400

    Add flags for building shared objects for architectures supporting dynamic loading
    
    * arch/arm/src/common/Toolchain.defs
      arch/risc-v/src/common/Toolchain.defs
      boards/sim/sim/sim/scripts/Make.defs
      - Add SHCCFLAGS and SSHLDFLAGS
---
 arch/arm/src/common/Toolchain.defs    | 11 ++++++++++-
 arch/risc-v/src/common/Toolchain.defs | 11 ++++++++++-
 boards/sim/sim/sim/scripts/Make.defs  |  5 ++++-
 3 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/arch/arm/src/common/Toolchain.defs b/arch/arm/src/common/Toolchain.defs
index c78a14a01b..e64f23f95a 100644
--- a/arch/arm/src/common/Toolchain.defs
+++ b/arch/arm/src/common/Toolchain.defs
@@ -408,4 +408,13 @@ include $(TOPDIR)/tools/Rust.defs
 
 # LDC (LLVM D Compiler) toolchain
 
-include $(TOPDIR)/tools/D.defs
\ No newline at end of file
+include $(TOPDIR)/tools/D.defs
+
+# Shared library build flags
+
+SHCCFLAGS = -fPIC -fPIE -fvisibility=default
+SHLDFLAGS = -shared -Bsymbolic -Bdynamic -G
+
+ifeq ($(CONFIG_SIM_M32),y)
+  SHLDFLAGS += -melf_i386
+endif
diff --git a/arch/risc-v/src/common/Toolchain.defs b/arch/risc-v/src/common/Toolchain.defs
index 0d1f279f4a..41beb62335 100644
--- a/arch/risc-v/src/common/Toolchain.defs
+++ b/arch/risc-v/src/common/Toolchain.defs
@@ -402,4 +402,13 @@ include $(TOPDIR)/tools/Rust.defs
 
 # LDC (LLVM D Compiler) toolchain
 
-include $(TOPDIR)/tools/D.defs
\ No newline at end of file
+include $(TOPDIR)/tools/D.defs
+
+# Shared library build flags
+
+SHCCFLAGS = -fPIC -fPIE -fvisibility=default
+SHLDFLAGS = -shared -Bsymbolic -Bdynamic -G
+
+ifeq ($(CONFIG_SIM_M32),y)
+  SHLDFLAGS += -melf_i386
+endif
diff --git a/boards/sim/sim/sim/scripts/Make.defs b/boards/sim/sim/sim/scripts/Make.defs
index 651600867c..387e13814f 100644
--- a/boards/sim/sim/sim/scripts/Make.defs
+++ b/boards/sim/sim/sim/scripts/Make.defs
@@ -289,10 +289,13 @@ ifeq ($(CONFIG_DEBUG_LINK_MAP),y)
   endif
 endif
 
+SHCCFLAGS = -fPIC -fPIE -fvisibility=default
+SHLDFLAGS = -shared -Bsymbolic -Bdynamic -G
+
 ifeq ($(CONFIG_SIM_M32),y)
   LDLINKFLAGS += -melf_i386
   LDFLAGS += -m32
   LDMODULEFLAGS += -melf_i386
-  SHMODULEFLAGS += -melf_i386
+  SHLDFLAGS += -melf_i386
   LDELFFLAGS += -melf_i386
 endif