Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gcc: fix softfloat libraries for ARM bootloader #14

Merged
merged 1 commit into from Jan 5, 2022

Conversation

davidkaroly
Copy link
Contributor

  • reinstate build flags -nostartfiles -fshort-wchar for ARM boot libs
  • enable parallel build of kernel and boot libs
  • disable GCC plugins as it gives me an error when building on Fedora 35:
    "/bin/sh: Argument list too long"

* reinstate build flags -nostartfiles -fshort-wchar for ARM boot libs
* enable parallel build of kernel and boot libs
* disable GCC plugins as it gives me an error when building on Fedora 35:
	"/bin/sh: Argument list too long"
@@ -183,7 +183,7 @@ BUILD()
--target=$effectiveTargetMachineTriple \
--prefix=$installDir --libexecdir=$installDir/lib --mandir=$manDir \
--docdir=$docDir --enable-threads=posix \
--disable-nls --enable-shared --with-gnu-ld --with-gnu-as \
--disable-nls --enable-shared --disable-plugin --with-gnu-ld --with-gnu-as \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird.. seems fine though. I'm assuming the --disable-plugin won't impact ports that use an unbootstrapped gcc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It really just looks like a long command line containing many files with long path names while running "make install-plugin" and in my build environment it somehow reached a limit.

According to gcc docs the "plugins" are used only for code instrumentation and static analysis so probably we can live without them during the bootstrap phase.

## BOOTLOADER libgcc + libsupc++
local bootCcFlags
if [ $effectiveTargetArchitecture == arm ]; then
# EFI arm (32-bit) requires software fp
bootCcFlags+="-mfloat-abi=soft";
bootCcFlags+="-mfloat-abi=soft -nostartfiles -fshort-wchar";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does bootloader libgcc + libsupc++ on other architectures also potentially need -nostartfiles ?

I could see us looking for these bootloader libgcc / libsupc++ libraries generically on all architectures instead of only on arm.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nostartfiles tells gcc not to link against crti.o, start_dyn.o, init_term_dyn.o
These are in fact not needed for building the bootloader so I think generally it would make sense for all architectures.

short-wchar tells gcc to use 2-byte wchar_t (default seems to be 4-byte wchar_t)
This was added for better compatibility with EFI call conventions. Even though I don't see wchar_t being used in the bootloader at all so it's more like to silence warnings.

# build bootloader version of libsupc++.a (without threads or TLS)
cd $objectsDir/$effectiveTargetMachineTriple/libstdc++-v3/libsupc++
mkdir -p saved
mv .libs/libsupc++* saved/
cp "../include/$effectiveTargetMachineTriple/bits/gthr-default.h" \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@X547 indicated the presence of gthr was an indicator of a non-pthread supporting toolchain. This feels related?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not quite sure about this one. Tbh I just copied it from previous version.
There's gthr-posix.h, gthr-single.h and gthr-default.h with the last one being identical to one of the first two.
So this code just swaps it around and then after building the library it swaps it back to the original state.

@kallisti5
Copy link
Member

added some notes, looks good otherwise. I know I likely missed a lot on my first revisions :-)

@kallisti5 kallisti5 merged commit c2dd312 into haikuports:master Jan 5, 2022
@davidkaroly davidkaroly deleted the pr/arm-bootstrap-gcc11 branch January 5, 2022 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants