You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/02/20 14:33:20 UTC

[GitHub] [incubator-nuttx] pkarashchenko commented on a change in pull request #5553: boards: Add -fno-common to ARCHCFLAGS and ARCHCXXFLAGS

pkarashchenko commented on a change in pull request #5553:
URL: https://github.com/apache/incubator-nuttx/pull/5553#discussion_r810633316



##########
File path: boards/arm/stm32f7/stm32f746g-disco/scripts/Make.defs
##########
@@ -30,14 +30,14 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
   ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
 endif
 
-ARCHCFLAGS = -fno-builtin
-ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new -fno-rtti
+ARCHCFLAGS = -fno-common -fno-builtin
+ARCHCXXFLAGS = -fno-common -fno-builtin -fno-exceptions -fcheck-new -fno-rtti
 
 ifeq ($(CONFIG_ARMV7M_TOOLCHAIN_CLANGL),y)
-  ARCHCFLAGS += -nostdlib -ffreestanding
-  ARCHCXXFLAGS += -nostdlib -ffreestanding
+  ARCHCFLAGS += -fno-common -nostdlib -ffreestanding
+  ARCHCXXFLAGS += -fno-common -nostdlib -ffreestanding
 else
-  ARCHCXXFLAGS += -fno-rtti
+  ARCHCXXFLAGS += -fno-common -fno-rtti

Review comment:
       It's strange that `-fno-rtti` is here conditionally and at line 34 unconditionally.

##########
File path: boards/mips/pic32mz/pic32mz-starterkit/scripts/Make.defs
##########
@@ -59,14 +59,14 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
   ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
 endif
 
-ARCHCFLAGS = -fno-builtin
-ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new
+ARCHCFLAGS = -fno-common -fno-builtin
+ARCHCXXFLAGS = -fno-common -fno-builtin -fno-exceptions -fcheck-new
 ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
 ARCHWARNINGSXX = -Wall -Wshadow -Wundef
 
 ifeq ($(CONFIG_MIPS32_TOOLCHAIN_MICROCHIPL_XC32),y)
 ifeq ($(CONFIG_DEBUG_FEATURES),y)
-  ARCHCFLAGS += -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -fframe-base-loclist
+  ARCHCFLAGS += -fno-common -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -fframe-base-loclist

Review comment:
       ```suggestion
     ARCHCFLAGS += -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -fframe-base-loclist
   ```

##########
File path: boards/arm/stm32/nucleo-f446re/scripts/Make.defs
##########
@@ -35,14 +35,14 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
   ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
 endif
 
-ARCHCFLAGS = -fno-builtin
-ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new
+ARCHCFLAGS = -fno-common -fno-builtin
+ARCHCXXFLAGS = -fno-common -fno-builtin -fno-exceptions -fcheck-new
 
 ifeq ($(CONFIG_ARMV7M_TOOLCHAIN_CLANGL),y)
-  ARCHCFLAGS += -nostdlib -ffreestanding
-  ARCHCXXFLAGS += -nostdlib -ffreestanding
+  ARCHCFLAGS += -fno-common -nostdlib -ffreestanding
+  ARCHCXXFLAGS += -fno-common -nostdlib -ffreestanding

Review comment:
       ```suggestion
     ARCHCFLAGS += -nostdlib -ffreestanding
     ARCHCXXFLAGS += -nostdlib -ffreestanding
   ```

##########
File path: boards/arm/stm32/stm32f4discovery/configs/cxxtest/Make.defs
##########
@@ -33,7 +33,7 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
   ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
 endif
 
-ARCHCFLAGS = -fno-builtin
+ARCHCFLAGS = -fno-common -fno-builtin
 ifeq ($(CONFIG_CXX_EXCEPTION),y)
   ARCHCPUFLAGSXX = -fno-builtin

Review comment:
       ```suggestion
     ARCHCPUFLAGSXX = -fno-common -fno-builtin
   ```
   and same for `else` case

##########
File path: boards/risc-v/bl602/bl602evb/scripts/Make.defs
##########
@@ -48,7 +48,7 @@ ARCHWARNINGSXX = -Wall -Wshadow -Wundef
 ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
 
 ifeq ($(CONFIG_STACK_OVERFLOW_CHECK),y)
-  ARCHCFLAGS += -finstrument-functions -ffixed-s11
+  ARCHCFLAGS += -fno-common -finstrument-functions -ffixed-s11

Review comment:
       ```suggestion
     ARCHCFLAGS += -finstrument-functions -ffixed-s11
   ```

##########
File path: boards/arm/lpc43xx/bambino-200e/configs/netnsh/Make.defs
##########
@@ -50,7 +50,7 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
   ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
 endif
 
-ARCHCFLAGS = -fno-builtin
+ARCHCFLAGS = -fno-common -fno-builtin
 ifeq ($(CONFIG_CXX_EXCEPTION),y)
   ARCHCPUFLAGSXX = -fno-builtin

