@@ -103,16 +103,6 @@ ifneq ($(REQUIRED_MIN_MAKE_MAJOR_VERSION),)
103103endif
104104
105105################################################################################
106- # Define common directories and files
107-
108- # Ensure we have 32-bit libs also for x64. We enable mixed-mode.
109- ifeq (x86_64,$(ARCH))
110- LIBDIRS := lib64 lib
111- CFLAGS_lib := -m32
112- else
113- LIBDIRS := lib
114- endif
115-
116106# Define directories
117107DOWNLOAD := $(OUTPUT_ROOT)/download
118108SRCDIR := $(OUTPUT_ROOT)/src
@@ -200,23 +190,19 @@ TOOLS ?= $(call declare_tools,_FOR_TARGET,$(TARGET)-)
200190
201191################################################################################
202192
203- # Create a TARGET bfd + libiberty only.
204- # Configure one or two times depending on mulitlib arch.
205- # If multilib, the second should be 32-bit, and we resolve
206- # CFLAG_<name> to most likely -m32.
207- define mk_bfd
208- $$(info Libs for $(1))
209- $$(BUILDDIR)/$$(BINUTILS_VER)-$(subst /,-,$(1))/Makefile: \
210- CFLAGS += $$(CFLAGS_$(1))
211- $$(BUILDDIR)/$$(BINUTILS_VER)-$(subst /,-,$(1))/Makefile: \
212- LIBDIRS = --libdir=$(TARGETDIR)/$(1)
213-
214- BFDLIB += $$(TARGETDIR)/$$(BINUTILS_VER)-$(subst /,-,$(1)).done
215- BFDMAKES += $$(BUILDDIR)/$$(BINUTILS_VER)-$(subst /,-,$(1))/Makefile
216- endef
193+ ifeq (x86_64,$(ARCH))
194+ LIBDIR := lib64
195+ else
196+ LIBDIR := lib
197+ endif
217198
218- # Create one set of bfds etc for each multilib arch
219- $(foreach l,$(LIBDIRS),$(eval $(call mk_bfd,$(l))))
199+ $(BUILDDIR)/$(BINUTILS_VER)-$(LIBDIR)/Makefile:
200+ CFLAGS += CFLAGS_$(LIBDIR)
201+ $(BUILDDIR)/$(BINUTILS_VER)-$(LIBDIR)/Makefile:
202+ LIBDIR = --libdir=$(TARGETDIR)/$(LIBDIR)
203+
204+ BFDLIB += $(TARGETDIR)/$(BINUTILS_VER)-$(LIBDIR).done
205+ BFDMAKES += $(BUILDDIR)/$(BINUTILS_VER)-$(LIBDIR)/Makefile
220206
221207# Only build these two libs.
222208$(BFDLIB): MAKECMD = all-libiberty all-bfd
@@ -228,7 +214,7 @@ $(BFDMAKES): CONFIG = --target=$(TARGET) \
228214 --host=$(TARGET) --build=$(BUILD) \
229215 --prefix=$(TARGETDIR) \
230216 --with-sysroot=$(SYSROOT) \
231- $(LIBDIRS )
217+ $(LIBDIR )
232218
233219$(BFDMAKES): TOOLS = $(call declare_tools,_FOR_TARGET,$(TARGET)-) $(call declare_tools,,$(TARGET)-)
234220
@@ -243,11 +229,8 @@ $(GCC) \
243229 $(CCACHE): ENVS += $(TOOLS)
244230
245231# libdir to work around hateful bfd stuff installing into wrong dirs...
246- # ensure we have 64 bit bfd support in the HOST library. I.e our
247- # compiler on i686 will know 64 bit symbols, BUT later
248- # we build just the libs again for TARGET, then with whatever the arch
249- # wants.
250- $(BUILDDIR)/$(BINUTILS_VER)/Makefile: CONFIG += --enable-64-bit-bfd --libdir=$(PREFIX)/$(word 1,$(LIBDIRS))
232+ # ensure we have 64 bit bfd support in the HOST library.
233+ $(BUILDDIR)/$(BINUTILS_VER)/Makefile: CONFIG += --enable-64-bit-bfd --libdir=$(PREFIX)/$(LIBDIR)
251234
252235ifeq ($(filter $(ARCH), s390x riscv64 ppc64le), )
253236 # gold compiles but cannot link properly on s390x @ gcc 13.2 and Fedore 41
@@ -256,10 +239,6 @@ ifeq ($(filter $(ARCH), s390x riscv64 ppc64le), )
256239 LINKER_CONFIG_ENABLE_GOLD := --enable-gold=default
257240endif
258241
259- ifeq ($(filter riscv64 ppc64le s390x armhfp, $(ARCH)), )
260- ENABLE_MULTILIB := --enable-multilib
261- endif
262-
263242# Makefile creation. Simply run configure in build dir.
264243# Setting CFLAGS to -O2 generates a much faster ld.
265244$(BFDMAKES) \
@@ -275,7 +254,6 @@ $(BUILDDIR)/$(BINUTILS_VER)/Makefile: $(BINUTILS_CFG)
275254 --with-sysroot=$(SYSROOT) \
276255 --disable-nls \
277256 --program-prefix=$(TARGET)- \
278- $(ENABLE_MULTILIB) \
279257 --enable-threads \
280258 --enable-plugins \
281259 ) > $(@D)/log.config 2>&1
@@ -340,15 +318,12 @@ ifeq ($(ARCH), riscv64)
340318 $(BUILDDIR)/$(GCC_VER)/Makefile: CONFIG += --disable-libsanitizer
341319endif
342320
343- ifneq ($(filter riscv64 ppc64le s390x armhfp, $(ARCH)), )
344- # We only support 64-bit on these platforms anyway
345- CONFIG += --disable-multilib
346- endif
321+ # We don't need to support multilib
322+ CONFIG += --disable-multilib
347323
348324# Want:
349325# c,c++
350326# shared libs
351- # multilib (-m32/-m64 on x64)
352327# skip native language.
353328# and link and assemble with the binutils we created
354329# earlier, so --with-gnu*
@@ -438,14 +413,12 @@ ifeq ($(HOST),$(TARGET))
438413 # "Solve" this by create links from the target libdirs to where they are.
439414 $(LINK_LIBS_MARKER): $(GCC)
440415 @echo -n 'Creating library symlinks...'
441- @for l in $(LIBDIRS); do \
442- for f in `cd $(PREFIX)/$$l && ls`; do \
443- if [ ! -e $(TARGETDIR)/$$l/$$f ]; then \
444- mkdir -p $(TARGETDIR)/$$l && \
445- cd $(TARGETDIR)/$$l/ && \
446- ln -fs ../../$$l/$$f $$f; \
447- fi \
448- done \
416+ @for f in `cd $(PREFIX)/$(LIBDIR) && ls`; do \
417+ if [ ! -e $(TARGETDIR)/$(LIBDIR)/$$f ]; then \
418+ mkdir -p $(TARGETDIR)/$(LIBDIR) && \
419+ cd $(TARGETDIR)/$(LIBDIR)/ && \
420+ ln -fs ../../$(LIBDIR)/$$f $$f; \
421+ fi \
449422 done
450423 @touch $@
451424 @echo 'done'
0 commit comments