Skip to content

Commit 14b777e

Browse files
Fix build error when installing ld
It appears that ld also should be installed in sequential order after the binutils. Signed-off-by: Anton Kolesov <[email protected]>
1 parent 651eae3 commit 14b777e

File tree

3 files changed

+31
-12
lines changed

3 files changed

+31
-12
lines changed

arc-init.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,22 @@ make_target() {
439439
fi
440440
}
441441

442+
# Same as `make_target` but without parallelism, where order is required.
443+
# Arguments:
444+
# $1 - step name. It should be a gerund for proper text representation, as
445+
# "building", not "build".
446+
# remaining - make targets
447+
make_target_ordered() {
448+
local step="$1"
449+
shift
450+
echo " $step..."
451+
if ! make $* >> "$logfile" 2>&1
452+
then
453+
echo "ERROR: failed while $1."
454+
echo "See \`$logfile' for details."
455+
exit 1
456+
fi
457+
}
442458

443459
# Create a common log directory for all logs in this and sub-scripts
444460
LOGDIR="$ARC_GNU/logs"

build-elf32.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,14 @@ mkdir -p "$build_dir"
169169
build_dir_init binutils
170170
configure_elf32 binutils
171171
make_target building all-binutils all-gas all-ld
172-
make_target installing ${HOST_INSTALL}-binutils ${HOST_INSTALL}-gas ${HOST_INSTALL}-ld
172+
# Gas requires opcodes to be installed, LD requires BFD to be installed.
173+
# However those dependencies are not described in the Makefiles, instead if
174+
# required components is not yet installed, then dummy as-new and ld-new will
175+
# be installed. Both libraries are installed by install-binutils. Therefore it
176+
# is required that binutils is installed before ld and gas. That order
177+
# denedency showed up only with Linux toolchain so far, but for safety same
178+
# patch is applied to baremetal toolchain.
179+
make_target_ordered installing install-binutils install-ld install-gas
173180
if [ "$DO_PDF" = "--pdf" ]
174181
then
175182
make_target "generating PDF documentation" install-pdf-binutils \

build-uclibc.sh

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -368,19 +368,15 @@ fi
368368

369369
# -----------------------------------------------------------------------------
370370
# Build Binutils - will be used by both state 1 and stage2
371-
# Note about separate install-gas: Gas installation depends on libopcodes - if
372-
# it detects that opcodes hasn't been yet installed, then install-gas will
373-
# install dummy "as" script instead of proper binary. However GNU makefile
374-
# doesn't describe this dependency, so in parallel installation there is a
375-
# chance that install-gas will run before install-opcodes, which will cause a
376-
# broken gas installation. Workaround is to call install-gas separately, after
377-
# other targets. libopcodes is a dependency of binutils (target, not package),
378-
# so as long as install-gas is done after install-binutils it should be safe.
379371
build_dir_init binutils
380372
configure_uclibc_stage2 binutils
381-
make_target building all-binutils all-gas all-ld
382-
make_target installing install-binutils install-ld
383-
make_target "installing gas" install-gas
373+
make_target building all-binutils all-ld all-gas
374+
# Gas requires opcodes to be installed, LD requires BFD to be installed.
375+
# However those dependencies are not described in the Makefiles, instead if
376+
# required components is not yet installed, then dummy as-new and ld-new will
377+
# be installed. Both libraries are installed by install-binutils. Therefore it
378+
# is required that binutils is installed before ld and gas.
379+
make_target_ordered installing install-binutils install-ld install-gas
384380
if [ $DO_PDF == --pdf ]
385381
then
386382
make_target "generating PDF documentation" install-pdf-binutils \

0 commit comments

Comments
 (0)