mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-30 01:02:29 +00:00
Make cosmocc capable of cross compilation
This commit is contained in:
parent
504a4bbf84
commit
d1b937bf1d
21 changed files with 439 additions and 132 deletions
13
bin/aarch64-unknown-cosmo-addr2line
Executable file
13
bin/aarch64-unknown-cosmo-addr2line
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
MODE=${MODE:-${m:-aarch64}}
|
||||||
|
COSMO=${COSMO:-/opt/cosmo}
|
||||||
|
COSMOS=${COSMOS:-/opt/cosmos/aarch64}
|
||||||
|
TOOL="$COSMO/o/third_party/gcc/bin/aarch64-linux-musl-addr2line"
|
||||||
|
|
||||||
|
if [ ! -x "$TOOL" ]; then
|
||||||
|
echo "$0: you need to run: aarch64-unknown-cosmo-cc --update" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$TOOL" "$@"
|
1
bin/aarch64-unknown-cosmo-apecopy
Symbolic link
1
bin/aarch64-unknown-cosmo-apecopy
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
apecopy
|
29
bin/aarch64-unknown-cosmo-ar
Executable file
29
bin/aarch64-unknown-cosmo-ar
Executable file
|
@ -0,0 +1,29 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
PROG=${0##*/}
|
||||||
|
MODE=${MODE:-${m:-aarch64}}
|
||||||
|
COSMO=${COSMO:-/opt/cosmo}
|
||||||
|
|
||||||
|
fatal_error() {
|
||||||
|
echo "$PROG: $1" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ ! -x "$COSMO/o//tool/build/ar.com" ]; then
|
||||||
|
fatal_error "you need to run: aarch64-unknown-cosmo-cc --update"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$1" = x"rc" ] ||
|
||||||
|
[ x"$1" = x"rcD" ] ||
|
||||||
|
[ x"$1" = x"rcu" ] |
|
||||||
|
[ x"$1" = x"rcuD" ] ||
|
||||||
|
[ x"$1" = x"rcs" ] ||
|
||||||
|
[ x"$1" = x"rcsD" ] ||
|
||||||
|
[ x"$1" = x"--help" ] ||
|
||||||
|
[ x"$1" = x"--version" ]; then
|
||||||
|
AR="$COSMO/o//tool/build/ar.com"
|
||||||
|
else
|
||||||
|
AR="$COSMO/o/third_party/gcc/bin/aarch64-linux-musl-ar"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$AR" "$@"
|
13
bin/aarch64-unknown-cosmo-as
Executable file
13
bin/aarch64-unknown-cosmo-as
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
MODE=${MODE:-${m:-aarch64}}
|
||||||
|
COSMO=${COSMO:-/opt/cosmo}
|
||||||
|
COSMOS=${COSMOS:-/opt/cosmos/aarch64}
|
||||||
|
TOOL="$COSMO/o/third_party/gcc/bin/aarch64-linux-musl-as"
|
||||||
|
|
||||||
|
if [ ! -x "$TOOL" ]; then
|
||||||
|
echo "$0: you need to run: aarch64-unknown-cosmo-cc --update" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$TOOL" "$@"
|
1
bin/aarch64-unknown-cosmo-c++
Symbolic link
1
bin/aarch64-unknown-cosmo-c++
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
cosmocc
|
1
bin/aarch64-unknown-cosmo-cc
Symbolic link
1
bin/aarch64-unknown-cosmo-cc
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
cosmocc
|
1
bin/aarch64-unknown-cosmo-g++
Symbolic link
1
bin/aarch64-unknown-cosmo-g++
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
cosmocc
|
1
bin/aarch64-unknown-cosmo-gcc
Symbolic link
1
bin/aarch64-unknown-cosmo-gcc
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
cosmocc
|
13
bin/aarch64-unknown-cosmo-ld
Executable file
13
bin/aarch64-unknown-cosmo-ld
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
MODE=${MODE:-${m:-aarch64}}
|
||||||
|
COSMO=${COSMO:-/opt/cosmo}
|
||||||
|
COSMOS=${COSMOS:-/opt/cosmos/aarch64}
|
||||||
|
TOOL="$COSMO/o/third_party/gcc/bin/aarch64-linux-musl-ld"
|
||||||
|
|
||||||
|
if [ ! -x "$TOOL" ]; then
|
||||||
|
echo "$0: you need to run: aarch64-unknown-cosmo-cc --update" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$TOOL" "$@"
|
13
bin/aarch64-unknown-cosmo-objcopy
Executable file
13
bin/aarch64-unknown-cosmo-objcopy
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
MODE=${MODE:-${m:-aarch64}}
|
||||||
|
COSMO=${COSMO:-/opt/cosmo}
|
||||||
|
COSMOS=${COSMOS:-/opt/cosmos/aarch64}
|
||||||
|
TOOL="$COSMO/o/third_party/gcc/bin/aarch64-linux-musl-objcopy"
|
||||||
|
|
||||||
|
if [ ! -x "$TOOL" ]; then
|
||||||
|
echo "$0: you need to run: aarch64-unknown-cosmo-cc --update" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$TOOL" "$@"
|
13
bin/aarch64-unknown-cosmo-objdump
Executable file
13
bin/aarch64-unknown-cosmo-objdump
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
MODE=${MODE:-${m:-aarch64}}
|
||||||
|
COSMO=${COSMO:-/opt/cosmo}
|
||||||
|
COSMOS=${COSMOS:-/opt/cosmos/aarch64}
|
||||||
|
TOOL="$COSMO/o/third_party/gcc/bin/aarch64-linux-musl-objdump"
|
||||||
|
|
||||||
|
if [ ! -x "$TOOL" ]; then
|
||||||
|
echo "$0: you need to run: aarch64-unknown-cosmo-cc --update" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$TOOL" "$@"
|
13
bin/aarch64-unknown-cosmo-strip
Executable file
13
bin/aarch64-unknown-cosmo-strip
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
MODE=${MODE:-${m:-aarch64}}
|
||||||
|
COSMO=${COSMO:-/opt/cosmo}
|
||||||
|
COSMOS=${COSMOS:-/opt/cosmos/aarch64}
|
||||||
|
TOOL="$COSMO/o/third_party/gcc/bin/aarch64-linux-musl-strip"
|
||||||
|
|
||||||
|
if [ ! -x "$TOOL" ]; then
|
||||||
|
echo "$0: you need to run: aarch64-unknown-cosmo-cc --update" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$TOOL" "$@"
|
95
bin/apecopy
Executable file
95
bin/apecopy
Executable file
|
@ -0,0 +1,95 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
PROG=${0##*/}
|
||||||
|
COSMO=${COSMO:-/opt/cosmo}
|
||||||
|
|
||||||
|
if [ x"$1" = x"--version" ]; then
|
||||||
|
cat <<EOF
|
||||||
|
$PROG 0.1
|
||||||
|
Copyright (c) 2023 Justine Alexandra Roberts Tunney
|
||||||
|
Cosmopolitan Libc and LLVM libcxx/compiler-rt are subject to non-GPL
|
||||||
|
notice licenses, e.g. ISC, MIT, etc. Your compiled programs must embed
|
||||||
|
our copyright notices. This toolchain is configured to do so default.
|
||||||
|
Cosmopolitan comes with absolutely NO WARRANTY of any kind.
|
||||||
|
For more information, see the Cosmopolitan LICENSE files.
|
||||||
|
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||||
|
This launches GNU GCC/Binutils subprocesses, which is free software; see
|
||||||
|
Cosmopolitan's third_party/gcc/ for source code and copying conditions.
|
||||||
|
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE.
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$1" = x"--help" ]; then
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $PROG INPUT OUTPUT
|
||||||
|
Converts an executable linked by cosmocc to the Actually Portable
|
||||||
|
Executable file format. See $PROG --version for other details.
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
fatal_error() {
|
||||||
|
echo "$PROG: fatal error: $1" >&2
|
||||||
|
echo "operation terminated." >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
CROSS=1
|
||||||
|
ARCH=${PROG%%-*} # split(prog, '-')[0]
|
||||||
|
if [ x"$ARCH" = x"$PROG" ]; then
|
||||||
|
ARCH=x86_64
|
||||||
|
CROSS=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$ARCH" = x"x86_64" ]; then
|
||||||
|
MODE=${MODE:-$m}
|
||||||
|
else
|
||||||
|
MODE=${MODE:-${m:-$ARCH}}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $CROSS -eq 0 ]; then
|
||||||
|
COSMOS=${COSMOS:-/opt/cosmos}
|
||||||
|
else
|
||||||
|
COSMOS=${COSMOS:-/opt/cosmos/$ARCH}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$ARCH" = x"x86_64" ]; then
|
||||||
|
OBJCOPYFLAGS="-S -O binary"
|
||||||
|
elif [ x"$ARCH" = x"aarch64" ]; then
|
||||||
|
OBJCOPYFLAGS="-S"
|
||||||
|
else
|
||||||
|
fatal_error "$ARCH: unsupported architecture"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "$COSMO" ]; then
|
||||||
|
fatal_error "you need to clone cosmopolitan to your $COSMO directory"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$COSMO/o//tool/build/zipcopy.com" ] ||
|
||||||
|
[ ! -f "$COSMO/o/third_party/gcc/bin/$ARCH-linux-musl-objcopy" ]; then
|
||||||
|
if [ $CROSS -eq 0 ]; then
|
||||||
|
fatal_error "you need to run: cosmocc --update"
|
||||||
|
else
|
||||||
|
fatal_error "you need to run: $ARCH-unknown-cosmo-cosmocc --update"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
INPUT=$1
|
||||||
|
OUTPUT=$2
|
||||||
|
if [ ! -f "$INPUT" ]; then
|
||||||
|
fatal_error "$INPUT: missing input and output arguments"
|
||||||
|
elif [ ! -f "$INPUT" ]; then
|
||||||
|
fatal_error "$INPUT: no such file"
|
||||||
|
elif [ ! -f "$INPUT" ]; then
|
||||||
|
fatal_error "$INPUT: missing output argument"
|
||||||
|
elif [ x"$INPUT" = x"$OUTPUT" ]; then
|
||||||
|
fatal_error "$INPUT: input and output file can't be the same"
|
||||||
|
fi
|
||||||
|
|
||||||
|
"$COSMO/o/third_party/gcc/bin/$ARCH-linux-musl-objcopy" \
|
||||||
|
$OBJCOPYFLAGS \
|
||||||
|
"$INPUT" \
|
||||||
|
"$OUTPUT" || exit
|
||||||
|
"$COSMO/o//tool/build/zipcopy.com" \
|
||||||
|
"$INPUT" \
|
||||||
|
"$OUTPUT" || exit
|
267
bin/cosmocc
267
bin/cosmocc
|
@ -11,43 +11,43 @@
|
||||||
# ape-install # optionally install a faster systemwide ape loader
|
# ape-install # optionally install a faster systemwide ape loader
|
||||||
# cosmocc --update # pull and rebuild toolchain artifacts
|
# cosmocc --update # pull and rebuild toolchain artifacts
|
||||||
#
|
#
|
||||||
# building open source projects
|
# getting started synopsis
|
||||||
#
|
#
|
||||||
# export CC=cosmocc
|
# cosmocc -o hello.com hello.c
|
||||||
# export CXX=cosmoc++
|
# ./foo.com
|
||||||
# ./configure --prefix=/opt/cosmos
|
# ./foo.com --strace
|
||||||
# make -j
|
# ./foo.com --ftrace
|
||||||
# make install
|
|
||||||
#
|
#
|
||||||
# cosmopolitan runtime flags
|
# how to build a project like lua 5.4.6
|
||||||
#
|
#
|
||||||
# ./hello.com --strace
|
# make all test CC=cosmocc
|
||||||
# ./hello.com --ftrace
|
# src/lua -e 'print("hi")'
|
||||||
|
# make install INSTALL_TOP=/opt/cosmos
|
||||||
|
# apecopy src/lua src/lua.com # convert to portable ape binary
|
||||||
#
|
#
|
||||||
# cosmpolitan runtime libraries
|
# how to cross compile a project like lua 5.4.6
|
||||||
#
|
#
|
||||||
# #include <cosmo.h>
|
# aarch64-unknown-cosmo-cc --update
|
||||||
# int main() {
|
# make clean all test CC=aarch64-unknown-cosmo-cc AR='aarch64-unknown-cosmo-ar rc' -j8
|
||||||
# ShowCrashReports();
|
# qemu-aarch64 src/lua -e 'print("hi")'
|
||||||
# __builtin_trap();
|
# make install INSTALL_TOP=/opt/cosmos/aarch64
|
||||||
# }
|
|
||||||
#
|
#
|
||||||
# building in tiny mode
|
# building in tiny mode
|
||||||
#
|
#
|
||||||
# export MODE=tiny
|
# export MODE=tiny
|
||||||
# (cd /opt/cosmo; make -j8 toolchain)
|
# cosmocc --update
|
||||||
# cosmocc -Os -o foo.com foo.c
|
# cosmocc -Os -o foo.com foo.c
|
||||||
#
|
#
|
||||||
# building in tiniest mode (linux only)
|
# building in tiniest mode (linux only)
|
||||||
#
|
#
|
||||||
# export MODE=tinylinux
|
# export MODE=tinylinux
|
||||||
# (cd /opt/cosmo; make -j8 toolchain)
|
# cosmocc --update
|
||||||
# cosmocc -Os -o foo.com foo.c
|
# cosmocc -Os -o foo.com foo.c
|
||||||
#
|
#
|
||||||
# hardening programs with memory safety
|
# hardening programs with memory safety
|
||||||
#
|
#
|
||||||
# export MODE=asan
|
# export MODE=asan
|
||||||
# (cd /opt/cosmo; make -j8 toolchain)
|
# cosmocc --update
|
||||||
# cosmocc -o foo.com foo.c
|
# cosmocc -o foo.com foo.c
|
||||||
#
|
#
|
||||||
# detecting this environment
|
# detecting this environment
|
||||||
|
@ -77,74 +77,134 @@
|
||||||
# for further details, run `man gcc`
|
# for further details, run `man gcc`
|
||||||
|
|
||||||
PROG=${0##*/}
|
PROG=${0##*/}
|
||||||
MODE=${MODE:-$m}
|
|
||||||
COSMO=${COSMO:-/opt/cosmo}
|
COSMO=${COSMO:-/opt/cosmo}
|
||||||
COSMOS=${COSMOS:-/opt/cosmos}
|
|
||||||
GCC_VERSION=11.2.0
|
GCC_VERSION=11.2.0
|
||||||
|
|
||||||
if [ "$1" = "--version" ]; then
|
if [ "$1" = "--version" ]; then
|
||||||
# note: only the underlying gcc compiler binaries are gpl
|
|
||||||
# our shell script is released with the isc license
|
|
||||||
# absolutely zero cosmo runtime libraries are gpl'd
|
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
$PROG (GCC) $GCC_VERSION
|
$PROG (GCC) $GCC_VERSION
|
||||||
|
Copyright (c) 2023 Justine Alexandra Roberts Tunney
|
||||||
|
Cosmopolitan Libc and LLVM libcxx/compiler-rt are subject to non-GPL
|
||||||
|
notice licenses, e.g. ISC, MIT, etc. Your compiled programs must embed
|
||||||
|
our copyright notices. This toolchain is configured to do so default.
|
||||||
|
Cosmopolitan comes with absolutely NO WARRANTY of any kind.
|
||||||
|
For more information, see the Cosmopolitan LICENSE files.
|
||||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||||
This is free software; see the source for copying conditions. There is NO
|
This launches GNU GCC/Binutils subprocesses, which is free software; see
|
||||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
Cosmopolitan's third_party/gcc/ for source code and copying conditions.
|
||||||
|
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE.
|
||||||
EOF
|
EOF
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
fatal_error() {
|
||||||
|
echo "$PROG: fatal error: $1" >&2
|
||||||
|
echo "compilation terminated." >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
log_command() {
|
||||||
|
if [ -n "$BUILDLOG" ]; then
|
||||||
|
printf '# %s\n(cd %s; %s)\n' "$ORIGINAL" "$PWD" "$*" >>"$BUILDLOG"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
ORIGINAL="$0 $*"
|
||||||
|
PLATFORM="-D__COSMOPOLITAN__ -D__COSMOCC__"
|
||||||
|
PREDEF="-include libc/integral/normalize.inc"
|
||||||
|
CFLAGS="-fportcosmo"
|
||||||
|
CPPFLAGS="-fno-pie -nostdinc -iquote $COSMO"
|
||||||
|
LDFLAGS="-static -no-pie -nostdlib -fuse-ld=bfd"
|
||||||
|
APEFLAGS="-Wl,--gc-sections"
|
||||||
|
PRECIOUS="-fno-omit-frame-pointer"
|
||||||
|
|
||||||
|
CROSS=1
|
||||||
|
ARCH=${PROG%%-*} # split(prog, '-')[0]
|
||||||
|
if [ x"$ARCH" = x"$PROG" ]; then
|
||||||
|
ARCH=x86_64
|
||||||
|
CROSS=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$ARCH" = x"x86_64" ]; then
|
||||||
|
MODE=${MODE:-$m}
|
||||||
|
else
|
||||||
|
MODE=${MODE:-${m:-$ARCH}}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $CROSS -eq 0 ]; then
|
||||||
|
COSMOS=${COSMOS:-/opt/cosmos}
|
||||||
|
else
|
||||||
|
COSMOS=${COSMOS:-/opt/cosmos/$ARCH}
|
||||||
|
fi
|
||||||
|
|
||||||
|
CC="$COSMO/o/third_party/gcc/bin/$ARCH-linux-musl-gcc"
|
||||||
|
CRT="$COSMO/o/$MODE/libc/crt/crt.o"
|
||||||
|
LDLIBS="$COSMO/o/$MODE/cosmopolitan.a"
|
||||||
|
CPPFLAGS="$CPPFLAGS -isystem $COSMOS/include -isystem $COSMO/libc/isystem"
|
||||||
|
LDFLAGS="$LDFLAGS -L$COSMOS/lib"
|
||||||
|
if [ x"$PROG" != x"${PROG%++}" ]; then
|
||||||
|
CC="$COSMO/o/third_party/gcc/bin/$ARCH-linux-musl-g++"
|
||||||
|
CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -fuse-cxa-atexit"
|
||||||
|
LDLIBS="$COSMO/o/$MODE/third_party/libcxx/libcxx.a $LDLIBS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
PAGESZ=4096
|
||||||
|
if [ x"$ARCH" = x"x86_64" ]; then
|
||||||
|
OBJCOPYFLAGS="-S -O binary"
|
||||||
|
CRT="$COSMO/o/$MODE/ape/ape-no-modify-self.o $CRT"
|
||||||
|
CPPFLAGS="$CPPFLAGS -mno-red-zone"
|
||||||
|
CFLAGS="$CFLAGS -mno-tls-direct-seg-refs"
|
||||||
|
LDFLAGS="$LDFLAGS -Wl,-T,$COSMO/o/$MODE/ape/public/ape.lds"
|
||||||
|
if [ x"$MODE" = x"aarch64" ]; then
|
||||||
|
fatal_error '$MODE must not be aarch64 when using x86_64 cross compiler'
|
||||||
|
elif [ x"$MODE" != x"${MODE#* }" ]; then
|
||||||
|
fatal_error '$MODE must not contain hyphens when targeting x86_64'
|
||||||
|
fi
|
||||||
|
elif [ x"$ARCH" = x"aarch64" ]; then
|
||||||
|
OBJCOPYFLAGS="-S"
|
||||||
|
PAGESZ=16384
|
||||||
|
CFLAGS="$CFLAGS -ffixed-x18 -ffixed-x28 -mno-outline-atomics"
|
||||||
|
LDFLAGS="$LDFLAGS -Wl,-T,$COSMO/o/$MODE/ape/aarch64.lds"
|
||||||
|
if [ x"$MODE" != x"aarch64" ] && [ x"$MODE" = x"${MODE#aarch64-*}" ]; then
|
||||||
|
fatal_error '$MODE must be either "aarch64" or "aarch64-FOO" when using aarch64 cross compiler'
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
fatal_error "$ARCH: unsupported architecture"
|
||||||
|
fi
|
||||||
|
|
||||||
|
LDFLAGS="$LDFLAGS -Wl,-z,common-page-size=$PAGESZ -Wl,-z,max-page-size=$PAGESZ"
|
||||||
|
|
||||||
|
if [ ! -d "$COSMO" ]; then
|
||||||
|
fatal_error "you need to clone cosmopolitan to your $COSMO directory"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$1" = "--update" ]; then
|
if [ "$1" = "--update" ]; then
|
||||||
cd /opt/cosmo || exit
|
cd /opt/cosmo || exit
|
||||||
if GIT=$(command -v git); then
|
if GIT=$(command -v git); then
|
||||||
echo "$PROG: running git pull on cosmo..." >&2
|
echo "running git pull on cosmo..." >&2
|
||||||
"$GIT" pull --quiet || exit
|
"$GIT" pull --quiet || exit
|
||||||
fi
|
fi
|
||||||
echo "$PROG: building cosmo x86_64 toolchain..." >&2
|
echo "building cosmo host toolchain..." >&2
|
||||||
make --silent -j toolchain MODE="${MODE}" || exit
|
make --silent -j toolchain MODE= || exit
|
||||||
"$COSMO/tool/scripts/setup-cosmos"
|
echo "building cosmo target (MODE=$MODE) toolchain..." >&2
|
||||||
echo "$PROG: successfully updated your cosmo toolchain" >&2
|
make --silent -j toolchain MODE="$MODE" || exit
|
||||||
|
echo "setting up your cosmos..." >&2
|
||||||
|
mkdir -p "$COSMOS/lib" || exit
|
||||||
|
for lib in c dl gcc_s m pthread resolv rt dl z stdc++; do
|
||||||
|
if [ ! -f "$COSMOS/lib/lib${lib}.a" ]; then
|
||||||
|
printf '\041\074\141\162\143\150\076\012' >"$COSMOS/lib/lib${lib}.a" || exit
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "successfully updated your cosmo toolchain" >&2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CC="$COSMO/o/third_party/gcc/bin/x86_64-linux-musl-gcc"
|
if [ ! -f "$COSMOS/lib/libc.a" ] ||
|
||||||
ORIGINAL="$0 $*"
|
|
||||||
PLATFORM="-D__COSMOPOLITAN__"
|
|
||||||
PREDEF="-include libc/integral/normalize.inc"
|
|
||||||
CCFLAGS="-fno-pie -mno-tls-direct-seg-refs -mno-red-zone -fportcosmo"
|
|
||||||
CPPFLAGS="-nostdinc -iquote $COSMO -isystem $COSMOS/include -isystem $COSMO/libc/isystem"
|
|
||||||
LDFLAGS="-static -no-pie -nostdlib -fuse-ld=bfd -Wl,-melf_x86_64 -Wl,-z,common-page-size=4096 -Wl,-z,max-page-size=4096"
|
|
||||||
APEFLAGS="-L$COSMOS/lib -Wl,--gc-sections -Wl,-T,$COSMO/o/$MODE/ape/public/ape.lds $COSMO/o/$MODE/ape/ape-no-modify-self.o $COSMO/o/$MODE/libc/crt/crt.o"
|
|
||||||
LDLIBS="$COSMO/o/$MODE/cosmopolitan.a"
|
|
||||||
|
|
||||||
if [ x"$0" != x"${0%++}" ]; then
|
|
||||||
CC="$COSMO/o/third_party/gcc/bin/x86_64-linux-musl-g++"
|
|
||||||
CCFLAGS="$CCFLAGS -fno-rtti -fno-exceptions -fuse-cxa-atexit"
|
|
||||||
LDLIBS="$COSMO/o/$MODE/third_party/libcxx/libcxx.a $LDLIBS"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d "$COSMO" ]; then
|
|
||||||
echo "$PROG: you need to clone cosmopolitan to your $COSMO directory" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d "$COSMOS" ] ||
|
|
||||||
[ ! -f "$COSMO/o/$MODE/cosmopolitan.a" ]; then
|
[ ! -f "$COSMO/o/$MODE/cosmopolitan.a" ]; then
|
||||||
echo "$PROG: you need to run: $PROG --update" >&2
|
fatal_error "you need to run: $PROG --update"
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# auto-install some shell libraries
|
|
||||||
if [ ! -d "$COSMOS/lib" ]; then
|
|
||||||
mkdir -p "$COSMOS/lib"
|
|
||||||
fi
|
|
||||||
for lib in c dl gcc_s m pthread resolv rt dl z stdc++; do
|
|
||||||
if [ ! -f "$COSMOS/lib/lib$lib.a" ]; then
|
|
||||||
printf '\041\074\141\162\143\150\076\012' >"$COSMOS/lib/lib$lib.a"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
OPT=
|
OPT=
|
||||||
FIRST=1
|
FIRST=1
|
||||||
OUTPUT=
|
OUTPUT=
|
||||||
|
@ -203,7 +263,7 @@ for x; do
|
||||||
elif [ x"$x" = x"-fsanitize=all" ] ||
|
elif [ x"$x" = x"-fsanitize=all" ] ||
|
||||||
[ x"$x" = x"-fsanitize=address" ] ||
|
[ x"$x" = x"-fsanitize=address" ] ||
|
||||||
[ x"$x" = x"-fsanitize=undefined" ]; then
|
[ x"$x" = x"-fsanitize=undefined" ]; then
|
||||||
echo "$PROG: use cosmo MODE=dbg rather than passing $x" >&2
|
echo "$PROG: use cosmo MODE=dbg or MODE=asan rather than passing $x" >&2
|
||||||
exit 1
|
exit 1
|
||||||
elif [ x"$x" = x"-fomit-frame-pointer" ]; then
|
elif [ x"$x" = x"-fomit-frame-pointer" ]; then
|
||||||
# Quoth Apple "The frame pointer register must always address a
|
# Quoth Apple "The frame pointer register must always address a
|
||||||
|
@ -219,7 +279,11 @@ for x; do
|
||||||
# elevating warnings into errors, should only be done by devs
|
# elevating warnings into errors, should only be done by devs
|
||||||
continue
|
continue
|
||||||
elif [ x"$x" = x"-march=native" ]; then
|
elif [ x"$x" = x"-march=native" ]; then
|
||||||
set -- "$@" $("$COSMO/o/$MODE/tool/build/march-native.com")
|
if [ $CROSS -eq 0 ]; then
|
||||||
|
set -- "$@" $("$COSMO/o//tool/build/march-native.com")
|
||||||
|
else
|
||||||
|
fatal_error "-march=native can't be used when cross compiling"
|
||||||
|
fi
|
||||||
continue
|
continue
|
||||||
elif [ x"$x" = x"-dumpversion" ]; then
|
elif [ x"$x" = x"-dumpversion" ]; then
|
||||||
echo $GCC_VERSION
|
echo $GCC_VERSION
|
||||||
|
@ -229,55 +293,66 @@ for x; do
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$GOT_SOME" -eq 0 ]; then
|
if [ "$GOT_SOME" -eq 0 ]; then
|
||||||
echo "$PROG: fatal error: no input files" >&2
|
fatal_error "no input files"
|
||||||
echo "compilation terminated." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $RELOCATABLE -eq 1 ]; then
|
if [ $RELOCATABLE -eq 1 ]; then
|
||||||
APEFLAGS="-r"
|
LDFLAGS="$LDFLAGS -r"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ x"$MODE" = x"nox87" ]; then
|
if [ x"$MODE" = x"nox87" ]; then
|
||||||
CCFLAGS="$CCFLAGS -mlong-double-64"
|
CPPFLAGS="$CPPFLAGS -mlong-double-64"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# support --ftrace unless optimizing for size
|
||||||
if [ x"$OPT" != x"-Os" ] && # $OPT != -Os
|
if [ x"$OPT" != x"-Os" ] && # $OPT != -Os
|
||||||
[ x"${MODE%tiny}" = x"${MODE}" ]; then # $MODE not in (tiny, aarch64-tiny)
|
[ x"${MODE%tiny}" = x"${MODE}" ]; then # $MODE not in (tiny, aarch64-tiny)
|
||||||
# support --ftrace unless optimizing for size
|
if [ x"$ARCH" = x"x86_64" ]; then
|
||||||
CCFLAGS="$CCFLAGS -fpatchable-function-entry=18,16"
|
CFLAGS="$CFLAGS -fpatchable-function-entry=18,16"
|
||||||
|
elif [ x"$ARCH" = x"aarch64" ]; then
|
||||||
|
CFLAGS="$CFLAGS -fpatchable-function-entry=7,6"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ x"$MODE" = x"dbg" ]; then
|
# ask compiler to generate sanitization code in debug mode
|
||||||
set -- \
|
if [ x"$MODE" != x"${MODE%*dbg}" ]; then # endswith($MODE, "dbg")
|
||||||
-fsanitize=address \
|
if [ x"$ARCH" = x"x86_64" ]; then
|
||||||
-fsanitize=undefined \
|
CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
|
||||||
"$@"
|
else
|
||||||
|
CPPFLAGS="$CPPFLAGS -fsanitize=undefined"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ x"$OPT" != x"-Os" ] &&
|
# ask compiler to generate memory safety code in asan mode
|
||||||
[ x"${MODE#tiny}" != x"${MODE}" ]; then
|
if [ x"$MODE" != x"${MODE%*asan}" ]; then # endswith($MODE, "asan")
|
||||||
set -- \
|
if [ x"$ARCH" = x"x86_64" ]; then
|
||||||
-fno-optimize-sibling-calls \
|
CPPFLAGS="$CPPFLAGS -fsanitize=address"
|
||||||
-mno-omit-leaf-frame-pointer \
|
else
|
||||||
"$@"
|
fatal_error "address sanitizer not supported on non-x86 yet"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# maximize frame pointers unless optimizing for size
|
||||||
|
if [ x"$OPT" != x"-Os" ] && # $OPT != "-Os"
|
||||||
|
[ x"$MODE" != x"${MODE%tiny}" ]; then # endswith($MODE, "tiny")
|
||||||
|
CFLAGS="$CFLAGS -fno-optimize-sibling-calls -mno-omit-leaf-frame-pointer"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $INTENT = cpp ]; then
|
if [ $INTENT = cpp ]; then
|
||||||
set -- "$CC" $PLATFORM $CCFLAGS $CPPFLAGS "$@"
|
set -- "$CC" $PLATFORM $CPPFLAGS "$@"
|
||||||
elif [ $INTENT = cc ]; then
|
elif [ $INTENT = cc ]; then
|
||||||
set -- "$CC" $PLATFORM $PREDEF $CCFLAGS $CPPFLAGS "$@" -fno-omit-frame-pointer
|
set -- "$CC" $PLATFORM $PREDEF $CFLAGS $CPPFLAGS "$@" $PRECIOUS
|
||||||
else
|
else
|
||||||
set -- "$CC" $PLATFORM $PREDEF $CCFLAGS $CPPFLAGS $CPPFLAGS "$@" \
|
set -- "$CC" $PLATFORM $PREDEF $CFLAGS $CPPFLAGS $CRT "$@" $LDFLAGS $LDLIBS $PRECIOUS
|
||||||
$LDFLAGS $APEFLAGS $LDLIBS -fno-omit-frame-pointer
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf '# %s\n(cd %s; %s)\n' "$ORIGINAL" "$PWD" "$*" >>"${TMPDIR:-/tmp}/build.log"
|
log_command "$@"
|
||||||
"$@" || exit
|
"$@" || exit
|
||||||
|
|
||||||
if [ -n "$OUTPUT" ] && [ -f "$OUTPUT" ]; then
|
if [ -n "$OUTPUT" ] && [ -f "$OUTPUT" ]; then
|
||||||
if [ $INTENT = cc ] || [ $INTENT = ld ]; then
|
if [ $INTENT = cc ] || [ $INTENT = ld ]; then
|
||||||
"$COSMO/o/$MODE/tool/build/fixupobj.com" "$OUTPUT" || exit
|
"$COSMO/o//tool/build/fixupobj.com" \
|
||||||
|
"$OUTPUT" || exit
|
||||||
fi
|
fi
|
||||||
if [ $INTENT = ld ]; then
|
if [ $INTENT = ld ]; then
|
||||||
if [ x"$OUTPUT" != x"${OUTPUT%.com}" ] ||
|
if [ x"$OUTPUT" != x"${OUTPUT%.com}" ] ||
|
||||||
|
@ -286,10 +361,16 @@ if [ -n "$OUTPUT" ] && [ -f "$OUTPUT" ]; then
|
||||||
# -> foo.com (ape)
|
# -> foo.com (ape)
|
||||||
# -> foo.com.dbg (elf)
|
# -> foo.com.dbg (elf)
|
||||||
mv -f "$OUTPUT" "$OUTPUT.dbg" || exit
|
mv -f "$OUTPUT" "$OUTPUT.dbg" || exit
|
||||||
"$COSMO/o/third_party/gcc/bin/x86_64-linux-musl-objcopy" -S -O binary "$OUTPUT.dbg" "$OUTPUT" || exit
|
"$COSMO/o/third_party/gcc/bin/$ARCH-linux-musl-objcopy" \
|
||||||
"$COSMO/o/$MODE/tool/build/zipcopy.com" "$OUTPUT.dbg" "$OUTPUT" || exit
|
$OBJCOPYFLAGS \
|
||||||
|
"$OUTPUT.dbg" \
|
||||||
|
"$OUTPUT" || exit
|
||||||
|
"$COSMO/o//tool/build/zipcopy.com" \
|
||||||
|
"$OUTPUT.dbg" \
|
||||||
|
"$OUTPUT" || exit
|
||||||
elif [ $SFLAG -eq 1 ]; then
|
elif [ $SFLAG -eq 1 ]; then
|
||||||
"$COSMO/o/third_party/gcc/bin/x86_64-linux-musl-strip" "$OUTPUT" || exit
|
"$COSMO/o/third_party/gcc/bin/$ARCH-linux-musl-strip" \
|
||||||
|
"$OUTPUT" || exit
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -9,7 +9,7 @@ fatal_error() {
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ ! -x "$COSMO/o/$MODE/tool/build/ar.com" ]; then
|
if [ ! -x "$COSMO/o//tool/build/ar.com" ]; then
|
||||||
fatal_error "you need to run: fatcosmocc --update"
|
fatal_error "you need to run: fatcosmocc --update"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@ if [ x"$1" = x"rc" ] ||
|
||||||
# binutils ar is accidentally quadratic
|
# binutils ar is accidentally quadratic
|
||||||
# cosmopolitan ar is significantly faster
|
# cosmopolitan ar is significantly faster
|
||||||
# it'll also use tricks like copy_file_range
|
# it'll also use tricks like copy_file_range
|
||||||
AR_X86_64="$COSMO/o/$MODE/tool/build/ar.com"
|
AR_X86_64="$COSMO/o//tool/build/ar.com"
|
||||||
AR_AARCH64="$COSMO/o/$MODE/tool/build/ar.com"
|
AR_AARCH64="$COSMO/o//tool/build/ar.com"
|
||||||
if [ "$1" = "--help" ] ||
|
if [ "$1" = "--help" ] ||
|
||||||
[ "$1" = "--version" ]; then
|
[ "$1" = "--version" ]; then
|
||||||
exec "$AR_X86_64" "$1"
|
exec "$AR_X86_64" "$1"
|
||||||
|
|
|
@ -109,15 +109,19 @@ export TMPDIR=${TMPDIR:-/tmp}
|
||||||
GCC_VERSION=11.2.0
|
GCC_VERSION=11.2.0
|
||||||
|
|
||||||
if [ "$1" = "--version" ]; then
|
if [ "$1" = "--version" ]; then
|
||||||
# note: only the underlying gcc compiler binaries are gpl
|
|
||||||
# our shell script is released with the isc license
|
|
||||||
# absolutely zero cosmo runtime libraries are gpl'd
|
|
||||||
# and the apelink.com program is definitely not gpl
|
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
$PROG (GCC) $GCC_VERSION
|
$PROG (GCC) $GCC_VERSION
|
||||||
|
Copyright (c) 2023 Justine Alexandra Roberts Tunney
|
||||||
|
Cosmopolitan Libc and LLVM libcxx/compiler-rt are subject to non-GPL
|
||||||
|
notice licenses, e.g. ISC, MIT, etc. Your compiled programs must embed
|
||||||
|
our copyright notices. This toolchain is configured to do so default.
|
||||||
|
Cosmopolitan comes with absolutely NO WARRANTY of any kind.
|
||||||
|
For more information, see the Cosmopolitan LICENSE files.
|
||||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||||
This is free software; see the source for copying conditions. There is NO
|
This launches GNU GCC/Binutils subprocesses, which is free software; see
|
||||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
Cosmopolitan's third_party/gcc/ for source code and copying conditions.
|
||||||
|
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE.
|
||||||
EOF
|
EOF
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
@ -147,15 +151,25 @@ fi
|
||||||
if [ "$1" = "--update" ]; then
|
if [ "$1" = "--update" ]; then
|
||||||
cd /opt/cosmo || exit
|
cd /opt/cosmo || exit
|
||||||
if GIT=$(command -v git); then
|
if GIT=$(command -v git); then
|
||||||
echo "$PROG: running git pull on cosmo..." >&2
|
echo "running git pull on cosmo..." >&2
|
||||||
"$GIT" pull --quiet || exit
|
"$GIT" pull --quiet || exit
|
||||||
fi
|
fi
|
||||||
echo "$PROG: building cosmo x86_64 toolchain..." >&2
|
echo "building cosmo host toolchain..." >&2
|
||||||
make --silent -j toolchain MODE="${MODE}" || exit
|
make --silent -j toolchain MODE= || exit
|
||||||
echo "$PROG: building cosmo aarch64 toolchain..." >&2
|
echo "building cosmo x86_64 target (MODE=$MODE) toolchain..." >&2
|
||||||
make --silent -j toolchain MODE="${MODE_AARCH64}" || exit
|
make --silent -j toolchain MODE="$MODE" || exit
|
||||||
"$COSMO/tool/scripts/setup-cosmos"
|
echo "building cosmo aarch64 target (MODE=$MODE_AARCH64) toolchain..." >&2
|
||||||
echo "$PROG: successfully updated your cosmo toolchain" >&2
|
make --silent -j toolchain MODE="$MODE_AARCH64" || exit
|
||||||
|
echo "setting up your cosmos..." >&2
|
||||||
|
for arch in "" .aarch64/; do
|
||||||
|
mkdir -p "$COSMOS/lib/$arch" || exit
|
||||||
|
for lib in c dl gcc_s m pthread resolv rt dl z stdc++; do
|
||||||
|
if [ ! -f "$COSMOS/lib/${arch}lib${lib}.a" ]; then
|
||||||
|
printf '\041\074\141\162\143\150\076\012' >"$COSMOS/lib/${arch}lib${lib}.a" || exit
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
echo "successfully updated your cosmo toolchain" >&2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -164,14 +178,15 @@ if [ ! -d "$COSMO" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d "$COSMOS" ] ||
|
if [ ! -f "$COSMOS/lib/libc.a" ] ||
|
||||||
|
[ ! -f "$COSMOS/lib/.aarch64/libc.a" ] ||
|
||||||
[ ! -f "$COSMO/o/$MODE/cosmopolitan.a" ] ||
|
[ ! -f "$COSMO/o/$MODE/cosmopolitan.a" ] ||
|
||||||
[ ! -f "$COSMO/o/$MODE_AARCH64/cosmopolitan.a" ]; then
|
[ ! -f "$COSMO/o/$MODE_AARCH64/cosmopolitan.a" ]; then
|
||||||
echo "$PROG: you need to run: $PROG --update" >&2
|
echo "$PROG: you need to run: $PROG --update" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export FIXUPOBJ="$COSMO/o/$MODE/tool/build/fixupobj.com"
|
export FIXUPOBJ="$COSMO/o//tool/build/fixupobj.com"
|
||||||
|
|
||||||
TEMP_FILES=
|
TEMP_FILES=
|
||||||
SAVE_TEMPS=0
|
SAVE_TEMPS=0
|
||||||
|
@ -307,6 +322,8 @@ for x; do
|
||||||
[ x"$x" = x"-shared-libgcc" ]; then
|
[ x"$x" = x"-shared-libgcc" ]; then
|
||||||
# cosmopolitan.a always has llvm compiler runtime static code
|
# cosmopolitan.a always has llvm compiler runtime static code
|
||||||
continue
|
continue
|
||||||
|
elif [ x"$x" = x"-march=native" ]; then
|
||||||
|
fatal_error "-march=native can't be used when building fat binaries"
|
||||||
elif [ x"$x" = x"-dumpversion" ]; then
|
elif [ x"$x" = x"-dumpversion" ]; then
|
||||||
echo $GCC_VERSION
|
echo $GCC_VERSION
|
||||||
Exit 0
|
Exit 0
|
||||||
|
@ -395,7 +412,7 @@ mangle_object_path() {
|
||||||
}
|
}
|
||||||
|
|
||||||
mktemper() {
|
mktemper() {
|
||||||
"$COSMO/o/$MODE/tool/build/mktemper.com" \
|
"$COSMO/o//tool/build/mktemper.com" \
|
||||||
"$TMPDIR/fatcosmocc.XXXXXXXXXXXXX$1"
|
"$TMPDIR/fatcosmocc.XXXXXXXXXXXXX$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -493,8 +510,8 @@ if [ $INTENT != ld ]; then
|
||||||
Exit
|
Exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
OUTPUT_X86_64="$OUTPUT.x86_64"
|
OUTPUT_X86_64=$(mktemper ".com.dbg") || Exit
|
||||||
OUTPUT_AARCH64="$OUTPUT.aarch64"
|
OUTPUT_AARCH64=$(mktemper ".aarch64.elf") || Exit
|
||||||
|
|
||||||
out2=$(mktemper .txt) || Exit
|
out2=$(mktemper .txt) || Exit
|
||||||
TEMP_FILES="${TEMP_FILES} $out2"
|
TEMP_FILES="${TEMP_FILES} $out2"
|
||||||
|
@ -516,7 +533,7 @@ if ! wait $pid2; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set -- \
|
set -- \
|
||||||
"$COSMO/o/$MODE/tool/build/apelink.com" \
|
"$COSMO/o//tool/build/apelink.com" \
|
||||||
-l "$COSMO/o/$MODE/ape/ape.elf" \
|
-l "$COSMO/o/$MODE/ape/ape.elf" \
|
||||||
-l "$COSMO/o/$MODE_AARCH64/ape/ape.elf" \
|
-l "$COSMO/o/$MODE_AARCH64/ape/ape.elf" \
|
||||||
-M "$COSMO/ape/ape-m1.c" \
|
-M "$COSMO/ape/ape-m1.c" \
|
||||||
|
@ -528,13 +545,13 @@ log_command "$@"
|
||||||
"$@" || Exit
|
"$@" || Exit
|
||||||
|
|
||||||
set -- \
|
set -- \
|
||||||
"$COSMO/o/$MODE/tool/build/pecheck.com" "$OUTPUT"
|
"$COSMO/o//tool/build/pecheck.com" "$OUTPUT"
|
||||||
log_command "$@"
|
log_command "$@"
|
||||||
"$@" || Exit
|
"$@" || Exit
|
||||||
|
|
||||||
if [ $INTENT = ld ] && [ $SAVE_TEMPS -eq 0 ]; then
|
if [ $INTENT = ld ] && [ $SAVE_TEMPS -eq 0 ]; then
|
||||||
rm -f "$OUTPUT_X86_64" \
|
mv -f "$OUTPUT_X86_64" "${OUTPUT%.com}.com.dbg" || Exit
|
||||||
"$OUTPUT_AARCH64"
|
mv -f "$OUTPUT_AARCH64" "${OUTPUT%.com}.aarch64.elf" || Exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
Exit
|
Exit
|
||||||
|
|
1
bin/unknown-unknown-cosmo-install
Symbolic link
1
bin/unknown-unknown-cosmo-install
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
fatcosmoinstall
|
1
bin/x86_64-unknown-cosmo-apecopy
Symbolic link
1
bin/x86_64-unknown-cosmo-apecopy
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
apecopy
|
13
bin/x86_64-unknown-cosmo-objdump
Executable file
13
bin/x86_64-unknown-cosmo-objdump
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
MODE=${MODE:-$m}
|
||||||
|
COSMO=${COSMO:-/opt/cosmo}
|
||||||
|
COSMOS=${COSMOS:-/opt/cosmos}
|
||||||
|
TOOL="$COSMO/o/third_party/gcc/bin/x86_64-linux-musl-objdump"
|
||||||
|
|
||||||
|
if [ ! -x "$TOOL" ]; then
|
||||||
|
echo "$0: you need to run: cosmocc --update" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$TOOL" "$@"
|
1
third_party/gcc/libexec/gcc/aarch64-linux-musl/11.2.0/ld.bfd.sym
vendored
Normal file
1
third_party/gcc/libexec/gcc/aarch64-linux-musl/11.2.0/ld.bfd.sym
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
../../../../bin/aarch64-linux-musl-ld.bfd
|
|
@ -1,14 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
COSMOS=${COSMOS:-/opt/cosmos}
|
|
||||||
|
|
||||||
for arch in "" .aarch64/; do
|
|
||||||
if [ ! -d "$COSMOS/lib/${arch}" ]; then
|
|
||||||
mkdir -p "$COSMOS/lib/${arch}"
|
|
||||||
fi
|
|
||||||
for lib in c dl gcc_s m pthread resolv rt dl z stdc++; do
|
|
||||||
if [ ! -f "$COSMOS/lib/${arch}lib${lib}.a" ]; then
|
|
||||||
printf '\041\074\141\162\143\150\076\012' >"$COSMOS/lib/${arch}lib${lib}.a"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
Loading…
Add table
Add a link
Reference in a new issue