Re: GCC49 DEBUG AARCH64 and ARM builds use -O0


Ard Biesheuvel
 

On Tue, 13 Apr 2021 at 14:12, Rebecca Cran <rebecca@nuviainc.com> wrote:

+Ard (with the correct email address)

On 4/13/21 4:32 AM, Laszlo Ersek wrote:
+Liming

On 04/12/21 17:10, Rebecca Cran wrote:
I noticed the GCC49 (and GCC48) AARCH64 and ARM DEBUG builds use -O0,
unlike IA32 and X64 platforms which build with -Os.

e.g. from
https://github.com/tianocore/edk2/blob/master/BaseTools/Conf/tools_def.template
:

DEBUG_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) -O0

Is that deliberate, or should it be like X64 where DEBUG builds are
optimized and NOOPT is used when unoptimized binaries are needed?
Seems to go back to commit dafe0fedc508 ("BaseTools: Add GCC49
toolchain; align data sections to 0x40", 2014-07-28). My guess is that
in 2014, gcc (4.9) may have had issues with arm64 code generation with -Os.

You hint at DEBUG_GCC48_AARCH64_CC_FLAGS too, which seems like a
promising clue at first -- because, perhaps the GCC49 flags in the
above-mentioned commit had simply been modeled on the then-existent
GCC48 ones.

Unfortunately however, the GCC48 entry appeared in the
less-than-helpfully-explained commit 2bc3256ca6d4 ("Sync BaseTool trunk
(version r2640) into EDKII BaseTools.", 2014-01-10).

Thanks
Laszlo
IIRC we only added NOOPT for ARM much later, and at that time, we
decided to leave GCC49 alone.

Join devel@edk2.groups.io to automatically receive all group messages.