aports/testing/yosys/fix-32-bit-oom.patch
2026-02-09 22:50:21 +09:00

23 lines
811 B
Diff

diff --git a/Makefile b/Makefile
index 1c1e19f5f..f55cdd156 100644
--- a/Makefile
+++ b/Makefile
@@ -782,6 +782,17 @@ endif
libyosys.a: $(filter-out kernel/driver.o,$(OBJS))
$(P) $(AR) rcs $@ $^
+# Detect 32-bit platforms to apply special compilation for memory-intensive files
+ARCH_BITS := $(shell getconf LONG_BIT 2>/dev/null || echo 64)
+
+# Special rule for pyosys/wrappers.o to avoid OOM during compilation on 32-bit platforms
+# This file is auto-generated and very large, requiring reduced optimization on 32-bit systems
+ifeq ($(ARCH_BITS),32)
+pyosys/wrappers.o: pyosys/wrappers.cc
+ $(Q) mkdir -p $(dir $@)
+ $(P) $(CXX) -o $@ -c $(CPPFLAGS) $(filter-out -O% -g% $(LTOFLAGS),$(CXXFLAGS)) -O0 -g0 $<
+endif
+
%.o: %.cc
$(Q) mkdir -p $(dir $@)
$(P) $(CXX) -o $@ -c $(CPPFLAGS) $(CXXFLAGS) $<