Skip to contentSkip to conversation

package/gcc: pass -Wno-error to debug builds

PATCH New James Hilliard 3 participants 4 messages Feb 4, 2020 – Mar 23, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/gcc: pass -Wno-error to debug builds

Fixes:
../../../../libsanitizer/libbacktrace/../../libbacktrace/elf.c:772:21: error: ?st.st_mode? may be used uninitialized in this function [-Werror=maybe-uninitialized]

   return S_ISLNK (st.st_mode);
                     ^
---
 package/gcc/gcc.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/gcc/gcc.mk +4 -0
index 527f30bf22..badf358707 100644
@@ -103,6 +103,10 @@ HOST_GCC_COMMON_CONF_ENV = \
 GCC_COMMON_TARGET_CFLAGS = $(TARGET_CFLAGS)
 GCC_COMMON_TARGET_CXXFLAGS = $(TARGET_CXXFLAGS)
 
+ifeq ($(BR2_ENABLE_DEBUG),y)
+GCC_COMMON_TARGET_CFLAGS += -Wno-error
+endif
+
 # Propagate options used for target software building to GCC target libs
 HOST_GCC_COMMON_CONF_ENV += CFLAGS_FOR_TARGET="$(GCC_COMMON_TARGET_CFLAGS)"
 HOST_GCC_COMMON_CONF_ENV += CXXFLAGS_FOR_TARGET="$(GCC_COMMON_TARGET_CXXFLAGS)"
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 package/gcc: pass -Wno-error to debug builds

Hi James,

Le 04/02/2020 ? 01:10, James Hilliard a ?crit?:

Quoted 5 lines

Fixes:
../../../../libsanitizer/libbacktrace/../../libbacktrace/elf.c:772:21: error: ?st.st_mode? may be used uninitialized in this function [-Werror=maybe-uninitialized]

   return S_ISLNK (st.st_mode);
                     ^

Can you provide a defconfig that allow to reproduce the issue.

Thanks!

Best regards,
Romain

Quoted 21 lines
---
 package/gcc/gcc.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/gcc/gcc.mk +4 -0
index 527f30bf22..badf358707 100644
@@ -103,6 +103,10 @@ HOST_GCC_COMMON_CONF_ENV = \
 GCC_COMMON_TARGET_CFLAGS = $(TARGET_CFLAGS)
 GCC_COMMON_TARGET_CXXFLAGS = $(TARGET_CXXFLAGS)
 
+ifeq ($(BR2_ENABLE_DEBUG),y)
+GCC_COMMON_TARGET_CFLAGS += -Wno-error
+endif
+
 # Propagate options used for target software building to GCC target libs
 HOST_GCC_COMMON_CONF_ENV += CFLAGS_FOR_TARGET="$(GCC_COMMON_TARGET_CFLAGS)"
 HOST_GCC_COMMON_CONF_ENV += CXXFLAGS_FOR_TARGET="$(GCC_COMMON_TARGET_CXXFLAGS)"
#2 lore raw

PATCH 1/1 package/gcc: pass -Wno-error to debug builds

Quoted 11 lines · Romain Naour

Hi James,

Le 04/02/2020 ? 01:10, James Hilliard a ?crit :

Quoted 5 lines

Fixes:
../../../../libsanitizer/libbacktrace/../../libbacktrace/elf.c:772:21: error: ?st.st_mode? may be used uninitialized in this function [-Werror=maybe-uninitialized]

   return S_ISLNK (st.st_mode);
                     ^

Can you provide a defconfig that allow to reproduce the issue.

BR2_ENABLE_DEBUG=y
BR2_DEBUG_3=y
BR2_OPTIMIZE_G=y
BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_PACKAGE_HOST_GDB=y
BR2_GDB_VERSION_8_3=y

FYI this fix was adapted from openembedded:
https://github.com/openembedded/openembedded-core/blob/d3083e941578fb343454e106eba349adcc525ad3/meta/recipes-devtools/gcc/gcc-sanitizers.inc#L48-L49