Review comment:
       ```suggestion
     ARCHCPUFLAGSXX = -fno-common -fno-builtin
   ```
   and for `else` case

##########
File path: boards/arm/stm32/stm32f4discovery/scripts/Make.defs
##########
@@ -34,18 +34,18 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
   ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
 endif
 
-ARCHCFLAGS = -fno-builtin
-ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new
+ARCHCFLAGS = -fno-common -fno-builtin
+ARCHCXXFLAGS = -fno-common -fno-builtin -fno-exceptions -fcheck-new
 ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
 ARCHWARNINGSXX = -Wall -Wshadow -Wundef
 ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
 
 ifeq ($(CONFIG_ARMV7M_TOOLCHAIN_CLANGL),y)
-  ARCHCFLAGS += -nostdlib -ffreestanding
-  ARCHCXXFLAGS += -nostdlib -ffreestanding
+  ARCHCFLAGS += -fno-common -nostdlib -ffreestanding
+  ARCHCXXFLAGS += -fno-common -nostdlib -ffreestanding

Review comment:
       ```suggestion
     ARCHCFLAGS += -nostdlib -ffreestanding
     ARCHCXXFLAGS += -nostdlib -ffreestanding
   ```

##########
File path: boards/arm/stm32/stm32f4discovery/configs/testlibcxx/Make.defs
##########
@@ -34,7 +34,7 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
   ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
 endif
 
-ARCHCFLAGS = -fno-builtin
+ARCHCFLAGS = -fno-common -fno-builtin
 ifeq ($(CONFIG_CXX_EXCEPTION),y)
   ARCHCPUFLAGSXX = -fno-builtin

Review comment:
       ```suggestion
     ARCHCPUFLAGSXX = -fno-common -fno-builtin
   ```
   and same for `else` case

##########
File path: boards/mips/pic32mz/flipnclick-pic32mz/scripts/Make.defs
##########
@@ -59,14 +59,14 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
   ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
 endif
 
-ARCHCFLAGS = -fno-builtin
-ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new
+ARCHCFLAGS = -fno-common -fno-builtin
+ARCHCXXFLAGS = -fno-common -fno-builtin -fno-exceptions -fcheck-new
 ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
 ARCHWARNINGSXX = -Wall -Wshadow -Wundef
 
 ifeq ($(CONFIG_MIPS32_TOOLCHAIN_MICROCHIPL_XC32),y)
 ifeq ($(CONFIG_DEBUG_FEATURES),y)
-  ARCHCFLAGS += -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -fframe-base-loclist
+  ARCHCFLAGS += -fno-common -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -fframe-base-loclist

Review comment:
       ```suggestion
     ARCHCFLAGS += -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -fframe-base-loclist
   ```

##########
File path: boards/arm/stm32/stm32f4discovery/scripts/Make.defs
##########
@@ -34,18 +34,18 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
   ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
 endif
 
-ARCHCFLAGS = -fno-builtin
-ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new
+ARCHCFLAGS = -fno-common -fno-builtin
+ARCHCXXFLAGS = -fno-common -fno-builtin -fno-exceptions -fcheck-new
 ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
 ARCHWARNINGSXX = -Wall -Wshadow -Wundef
 ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
 
 ifeq ($(CONFIG_ARMV7M_TOOLCHAIN_CLANGL),y)
-  ARCHCFLAGS += -nostdlib -ffreestanding
-  ARCHCXXFLAGS += -nostdlib -ffreestanding
+  ARCHCFLAGS += -fno-common -nostdlib -ffreestanding
+  ARCHCXXFLAGS += -fno-common -nostdlib -ffreestanding
 else
-  ARCHCFLAGS += -funwind-tables
-  ARCHCXXFLAGS += -fno-rtti -funwind-tables
+  ARCHCFLAGS += -fno-common -funwind-tables
+  ARCHCXXFLAGS += -fno-common -fno-rtti -funwind-tables

Review comment:
       ```suggestion
     ARCHCFLAGS += -funwind-tables
     ARCHCXXFLAGS += -fno-rtti -funwind-tables
   ```

##########
File path: boards/xtensa/esp32s2/esp32s2-saola-1/scripts/Make.defs
##########
@@ -46,16 +46,16 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
   ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
 endif
 
-ARCHCFLAGS = -fno-builtin -ffunction-sections -fdata-sections -mlongcalls
-ARCHCXXFLAGS = $(ARCHCFLAGS) -fno-exceptions -fcheck-new -fno-rtti
+ARCHCFLAGS = -fno-common -fno-builtin -ffunction-sections -fdata-sections -mlongcalls
+ARCHCXXFLAGS = -fno-common $(ARCHCFLAGS) -fno-exceptions -fcheck-new -fno-rtti
 ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
 ARCHWARNINGSXX = -Wall -Wshadow -Wundef
 ARCHPICFLAGS = -fpic
 
 # if SPIRAM/PSRAM is used then we need to include a workaround
 
 ifeq ($(CONFIG_ESP32S2_SPIRAM),y)
