This is a followup to the patch 'BaseTools AARCH64: add -mstrict-align to
all AARCH64 GCC flavors' that I sent out on the 23rd. As it turns out, using
strict alignment results in a code size increase which breaks the build for
the DEBUG shell using the tiny code model we use for GCC49 and up.

I have reproduced some patches here that I have already sent out separately
(#5) or as part of another series (#1, #2) but I included them again since
they need to be merged in order to prevent breaking bisect due to build
errors.

Changes since v1:
- Dropped the patches that rely on function alignment to sort the input objects
  in a way that results in the tiny model objects to end up in close proximity
  of each other. This is unmaintainable hack, and since the issue it solves only
  affects the DEBUG builds, we can simply switch to the small code model for
  everything and not care about the code size increase.
- Added some R-b's from Liming and Leif.

Patches #1 and #2 set the CLANG35 target to the GNU flavor of the respective
architectures, and adds the target to the preprocessor invocations as well.

Patch #3 changes the default code model for all DEBUG_GCC49 generated code
to the small model, and updates the minimal alignment accordingly. This allows
us to get rid of module or module type specific overrides, which are difficult
to maintain. This results in a slight size increase, but code size is not such
a big concern for DEBUG builds anyway. Below are the compressed/uncompressed
sizes of ArmVirtQemu.dsc built with the various code models (built without
support for secure boot). Note that this includes the -mstrict-align switch
added in patch #5.

         |      tiny      |      small     |      large     | small / best  |
---------+----------------+----------------+----------------+---------------+
   DEBUG | does not build |   1376k/7958k  |   1297k/7360k  |   +6%/+8%     |
---------+----------------+----------------+----------------+---------------+
 RELEASE |    772k/3897k  |    904k/4636k  |    791k/4321k  |  +17%/+19%    |
---------+----------------+----------------+----------------+---------------+

Patch #4 removes the build options for AARCH64 from ShellPkg. They need to be
overridden anyway or they will only affect the core Shell binary and not all of
the Shell component libraries that are merged with the core binary at build 
time.
Also, we only need this override for GCC49, since GCC 48 and earlier use the
large code model, and CLANG35 uses the small code model.

Patch #5 moves the -mstrict-align compiler option to the common AARCH64/GCC
CFLAGS definition so that it applies to all GCC versions in addition to CLANG35.
This addresses an issue spotted by the Ubuntu/Debian folks (and which they
kindly never reported upstream, afaict) here:
https://bugs.launchpad.net/ubuntu/+source/edk2/+bug/1489560

Ard Biesheuvel (5):
  BaseTools CLANG35: use GNU target triplets explicitly
  BaseTools CLANG35: use -target in PP flags as well
  BaseTools AARCH64: move DEBUG GCC49 to the small code model
  ShellPkg AARCH64: remove DEBUG BuildOptions override
  BaseTools AARCH64: add -mstrict-align to all AARCH64 GCC flavors

 BaseTools/Conf/tools_def.template    | 35 +++++++++++---------
 ShellPkg/Application/Shell/Shell.inf |  7 ----
 2 files changed, 20 insertions(+), 22 deletions(-)

-- 
2.5.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to