Further improve usability of cosmocc

- Support -s flag in cosmocc
- Support posix_spawn() setsid() feature
- Disable monorepo debug path prefix stripping
This commit is contained in:
Justine Tunney 2023-07-10 05:55:00 -07:00
parent f7ae50462a
commit ee6566a152
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
9 changed files with 40 additions and 15 deletions

View file

@ -78,6 +78,7 @@ APEFLAGS="-L$COSMOS/lib -Wl,--gc-sections -Wl,-T,$COSMO/o/$MODE/ape/public/ape.l
LDLIBS="$COSMO/o/$MODE/third_party/libcxx/libcxx.a $COSMO/o/$MODE/cosmopolitan.a"
CXX="$COSMO/o/third_party/gcc/bin/x86_64-linux-musl-g++"
STRIP="$COSMO/o/third_party/gcc/bin/x86_64-linux-musl-strip"
OBJCOPY="$COSMO/o/third_party/gcc/bin/x86_64-linux-musl-objcopy"
FIXUPOBJ="$COSMO/o/$MODE/tool/build/fixupobj.com"
ZIPCOPY="$COSMO/o/$MODE/tool/build/zipcopy.com"
@ -115,6 +116,7 @@ done
OPT=
FIRST=1
OUTPUT=
SFLAG=0
INTENT=ld
NEED_OUTPUT=
RELOCATABLE=0
@ -140,6 +142,9 @@ for x; do
OPT=$x
elif [ x"$x" = x"-c" ]; then
INTENT=cc
elif [ x"$x" = x"-s" ]; then
SFLAG=1
continue
elif [ x"$x" = x"-r" ]; then
RELOCATABLE=1
elif [ x"$x" = x"-E" ]; then
@ -204,6 +209,8 @@ if [ -n "$OUTPUT" ] && [ -f "$OUTPUT" ]; then
mv -f "$OUTPUT" "$OUTPUT.dbg" || exit
"$OBJCOPY" -S -O binary "$OUTPUT.dbg" "$OUTPUT" || exit
"$ZIPCOPY" "$OUTPUT.dbg" "$OUTPUT" || exit
elif [ $SFLAG -eq 1 ]; then
"$STRIP" "$OUTPUT" || exit
fi
fi
fi

View file

@ -78,6 +78,7 @@ APEFLAGS="-L$COSMOS/lib -Wl,--gc-sections -Wl,-T,$COSMO/o/$MODE/ape/public/ape.l
LDLIBS="$COSMO/o/$MODE/cosmopolitan.a"
CC="$COSMO/o/third_party/gcc/bin/x86_64-linux-musl-gcc"
STRIP="$COSMO/o/third_party/gcc/bin/x86_64-linux-musl-strip"
OBJCOPY="$COSMO/o/third_party/gcc/bin/x86_64-linux-musl-objcopy"
FIXUPOBJ="$COSMO/o/$MODE/tool/build/fixupobj.com"
ZIPCOPY="$COSMO/o/$MODE/tool/build/zipcopy.com"
@ -115,6 +116,7 @@ done
OPT=
FIRST=1
OUTPUT=
SFLAG=0
INTENT=ld
NEED_OUTPUT=
RELOCATABLE=0
@ -138,6 +140,9 @@ for x; do
OPT=$x
elif [ x"$x" = x"-c" ]; then
INTENT=cc
elif [ x"$x" = x"-s" ]; then
SFLAG=1
continue
elif [ x"$x" = x"-r" ]; then
RELOCATABLE=1
elif [ x"$x" = x"-E" ]; then
@ -202,6 +207,8 @@ if [ -n "$OUTPUT" ] && [ -f "$OUTPUT" ]; then
mv -f "$OUTPUT" "$OUTPUT.dbg" || exit
"$OBJCOPY" -S -O binary "$OUTPUT.dbg" "$OUTPUT" || exit
"$ZIPCOPY" "$OUTPUT.dbg" "$OUTPUT" || exit
elif [ $SFLAG -eq 1 ]; then
"$STRIP" "$OUTPUT" || exit
fi
fi
fi