-  ARCHCFLAGS += -mfix-esp32s2-psram-cache-issue
+  ARCHCFLAGS += -fno-common -mfix-esp32s2-psram-cache-issue

Review comment:
       ```suggestion
     ARCHCFLAGS += -mfix-esp32s2-psram-cache-issue
   ```

##########
File path: boards/mips/pic32mz/chipkit-wifire/scripts/Make.defs
##########
@@ -59,14 +59,14 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
   ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
 endif
 
-ARCHCFLAGS = -fno-builtin
-ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new
+ARCHCFLAGS = -fno-common -fno-builtin
+ARCHCXXFLAGS = -fno-common -fno-builtin -fno-exceptions -fcheck-new
 ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
 ARCHWARNINGSXX = -Wall -Wshadow -Wundef
 
 ifeq ($(CONFIG_MIPS32_TOOLCHAIN_MICROCHIPL_XC32),y)
 ifeq ($(CONFIG_DEBUG_FEATURES),y)
-  ARCHCFLAGS += -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -fframe-base-loclist
+  ARCHCFLAGS += -fno-common -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -fframe-base-loclist

Review comment:
       ```suggestion
     ARCHCFLAGS += -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -fframe-base-loclist
   ```

##########
File path: boards/xtensa/esp32s3/esp32s3-devkit/scripts/Make.defs
##########
@@ -36,8 +36,8 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
   ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce
 endif
 
-ARCHCFLAGS = -fno-builtin -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -mlongcalls
-ARCHCXXFLAGS = $(ARCHCFLAGS) -fno-exceptions -fcheck-new -fno-rtti
+ARCHCFLAGS = -fno-common -fno-builtin -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -mlongcalls
+ARCHCXXFLAGS = -fno-common $(ARCHCFLAGS) -fno-exceptions -fcheck-new -fno-rtti

Review comment:
       ```suggestion
   ARCHCXXFLAGS = $(ARCHCFLAGS) -fno-exceptions -fcheck-new -fno-rtti
   ```

##########
File path: boards/arm/sam34/sam4cmp-db/scripts/Make.defs
##########
@@ -32,8 +32,8 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
   ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
 endif
 
-ARCHCFLAGS = -fno-builtin
-ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new
+ARCHCFLAGS = -fno-common -fno-builtin
+ARCHCXXFLAGS = -fno-common -fno-builtin -fno-exceptions -fcheck-new

Review comment:
       Note: strange that `boards/arm/sam34/sam3u-ek/scripts/Make.defs` has `-fno-rtti` and here we do not have it. The same in other files. This is not related to this PR, but notice in general. Maybe we should have a separate PR to unify `-fno-rtti` usage

##########
File path: boards/arm/stm32/nucleo-f446re/scripts/Make.defs
##########
@@ -35,14 +35,14 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
   ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
 endif
 
-ARCHCFLAGS = -fno-builtin
-ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new
+ARCHCFLAGS = -fno-common -fno-builtin
+ARCHCXXFLAGS = -fno-common -fno-builtin -fno-exceptions -fcheck-new
 
 ifeq ($(CONFIG_ARMV7M_TOOLCHAIN_CLANGL),y)
-  ARCHCFLAGS += -nostdlib -ffreestanding
-  ARCHCXXFLAGS += -nostdlib -ffreestanding
+  ARCHCFLAGS += -fno-common -nostdlib -ffreestanding
+  ARCHCXXFLAGS += -fno-common -nostdlib -ffreestanding
 else
-  ARCHCXXFLAGS += -fno-rtti
+  ARCHCXXFLAGS += -fno-common -fno-rtti

Review comment:
       ```suggestion
     ARCHCXXFLAGS += -fno-rtti
   ```

##########
File path: boards/arm/kinetis/teensy-3.x/src/k20_i2c.c
##########
@@ -53,7 +53,7 @@
 
 void kinetis_i2cdev_initialize(void)
 {
-  i2c_dev = NULL;
+  FAR struct i2c_master_s *i2c_dev = NULL;

Review comment:
       Great finding!

##########
File path: boards/arm/kinetis/teensy-3.x/src/teensy-3x.h
##########
@@ -55,16 +55,6 @@
 
 #define GPIO_LED          (GPIO_HIGHDRIVE | GPIO_OUTPUT_ZERO | PIN_PORTC | PIN5)
 
-/****************************************************************************
- * Public Types
- ****************************************************************************/
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-FAR struct i2c_master_s *i2c_dev;

Review comment:
       Great finding!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org