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 2022/05/12 15:12:44 UTC

[incubator-nuttx-apps] 01/08: Use -fno-builtin for SYMTABOBJ

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-apps.git

commit 5ee2e6348f0b0cb9b57d449410e7e75d47bc81b1
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Wed Apr 6 12:24:16 2022 +0900

    Use -fno-builtin for SYMTABOBJ
    
    The code generated by tools/mksymtab.sh uses
    ```
    extern void *var;
    ```
    for ~everything.
    
    After the recent removal of -fno-builtin, [1]
    it ends up with warnings:
    * -Wbuiltin-requires-header for clang
    * -Wbuiltin-declaration-mismatch for gcc
    
    It also generates errors like the following for clang:
    ```
    symtab_apps.c:125:14: error: redefinition of 'strdup' as different kind of symbol
    extern void *strdup;
    ```
    I couldn't find a way to disable it.
    (it's err_redefinition_different_kind in clang source)
    
    This commit works it around by restoring -fno-builtin
    when building SYMTABOBJ.
    
    [1] https://github.com/apache/incubator-nuttx/pull/5476
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index f33a9cffc..e6ddb1633 100644
--- a/Makefile
+++ b/Makefile
@@ -98,7 +98,7 @@ $(SYMTABSRC): $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_all)
 	$(Q) $(call TESTANDREPLACEFILE, $@.tmp, $@)
 
 $(SYMTABOBJ): %$(OBJEXT): %.c
-	$(call COMPILE, -fno-lto $<, $@)
+	$(call COMPILE, -fno-lto -fno-builtin $<, $@)
 
 $(BIN): $(SYMTABOBJ)
 	$(call ARCHIVE_ADD, $(call CONVERT_PATH,$(BIN)), $^)