]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Preserve hii section in GCC binaries
authorThomas Palmer <thomas.palmer@hpe.com>
Fri, 22 Jul 2016 02:56:49 +0000 (10:56 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Tue, 26 Jul 2016 02:21:45 +0000 (10:21 +0800)
According to UEFI spec:
Once an image is loaded, LoadImage() installs
EFI_HII_PACKAGE_LIST_PROTOCOL on the handle if the image contains a
custom PE/COFF resource with the type 'HII'. The protocol's
interface pointer points to the HII package list which is contained
in the resource's data.

This is controlled by the UEFI_HII_RESOURCE_SECTION define in the INF
file.  When present the HII resource is linked with the module
binary.

Unfortunately GCC-built binaries have been stripping the .hii section
entirely.  See  "[edk2] HII gEfiHiiPackageListProtocolGuid problem
with  GCC48(VS2012x86 works)"
http://thread.gmane.org/gmane.comp.bios.tianocore.devel/13438
http://thread.gmane.org/gmane.comp.bios.tianocore.devel/14899

This patch tells the linker to preserve the .hii sections

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Bruce Cran <bruce.cran@gmail.com>
Reviewed-by: Bruce Cran <bruce.cran@gmail.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Scripts/GccBase.lds

index 32310bc75dcc29ea720461ae90a2e69449521a84..7e4cdde9bfea8405ce4b2b375fda903d9a64b976 100644 (file)
@@ -4,6 +4,7 @@
 \r
   Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>\r
   Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>\r
 \r
   Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>\r
   Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>\r
+  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
 \r
   This program and the accompanying materials are licensed and made available under\r
   the terms and conditions of the BSD License that accompanies this distribution.\r
 \r
   This program and the accompanying materials are licensed and made available under\r
   the terms and conditions of the BSD License that accompanies this distribution.\r
@@ -57,6 +58,10 @@ SECTIONS {
     *(.rela .rela.*)\r
   }\r
 \r
     *(.rela .rela.*)\r
   }\r
 \r
+  .hii : ALIGN(CONSTANT(COMMONPAGESIZE)) {\r
+    KEEP (*(.hii))\r
+  }\r
+\r
   /DISCARD/ : {\r
     *(.note.GNU-stack)\r
     *(.gnu_debuglink)\r
   /DISCARD/ : {\r
     *(.note.GNU-stack)\r
     *(.gnu_debuglink)\r