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 a0617177e84942ba4e2778147d589b7374e9e980
Author: Gustavo Henrique Nihei <gustavo.ni...@espressif.com>
AuthorDate: Fri Mar 25 18:18:16 2022 -0300

    risc-v/esp32c3: Fix inclusion of C++ constructors/destructors table
    
    RISC-V GCC is configured with --enable-initfini-array so it emits an
    .init_array section instead of .ctors
    
    Signed-off-by: Gustavo Henrique Nihei <gustavo.ni...@espressif.com>
---
 boards/risc-v/esp32c3/esp32c3-devkit/scripts/esp32c3.ld | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/scripts/esp32c3.ld 
b/boards/risc-v/esp32c3/esp32c3-devkit/scripts/esp32c3.ld
index 8910d4c..f5f48fa 100644
--- a/boards/risc-v/esp32c3/esp32c3-devkit/scripts/esp32c3.ld
+++ b/boards/risc-v/esp32c3/esp32c3-devkit/scripts/esp32c3.ld
@@ -161,13 +161,14 @@ SECTIONS
     KEEP(*(.eh_frame))
     . = (. + 7) & ~ 3;
 
-    /* C++ constructor and destructor tables: */
+    /* C++ constructor and destructor tables:
+     * RISC-V GCC is configured with --enable-initfini-array so it emits an
+     * .init_array section instead.
+     */
 
     _sinit = ABSOLUTE(.);
-    KEEP (*crtbegin.o(.ctors))
-    KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
-    KEEP (*(SORT(.ctors.*)))
-    KEEP (*(.ctors))
+    KEEP (*(EXCLUDE_FILE (*crtend.* *crtbegin.*) .init_array.*))
+    KEEP (*(EXCLUDE_FILE (*crtend.* *crtbegin.*) .init_array))
     _einit = ABSOLUTE(.);
     KEEP (*crtbegin.o(.dtors))
     KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))

Reply via email to