Standardize on -fsigned-char

MaGuess on Discord pointed out the fact that cosmocc contradicts itself
on the signedness of `char`. It's up to each platform to choose one, so
the cosmo platform shall choose signed. The rationale is it makes the C
language syntax more internally similar. `char` should be `signed char`
for the same reason `int` means `signed int`. It's recommended that you
still assume `char` could go either way since that's portable thinking.
But if you want to assume we'll always have signed char, that's ok too.
This commit is contained in:
Justine Tunney 2024-03-30 21:46:08 -07:00
parent b431ca4449
commit b9d6e6e348
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
3 changed files with 3 additions and 1 deletions

View file

@ -127,6 +127,7 @@ ifeq ($(ARCH), aarch64)
DEFAULT_COPTS += \
-ffixed-x18 \
-ffixed-x28 \
-fsigned-char \
-mno-outline-atomics
endif

View file

@ -265,7 +265,7 @@ LDFLAGS_X86_64="$LDFLAGS -L$BIN/../x86_64-linux-cosmo/lib -Wl,-T,$BIN/../x86_64-
LDLIBS_X86_64="-lcosmo"
CRT_AARCH64="$BIN/../aarch64-linux-cosmo/lib/crt.o"
CPPFLAGS_AARCH64="$CPPFLAGS"
CPPFLAGS_AARCH64="$CPPFLAGS -fsigned-char"
CFLAGS_AARCH64="$CFLAGS -ffixed-x18 -ffixed-x28 -mno-outline-atomics"
LDFLAGS_AARCH64="$LDFLAGS -L$BIN/../aarch64-linux-cosmo/lib -Wl,-T,$BIN/../aarch64-linux-cosmo/lib/aarch64.lds -Wl,-z,common-page-size=16384 -Wl,-z,max-page-size=16384"
LDLIBS_AARCH64="-lcosmo"

View file

@ -84,6 +84,7 @@ if [ x"$ARCH" = x"x86_64" ]; then
elif [ x"$ARCH" = x"aarch64" ]; then
OBJCOPYFLAGS="-S"
PAGESZ=16384
CPPFLAGS="$CPPFLAGS -fsigned-char"
CFLAGS="$CFLAGS -ffixed-x18 -ffixed-x28 -mno-outline-atomics"
LDFLAGS="$LDFLAGS -Wl,-T,$BIN/../$ARCH-linux-cosmo/lib/aarch64.lds"
else