I work on a build system where packages should be built with a clean
separation of the build and host dependencies. The compiler should
consider only headers and libraries in a sysroot. But ensuring that
turned out to be harder than expected.
When specifying a sysroot /build/sysroot, LIBRARY_PATH is
`/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../lib/:/build/sysroot/usr/lib/../lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../:/build/sysroot/usr/lib/`.
Looking at the GCC source code, I found that one of the added paths that
resolve to outside of the sysroot is the startfile directory (which
happens to resolve to /usr/lib, where all the other build dependencies
are). Therefore, the resulting programs might link against libraries
from the build system, which I want to prevent. But the directory is
added only if the cross_compile spec is 0.
Source:
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/gcc.cc;h=16bb07f2cdc5edf0a25ce1bd221d417d6bc41d3c;hb=cc035c5d8672f87dc8c2756d9f8367903aa72d93#l8433
So I tried setting the cross_compile spec to 1. Doing that by passing a
spec file to GCC by the -specs=file command like option did not change
LIBRARY_PATH however. But when putting the modified specs file into
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/specs, I got
`LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/:/build/sysroot/usr/lib/../lib/:/build/sysroot/usr/lib/`,
which works good enough for me. (I also put libgcc into the sysroot, so
`LIBRARY_PATH=/build/sysroot/usr/lib/` would actually be sufficient).
The reason why -specs=file didn’t work is that the user-specified specs
are processed a few lines after the paths from outside the sysroot are
added:
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/gcc.cc;h=16bb07f2cdc5edf0a25ce1bd221d417d6bc41d3c;hb=cc035c5d8672f87dc8c2756d9f8367903aa72d93#l8455
Creating files in /usr is not a problem in my case because all builds
are done in their own environment, but if I need to do something like
this, I feel like I might be missing something or do something
unforeseen. Is there another way to prevent GCC from considering any
headers and libraries outside of the sysroot?
The rest of this email is the commands and output executed on an Arch
Linux system:
# gcc --version --verbose
Using built-in specs.
COLLECT_AS_OPTIONS='--version'
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/lto-wrapper
gcc (GCC) 13.1.1 20230429
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure
--enable-languages=ada,c,c++,d,fortran,go,lto,objc,obj-c++
--enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--with-build-config=bootstrap-lto --with-linker-hash-style=gnu
--with-system-zlib --enable-__cxa_atexit --enable-cet=auto
--enable-checking=release --enable-clocale=gnu --enable-default-pie
--enable-default-ssp --enable-gnu-indirect-function
--enable-gnu-unique-object --enable-libstdcxx-backtrace
--enable-link-serialization=1 --enable-linker-build-id --enable-lto
--enable-multilib --enable-plugin --enable-shared --enable-threads=posix
--disable-libssp --disable-libstdcxx-pch --disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.1.1 20230429 (GCC)
COLLECT_GCC_OPTIONS='--version' '-v' '-mtune=generic' '-march=x86-64'
'-dumpdir' 'a-'
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/cc1 -quiet -v help-dummy
-quiet -dumpdir a- -dumpbase help-dummy -mtune=generic -march=x86-64
-version --version -o /tmp/ccJ1rCtm.s
GNU C17 (GCC) version 13.1.1 20230429 (x86_64-pc-linux-gnu)
compiled by GNU C version 13.1.1 20230429, GMP version 6.2.1, MPFR
version 4.2.0, MPC version 1.3.1, isl version isl-0.26-GMP
warning: MPFR header version 4.2.0 differs from library version 4.2.0-p9.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
COLLECT_GCC_OPTIONS='--version' '-v' '-mtune=generic' '-march=x86-64'
'-dumpdir' 'a-'
as -v --64 --version -o /tmp/ccFQdjwk.o /tmp/ccJ1rCtm.s
GNU assembler version 2.40.0 (x86_64-pc-linux-gnu) using BFD version
(GNU Binutils) 2.40.0
GNU assembler (GNU Binutils) 2.40.0
Copyright (C) 2023 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `x86_64-pc-linux-gnu'.
COMPILER_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../lib/:/lib/../lib/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='--version' '-v' '-mtune=generic' '-march=x86-64'
'-dumpdir' 'a.'
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/collect2 -plugin
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/liblto_plugin.so
-plugin-opt=/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/lto-wrapper
-plugin-opt=-fresolution=/tmp/ccTuU656.res
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s
-plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr
--hash-style=gnu -m elf_x86_64 -dynamic-linker
/lib64/ld-linux-x86-64.so.2 -pie --version
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../lib/Scrt1.o
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../lib/crti.o
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/crtbeginS.o
-L/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1
-L/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../lib -L/lib/../lib
-L/usr/lib/../lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../..
/tmp/ccFQdjwk.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc
-lgcc --push-state --as-needed -lgcc_s --pop-state
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/crtendS.o
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../lib/crtn.o
collect2 version 13.1.1 20230429
/usr/sbin/ld -plugin
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/liblto_plugin.so
-plugin-opt=/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/lto-wrapper
-plugin-opt=-fresolution=/tmp/ccTuU656.res
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s
-plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr
--hash-style=gnu -m elf_x86_64 -dynamic-linker
/lib64/ld-linux-x86-64.so.2 -pie --version
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../lib/Scrt1.o
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../lib/crti.o
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/crtbeginS.o
-L/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1
-L/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../lib -L/lib/../lib
-L/usr/lib/../lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../..
/tmp/ccFQdjwk.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc
-lgcc --push-state --as-needed -lgcc_s --pop-state
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/crtendS.o
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../lib/crtn.o
GNU ld (GNU Binutils) 2.40.0
Copyright (C) 2023 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later
version.
This program has absolutely no warranty.
COLLECT_GCC_OPTIONS='--version' '-v' '-mtune=generic' '-march=x86-64'
'-dumpdir' 'a.'
# mkdir -p /build/sysroot/usr/{include,lib}
# gcc --sysroot=/build/sysroot --version --verbose
Using built-in specs.
COLLECT_AS_OPTIONS='--version'
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/lto-wrapper
gcc (GCC) 13.1.1 20230429
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure
--enable-languages=ada,c,c++,d,fortran,go,lto,objc,obj-c++
--enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--with-build-config=bootstrap-lto --with-linker-hash-style=gnu
--with-system-zlib --enable-__cxa_atexit --enable-cet=auto
--enable-checking=release --enable-clocale=gnu --enable-default-pie
--enable-default-ssp --enable-gnu-indirect-function
--enable-gnu-unique-object --enable-libstdcxx-backtrace
--enable-link-serialization=1 --enable-linker-build-id --enable-lto
--enable-multilib --enable-plugin --enable-shared --enable-threads=posix
--disable-libssp --disable-libstdcxx-pch --disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.1.1 20230429 (GCC)
COLLECT_GCC_OPTIONS='--sysroot=/build/sysroot' '--version' '-v'
'-mtune=generic' '-march=x86-64' '-dumpdir' 'a-'
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/cc1 -quiet -v -isysroot
/build/sysroot help-dummy -quiet -dumpdir a- -dumpbase help-dummy
-mtune=generic -march=x86-64 -version --version -o /tmp/ccCqkJ5t.s
GNU C17 (GCC) version 13.1.1 20230429 (x86_64-pc-linux-gnu)
compiled by GNU C version 13.1.1 20230429, GMP version 6.2.1, MPFR
version 4.2.0, MPC version 1.3.1, isl version isl-0.26-GMP
warning: MPFR header version 4.2.0 differs from library version 4.2.0-p9.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
COLLECT_GCC_OPTIONS='--sysroot=/build/sysroot' '--version' '-v'
'-mtune=generic' '-march=x86-64' '-dumpdir' 'a-'
as -v --64 --version -o /tmp/ccfzbwgT.o /tmp/ccCqkJ5t.s
GNU assembler version 2.40.0 (x86_64-pc-linux-gnu) using BFD version
(GNU Binutils) 2.40.0
GNU assembler (GNU Binutils) 2.40.0
Copyright (C) 2023 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `x86_64-pc-linux-gnu'.
COMPILER_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../lib/:/build/sysroot/usr/lib/../lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../:/build/sysroot/usr/lib/
COLLECT_GCC_OPTIONS='--sysroot=/build/sysroot' '--version' '-v'
'-mtune=generic' '-march=x86-64' '-dumpdir' 'a.'
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/collect2 -plugin
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/liblto_plugin.so
-plugin-opt=/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/lto-wrapper
-plugin-opt=-fresolution=/tmp/ccpOtyF1.res
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s
-plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lgcc_s --sysroot=/build/sysroot --build-id
--eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker
/lib64/ld-linux-x86-64.so.2 -pie --version
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../lib/Scrt1.o
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../lib/crti.o
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/crtbeginS.o
-L/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1
-L/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../lib
-L/build/sysroot/usr/lib/../lib
-L/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../..
-L/build/sysroot/usr/lib /tmp/ccfzbwgT.o -lgcc --push-state --as-needed
-lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s
--pop-state /usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/crtendS.o
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../lib/crtn.o
collect2 version 13.1.1 20230429
/usr/sbin/ld -plugin
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/liblto_plugin.so
-plugin-opt=/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/lto-wrapper
-plugin-opt=-fresolution=/tmp/ccpOtyF1.res
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s
-plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lgcc_s --sysroot=/build/sysroot --build-id
--eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker
/lib64/ld-linux-x86-64.so.2 -pie --version
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../lib/Scrt1.o
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../lib/crti.o
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/crtbeginS.o
-L/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1
-L/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../lib
-L/build/sysroot/usr/lib/../lib
-L/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../..
-L/build/sysroot/usr/lib /tmp/ccfzbwgT.o -lgcc --push-state --as-needed
-lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s
--pop-state /usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/crtendS.o
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../lib/crtn.o
GNU ld (GNU Binutils) 2.40.0
Copyright (C) 2023 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later
version.
This program has absolutely no warranty.
COLLECT_GCC_OPTIONS='--sysroot=/build/sysroot' '--version' '-v'
'-mtune=generic' '-march=x86-64' '-dumpdir' 'a.'
# gcc -dumpspecs | sed '/\*cross_compile:/{n;s/0/1/}' >
/build/cross_compile_specs
# gcc -specs=/build/cross_compile_specs --sysroot=/build/sysroot
--version --verbose
Using built-in specs.
Reading specs from /build/cross_compile_specs
COLLECT_AS_OPTIONS='--version'
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/lto-wrapper
gcc (GCC) 13.1.1 20230429
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure
--enable-languages=ada,c,c++,d,fortran,go,lto,objc,obj-c++
--enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--with-build-config=bootstrap-lto --with-linker-hash-style=gnu
--with-system-zlib --enable-__cxa_atexit --enable-cet=auto
--enable-checking=release --enable-clocale=gnu --enable-default-pie
--enable-default-ssp --enable-gnu-indirect-function
--enable-gnu-unique-object --enable-libstdcxx-backtrace
--enable-link-serialization=1 --enable-linker-build-id --enable-lto
--enable-multilib --enable-plugin --enable-shared --enable-threads=posix
--disable-libssp --disable-libstdcxx-pch --disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.1.1 20230429 (GCC)
COLLECT_GCC_OPTIONS='-specs=/build/cross_compile_specs'
'--sysroot=/build/sysroot' '--version' '-v' '-mtune=generic'
'-march=x86-64' '-dumpdir' 'a-'
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/cc1 -quiet -v -isysroot
/build/sysroot help-dummy -quiet -dumpdir a- -dumpbase help-dummy
-mtune=generic -march=x86-64 -version --version -o /tmp/cckY07dI.s
GNU C17 (GCC) version 13.1.1 20230429 (x86_64-pc-linux-gnu)
compiled by GNU C version 13.1.1 20230429, GMP version 6.2.1, MPFR
version 4.2.0, MPC version 1.3.1, isl version isl-0.26-GMP
warning: MPFR header version 4.2.0 differs from library version 4.2.0-p9.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
COLLECT_GCC_OPTIONS='-specs=/build/cross_compile_specs'
'--sysroot=/build/sysroot' '--version' '-v' '-mtune=generic'
'-march=x86-64' '-dumpdir' 'a-'
as -v --64 --version -o /tmp/ccMxUZVV.o /tmp/cckY07dI.s
GNU assembler version 2.40.0 (x86_64-pc-linux-gnu) using BFD version
(GNU Binutils) 2.40.0
GNU assembler (GNU Binutils) 2.40.0
Copyright (C) 2023 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `x86_64-pc-linux-gnu'.
COMPILER_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../lib/:/build/sysroot/usr/lib/../lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../:/build/sysroot/usr/lib/
COLLECT_GCC_OPTIONS='-specs=/build/cross_compile_specs'
'--sysroot=/build/sysroot' '--version' '-v' '-mtune=generic'
'-march=x86-64' '-dumpdir' 'a.'
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/collect2 -plugin
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/liblto_plugin.so
-plugin-opt=/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/lto-wrapper
-plugin-opt=-fresolution=/tmp/cc5SixiB.res
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s
-plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr
--hash-style=gnu -m elf_x86_64 -dynamic-linker
/lib64/ld-linux-x86-64.so.2 -pie --version
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../lib/Scrt1.o
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../lib/crti.o
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/crtbeginS.o
-L/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1
-L/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../lib
-L/build/sysroot/usr/lib/../lib
-L/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../..
-L/build/sysroot/usr/lib /tmp/ccMxUZVV.o -lgcc --push-state --as-needed
-lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s
--pop-state /usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/crtendS.o
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../lib/crtn.o
collect2 version 13.1.1 20230429
/usr/sbin/ld -plugin
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/liblto_plugin.so
-plugin-opt=/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/lto-wrapper
-plugin-opt=-fresolution=/tmp/cc5SixiB.res
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s
-plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr
--hash-style=gnu -m elf_x86_64 -dynamic-linker
/lib64/ld-linux-x86-64.so.2 -pie --version
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../lib/Scrt1.o
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../lib/crti.o
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/crtbeginS.o
-L/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1
-L/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../lib
-L/build/sysroot/usr/lib/../lib
-L/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../..
-L/build/sysroot/usr/lib /tmp/ccMxUZVV.o -lgcc --push-state --as-needed
-lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s
--pop-state /usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/crtendS.o
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../lib/crtn.o
GNU ld (GNU Binutils) 2.40.0
Copyright (C) 2023 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later
version.
This program has absolutely no warranty.
COLLECT_GCC_OPTIONS='-specs=/build/cross_compile_specs'
'--sysroot=/build/sysroot' '--version' '-v' '-mtune=generic'
'-march=x86-64' '-dumpdir' 'a.'
# mv /build/cross_compile_specs
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/specs
# gcc --sysroot=/build/sysroot --version --verbose
Reading specs from /usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/specs
COLLECT_AS_OPTIONS='--version'
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/lto-wrapper
gcc (GCC) 13.1.1 20230429
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure
--enable-languages=ada,c,c++,d,fortran,go,lto,objc,obj-c++
--enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--with-build-config=bootstrap-lto --with-linker-hash-style=gnu
--with-system-zlib --enable-__cxa_atexit --enable-cet=auto
--enable-checking=release --enable-clocale=gnu --enable-default-pie
--enable-default-ssp --enable-gnu-indirect-function
--enable-gnu-unique-object --enable-libstdcxx-backtrace
--enable-link-serialization=1 --enable-linker-build-id --enable-lto
--enable-multilib --enable-plugin --enable-shared --enable-threads=posix
--disable-libssp --disable-libstdcxx-pch --disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.1.1 20230429 (GCC)
COLLECT_GCC_OPTIONS='--sysroot=/build/sysroot' '--version' '-v'
'-mtune=generic' '-march=x86-64' '-dumpdir' 'a-'
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/cc1 -quiet -v -isysroot
/build/sysroot help-dummy -quiet -dumpdir a- -dumpbase help-dummy
-mtune=generic -march=x86-64 -version --version -o /tmp/ccrIpyEr.s
GNU C17 (GCC) version 13.1.1 20230429 (x86_64-pc-linux-gnu)
compiled by GNU C version 13.1.1 20230429, GMP version 6.2.1, MPFR
version 4.2.0, MPC version 1.3.1, isl version isl-0.26-GMP
warning: MPFR header version 4.2.0 differs from library version 4.2.0-p9.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
COLLECT_GCC_OPTIONS='--sysroot=/build/sysroot' '--version' '-v'
'-mtune=generic' '-march=x86-64' '-dumpdir' 'a-'
as -v --64 --version -o /tmp/ccz5frAr.o /tmp/ccrIpyEr.s
GNU assembler version 2.40.0 (x86_64-pc-linux-gnu) using BFD version
(GNU Binutils) 2.40.0
GNU assembler (GNU Binutils) 2.40.0
Copyright (C) 2023 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `x86_64-pc-linux-gnu'.
COMPILER_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/:/build/sysroot/usr/lib/../lib/:/build/sysroot/usr/lib/
COLLECT_GCC_OPTIONS='--sysroot=/build/sysroot' '--version' '-v'
'-mtune=generic' '-march=x86-64' '-dumpdir' 'a.'
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/collect2 -plugin
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/liblto_plugin.so
-plugin-opt=/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/lto-wrapper
-plugin-opt=-fresolution=/tmp/cc1U4KN4.res
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s
-plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lgcc_s --sysroot=/build/sysroot --build-id
--eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker
/lib64/ld-linux-x86-64.so.2 -pie --version Scrt1.o crti.o
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/crtbeginS.o
-L/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1
-L/build/sysroot/usr/lib/../lib -L/build/sysroot/usr/lib /tmp/ccz5frAr.o
-lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc
--push-state --as-needed -lgcc_s --pop-state
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/crtendS.o crtn.o
collect2 version 13.1.1 20230429
/usr/sbin/ld -plugin
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/liblto_plugin.so
-plugin-opt=/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/lto-wrapper
-plugin-opt=-fresolution=/tmp/cc1U4KN4.res
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s
-plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lgcc_s --sysroot=/build/sysroot --build-id
--eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker
/lib64/ld-linux-x86-64.so.2 -pie --version Scrt1.o crti.o
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/crtbeginS.o
-L/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1
-L/build/sysroot/usr/lib/../lib -L/build/sysroot/usr/lib /tmp/ccz5frAr.o
-lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc
--push-state --as-needed -lgcc_s --pop-state
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/crtendS.o crtn.o
GNU ld (GNU Binutils) 2.40.0
Copyright (C) 2023 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later
version.
This program has absolutely no warranty.
COLLECT_GCC_OPTIONS='--sysroot=/build/sysroot' '--version' '-v'
'-mtune=generic' '-march=x86-64' '-dumpdir' 'a.'