Skip to contentSkip to conversation

package/libpcap: fix m68k-cf compile issue

PATCH In review Waldemar Brodkorb 3 participants 5 messages Aug 14, 2024 – Sep 16, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/libpcap: fix m68k-cf compile issue

Compilation with -Os triggers this assembler problem.

Fixes:
- http://autobuild.buildroot.net/results/db5/db58215fb3c7f30b6c0f0764a84271010346edfb

---
 package/libpcap/libpcap.mk | 6 ++++++
 1 file changed, 6 insertions(+)
package/libpcap/libpcap.mk +6 -0
index a4523f2218..257ec77e08 100644
@@ -57,5 +57,11 @@ ifeq ($(BR2_microblaze)$(BR2_sparc)$(BR2_sparc64),y)
 LIBPCAP_CFLAGS += -fPIC
 endif
 
+# Enable default optimizations to not run into "Error: value -602 out of range"
+# assembler issues. -Os triggers the issue.
+ifeq ($(BR2_m68k_cf),y)
+LIBPCAP_CFLAGS += -O2
+endif
+
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
Signature · 6 lines
2.39.2

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hello Waldemar,

Quoted 6 lines · On Wed, 14 Aug 2024 15:09:20 +0200 Waldemar Brodkorb <[email protected]> wrote:

Compilation with -Os triggers this assembler problem.

Fixes:
- http://autobuild.buildroot.net/results/db5/db58215fb3c7f30b6c0f0764a84271010346edfb

[...]

package/libpcap/libpcap.mk ifeq ($(BR2_microblaze)$(BR2_sparc)$(BR2_sparc64),y) · line 64

Quoted 13 lines
package/libpcap/libpcap.mk +5 -0
index a4523f2218..257ec77e08 100644
@@ -57,5 +57,11 @@ ifeq ($(BR2_microblaze)$(BR2_sparc)$(BR2_sparc64),y)
 LIBPCAP_CFLAGS += -fPIC
 endif
 
+# Enable default optimizations to not run into "Error: value -602 out of range"
+# assembler issues. -Os triggers the issue.
+ifeq ($(BR2_m68k_cf),y)
+LIBPCAP_CFLAGS += -O2
+endif

Thanks for the patch, but this is not how we handle gcc or binutils bugs. Instead, we report the bug upstream, and once the bug is reported, we add a BR2_TOOLCHAIN_HAS_GCC_BUG_12345 or BR2_TOOLCHAIN_HAS_BINUTILS_BUG_12345 (depending on which component is affected), this option is enabled on a per-architecture basis, and sometimes per-gcc version basis, and then the workaround in the package is made conditional on this option. This allows us to track to which GCC/binutils bug a workaround is related, and from to time check if the issue has been fixed in newer versions of gcc/binutils.

See toolchain/Config.in for a lot of examples. Giulio in Cc can also help with this, he is our resident expert in BR2_TOOLCHAIN_HAS_xyz_BUG workarounds :-)

Your bug seems somewhat similar to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104028,
for which we already have BR2_TOOLCHAIN_HAS_GCC_BUG_104028 in
Buildroot. Not sure it is exactly the same bug.

Best regards,

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Hi Thomas,
Thomas Petazzoni wrote,

Quoted 38 lines

Hello Waldemar,

Quoted 6 lines · On Wed, 14 Aug 2024 15:09:20 +0200 Waldemar Brodkorb <[email protected]> wrote:

Compilation with -Os triggers this assembler problem.

Fixes:
- http://autobuild.buildroot.net/results/db5/db58215fb3c7f30b6c0f0764a84271010346edfb

[...]

package/libpcap/libpcap.mk ifeq ($(BR2_microblaze)$(BR2_sparc)$(BR2_sparc64),y) · line 64

Quoted 13 lines
package/libpcap/libpcap.mk +5 -0
index a4523f2218..257ec77e08 100644
@@ -57,5 +57,11 @@ ifeq ($(BR2_microblaze)$(BR2_sparc)$(BR2_sparc64),y)
 LIBPCAP_CFLAGS += -fPIC
 endif
 
+# Enable default optimizations to not run into "Error: value -602 out of range"
+# assembler issues. -Os triggers the issue.
+ifeq ($(BR2_m68k_cf),y)
+LIBPCAP_CFLAGS += -O2
+endif

Thanks for the patch, but this is not how we handle gcc or binutils bugs. Instead, we report the bug upstream, and once the bug is reported, we add a BR2_TOOLCHAIN_HAS_GCC_BUG_12345 or BR2_TOOLCHAIN_HAS_BINUTILS_BUG_12345 (depending on which component is affected), this option is enabled on a per-architecture basis, and sometimes per-gcc version basis, and then the workaround in the package is made conditional on this option. This allows us to track to which GCC/binutils bug a workaround is related, and from to time check if the issue has been fixed in newer versions of gcc/binutils.

Quoted 7 lines

See toolchain/Config.in for a lot of examples. Giulio in Cc can also help with this, he is our resident expert in BR2_TOOLCHAIN_HAS_xyz_BUG workarounds :-)

Your bug seems somewhat similar to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104028,
for which we already have BR2_TOOLCHAIN_HAS_GCC_BUG_104028 in
Buildroot. Not sure it is exactly the same bug.

Okay, sorry. I was just taking the example from package/assimp/assimp.mk, which use a similar workaround for m68k.

best regards
Waldemar
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw
Quoted 6 lines · On Wed, 14 Aug 2024 20:00:34 +0200 Waldemar Brodkorb <[email protected]> wrote:
Quoted 3 lines

Your bug seems somewhat similar to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104028,
for which we already have BR2_TOOLCHAIN_HAS_GCC_BUG_104028 in
Buildroot. Not sure it is exactly the same bug.

Okay, sorry. I was just taking the example from package/assimp/assimp.mk, which use a similar workaround for m68k.

I think the -mxgot is needed when we are building a large binary (but I'm not 100% sure). On the other hand, disabling optimization is clearly a workaround for a bug.

Yes, assimp.mk could use some love to better express the different gcc/binutils bugs.

Maybe even for the mxgot thing we could do something a bit more generic perhaps.

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw
In reply to Waldemar Brodkorb
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Waldemar" == Waldemar Brodkorb <[email protected]> writes:

Compilation with -Os triggers this assembler problem.
Fixes:
- http://autobuild.buildroot.net/results/db5/db58215fb3c7f30b6c0f0764a84271010346edfb

Committed to 2024.02.x, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot