Added as, ar, ld, etc symlinks into /usr/libexec/gcc/aarch64-linux-gnu/8

Apparently `invoke_as:` directive in GCC spec file applies to running
assembler on C/C++ compiler output. However compiling `assemble` (.s) and
`assembler-with-cpp` pseudo-languages use `as`  instead of ${target}-as)
anyway. Fortunately GCC searches for `as` in libexec/gcc/$target/$version
directory. Therefore add symlink to ${target}-as into that directory.
Do the same thing for ar, ld, nm, objcopy, etc just in a case.
This commit is contained in:
Alexey Sheplyakov 2021-06-11 23:02:19 +00:00
parent e3b5169d89
commit 3e238594dd

View File

@ -199,6 +199,19 @@ install -m 644 specs %buildroot%prefix/lib/gcc/%target/%gcc_branch/specs
# Note: collect2 (GCCs linker wrapper) searches for %%target-ld on its own.
# Alas it does not use relative paths and is not adjustable via the specs file
# XXX: apparently invoke_as: spec directive applies only to running assembler
# on compiler (cc1) output. The spec which describes compiling of `assembler`
# and `assembler-with-cpp` pseudo-languages seems to be hard-coded into GCC.
# As a result GCC still runs /usr/bin/as (instead of target assembler) when
# compiling .S files. Therefore install `as` symlinks in GCC libsubdir
# (%%prefix/lib/gcc/%%target/%%gcc_branch).
# Just in a case make symlins to other tools.
for tool in ar as ld ld.bfd ld.gold nm objcopy objdump ranlib readelf strip; do
ln -s ../../../../bin/%target-$tool %buildroot%prefix/lib/gcc/%target/%gcc_branch/$tool
# just in a case add a symlink into libexec too
ln -s ../../../../bin/%target-$tool %buildroot%prefix/libexec/gcc/%target/%gcc_branch/$tool
done
# XXX: ABI: which is correct location of ELF interpreter for aarch64?
# Native glibc provides ld-linux-aarch64.so.1 in both /lib64 and /lib.
# Do the same thing in cross-glibc
@ -273,6 +286,24 @@ env LD_LIBRARY_PATH=%buildroot%sysroot/lib64:${gcc_runtime_libdir} \
env LD_LIBRARY_PATH=%buildroot%sysroot/lib64:${gcc_runtime_libdir} \
qemu-%target_qemu_arch-static -L %buildroot%sysroot ./hello_cpp || exit 7
cat > bye.S <<EOF
#include <sys/syscall.h>
.arch armv8-a
.text
.align 2
.global _start
_start:
mov x8, __NR_exit
mov x0, 0
svc #0
.section .note.GNU-stack,"",@progbits
EOF
env PATH=%buildroot%prefix/bin:$PATH \
%buildroot%prefix/bin/%target-gcc -static -nostdlib -o bye_asm bye.S || exit 11
qemu-%target_qemu_arch-static ./bye_asm || exit 13
%files
%_bindir/*
%prefix/lib/gcc/%target/%gcc_branch/*