Quoted 29 lines

Thanks!

Best regards,
Romain

Quoted 21 lines
---
 package/gcc/gcc.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/gcc/gcc.mk +4 -0
index 527f30bf22..badf358707 100644
@@ -103,6 +103,10 @@ HOST_GCC_COMMON_CONF_ENV = \
 GCC_COMMON_TARGET_CFLAGS = $(TARGET_CFLAGS)
 GCC_COMMON_TARGET_CXXFLAGS = $(TARGET_CXXFLAGS)
 
+ifeq ($(BR2_ENABLE_DEBUG),y)
+GCC_COMMON_TARGET_CFLAGS += -Wno-error
+endif
+
 # Propagate options used for target software building to GCC target libs
 HOST_GCC_COMMON_CONF_ENV += CFLAGS_FOR_TARGET="$(GCC_COMMON_TARGET_CFLAGS)"
 HOST_GCC_COMMON_CONF_ENV += CXXFLAGS_FOR_TARGET="$(GCC_COMMON_TARGET_CXXFLAGS)"
#3 lore raw

PATCH 1/1 package/gcc: pass -Wno-error to debug builds

Hi James,

Le 05/02/2020 ? 05:23, James Hilliard a ?crit?:

Quoted 20 lines · Romain Naour
Quoted 11 lines

Hi James,

Le 04/02/2020 ? 01:10, James Hilliard a ?crit :

Quoted 5 lines

Fixes:
../../../../libsanitizer/libbacktrace/../../libbacktrace/elf.c:772:21: error: ?st.st_mode? may be used uninitialized in this function [-Werror=maybe-uninitialized]

   return S_ISLNK (st.st_mode);
                     ^

Can you provide a defconfig that allow to reproduce the issue.

BR2_ENABLE_DEBUG=y
BR2_DEBUG_3=y
BR2_OPTIMIZE_G=y
BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_PACKAGE_HOST_GDB=y
BR2_GDB_VERSION_8_3=y

Quoted 2 lines

FYI this fix was adapted from openembedded:
https://github.com/openembedded/openembedded-core/blob/d3083e941578fb343454e106eba349adcc525ad3/meta/recipes-devtools/gcc/gcc-sanitizers.inc#L48-L49

Ok, I'm able to reproduce the issue even the recent gcc 8 bump.

Quoted 20 lines
Quoted 20 lines

Thanks!

Best regards,
Romain

Quoted 13 lines
---
 package/gcc/gcc.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/gcc/gcc.mk +0 -0
index 527f30bf22..badf358707 100644
@@ -103,6 +103,10 @@ HOST_GCC_COMMON_CONF_ENV = \
 GCC_COMMON_TARGET_CFLAGS = $(TARGET_CFLAGS)
 GCC_COMMON_TARGET_CXXFLAGS = $(TARGET_CXXFLAGS)
 
Quoted 3 lines
Quoted 3 lines

package/gcc/gcc.mk HOST_GCC_COMMON_CONF_ENV = \ · line 108

Quoted 3 lines
package/gcc/gcc.mk +3 -0
+ifeq ($(BR2_ENABLE_DEBUG),y)
+GCC_COMMON_TARGET_CFLAGS += -Wno-error
+endif

We don't use Buildroot for gcc development, so -Wno-error can be added unconditionally. Maybe add a comment like in the Yocto recipes about this issue.

With that fixed:

Best regards,
Romain

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
package/gcc/gcc.mk +1 -0
+
 # Propagate options used for target software building to GCC target libs
 HOST_GCC_COMMON_CONF_ENV += CFLAGS_FOR_TARGET="$(GCC_COMMON_TARGET_CFLAGS)"
 HOST_GCC_COMMON_CONF_ENV += CXXFLAGS_FOR_TARGET="$(GCC_COMMON_TARGET_CXXFLAGS)"