Page MenuHomeFreeBSD

Updated GCC flags for i386
Needs ReviewPublic

Authored by alexander.lochmann_tu-dortmund.de on Jun 10 2019, 8:37 AM.

Details

Reviewers
dim
imp
Summary

-mno-align-long-strings is no longer recognized by modern GCCs (>=7.4). Building the FreeBSD kernel using CC=gcc{7,8} therefore fails.
This patch removes this option from the default kernel makefile.

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

dim added a comment.Jun 10 2019, 2:22 PM

In fact, the -mno-align-long-strings option is a custom addition to our base gcc (from rS169705, quite a long time ago). Upstream gcc never supported this option.

In any case, this change is incomplete in two ways:

  • It should be dependent on the gcc version. For gcc 4.2.1, keep the old spelling, assuming that it will use base gcc. For newer gcc versions, check where the new spelling was introduced, and make it dependent on that version.
  • The option is also used in stand/i386/boot2/Makefile, supposedly to keep the binary size small. This is a very sensitive area, as boot2 can blow up with different versions of compilers for no discernible reason. Any opion change there needs to be carefully tested for size regressions. And obviously, it also needs to be gcc version dependent.
In D20586#444960, @dim wrote:

In fact, the -mno-align-long-strings option is a custom addition to our base gcc (from rS169705, quite a long time ago). Upstream gcc never supported this option.
In any case, this change is incomplete in two ways:

  • It should be dependent on the gcc version. For gcc 4.2.1, keep the old spelling, assuming that it will use base gcc. For newer gcc versions, check where the new spelling was introduced, and make it dependent on that version.
  • The option is also used in stand/i386/boot2/Makefile, supposedly to keep the binary size small. This is a very sensitive area, as boot2 can blow up with different versions of compilers for no discernible reason. Any opion change there needs to be carefully tested for size regressions. And obviously, it also needs to be gcc version dependent.

There is actually a version check in stand/i386/boot2/Makefile: .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} <= 40201
So for kern.mk, is this option needed at all? Can we simply remove it?

dim added a comment.Jun 11 2019, 11:21 AM

So for kern.mk, is this option needed at all? Can we simply remove it?

This is a very old addition, from rS104455, where it claimed "This reduces the size of GENERIC's text space by 73999 bytes (about 2%). The bloat is from approximately 3437 strings longer than 31 characters being padded to a 32-byte boundary".

I have no objection against removing it, but some people are very fond of obtaining a kernel image that is as small as possible. So if we can keep the option in there for base gcc 4.2.1, that would be the least controversial.

alexander.lochmann_tu-dortmund.de edited the summary of this revision. (Show Details)
In D20586#445268, @dim wrote:

So for kern.mk, is this option needed at all? Can we simply remove it?

This is a very old addition, from rS104455, where it claimed "This reduces the size of GENERIC's text space by 73999 bytes (about 2%). The bloat is from approximately 3437 strings longer than 31 characters being padded to a 32-byte boundary".
I have no objection against removing it, but some people are very fond of obtaining a kernel image that is as small as possible. So if we can keep the option in there for base gcc 4.2.1, that would be the least controversial.

I removed it from the default kernel makefile. I didn't touch stand/i386/boot2/Makefile.