[syslinux] [PATCH 0/2] Do not use the "red zone" on EFI

Celelibi celelibi at gmail.com
Mon Nov 30 17:38:11 PST 2015


2015-11-30 14:14 UTC+01:00, Patrick Masotta <masottaus at yahoo.com>:
>>>>
>> The addition of the EFI_BUILD variable inside Makefiles could potentially
>> affect scripts such as package builders, perhaps even the way the
>> official (pre)release archives are built(?).
> <<<
>
> I think the -mno-red-zone thing is a good catch, the rest of EFI projects
> all use it;
> now I wonder if there might be other similar parameters probably overlooked
> on EFI builds...
>
> The variable "EFI_BUILD" is "already" defined at /makefile by the targets
> "efi32:" and "efi64:"
> Celeibi's patch seems to only propagate its value and correctly use
> -mno-red-zone when needed.
> At first sight I cannot see this mod breaking anything.
> I just only wonder if -mno-red-zone is now applied to the "whole" EFI
> codebase without forgetting anycomponent of the build.
>
> Best,Patrick
>
>
>

Your mail in in HTML. :)

I checked the whole log. The only lines in the logs of "make efi64"
starting with gcc that do not contain -mno-red-zone are:
- linking invocations
- used to compiles .lo files that produce fancyhello.lnx and
keytest.lnx (what are those?)
- used to build tools that only run on the compiling host: relocs,
prepcore, wrapper (note that relocs is no longer used at all)
- used to compile assembly file which obviously control the stack usage.

The very same goes for "make efi32". "Make bios" produce no occurrence
of -mno-red-zone.

Regarding the other flags needed, I'll take those from this link:
http://www.rodsbooks.com/efi-programming/hello.html

- -fno-stack-protector has the same exceptions as above + the
installers (which is the right thing to do).
- -fPIC is used instead of -fpic, which is good. However, this option
is not always specified for efi32, by looking at mk/embedded.mk, it
seems to be on purpose. I wonder about the implications of this.
syslinux.efi is however always linked with -pie which should be enough
to work.
- -fshort-wchar is missing out of the efi/ directory. The only places
where wchar_t is used are in the directories lzo and gpxe, same for
litteral strings with L prefix. We should probably enable this option
all the time given it would have no actual effect currently.
- -DEFI_FUNCTION_WRAPPER is still defined in some places but never
used at all. It shall be replaced by GNU_EFI_USE_MS_ABI under some
conditions.

So unless there is an objection I may send a patch for those options
although it should be a no-op.


Best regards,
Celelibi


More information about the Syslinux mailing list