Revision: 18194
          http://sourceforge.net/p/edk2/code/18194
Author:   abiesheuvel
Date:     2015-08-10 07:54:55 +0000 (Mon, 10 Aug 2015)
Log Message:
-----------
ArmPlatformPkg/ArmJunoPkg: use a rodata symbol for ReferenceAcpiTable

The ACPI .aslc files contain a ReferenceAcpiTable() function whose
sole purpose is to ensure that the table itself does not get optimized
away. However, when using clang, these dummy functions result in a 4 KB
section alignment requirement, which is silly since everything except
the .data section is discarded later anyway.

So instead, make ReferenceAcpiTable a CONST pointer to VOID*. This way,
we still have a .text section, which is mandatory for the PE/COFF
conversion, but no executable code with small model relocations that
impose additional alignment requirements.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <[email protected]>
Reviewed-by: Leif Lindholm <[email protected]>
Tested-by: Leif Lindholm <[email protected]>

Modified Paths:
--------------
    trunk/edk2/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Facs.aslc
    trunk/edk2/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Fadt.aslc
    trunk/edk2/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Gtdt.aslc
    trunk/edk2/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Madt.aslc

Modified: trunk/edk2/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Facs.aslc
===================================================================
--- trunk/edk2/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Facs.aslc   2015-08-10 
07:54:47 UTC (rev 18193)
+++ trunk/edk2/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Facs.aslc   2015-08-10 
07:54:55 UTC (rev 18194)
@@ -55,14 +55,8 @@
       EFI_ACPI_RESERVED_BYTE },                           // UINT8   
Reserved1[23]
 };
 
-VOID*
-ReferenceAcpiTable (
-  VOID
-  )
-{
-  //
-  // Reference the table being generated to prevent the optimizer from 
removing the
-  // data structure from the executable
-  //
-  return (VOID*)&Facs;
-}
+//
+// Reference the table being generated to prevent the optimizer from removing 
the
+// data structure from the executable
+//
+VOID* CONST ReferenceAcpiTable = &Facs;

Modified: trunk/edk2/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Fadt.aslc
===================================================================
--- trunk/edk2/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Fadt.aslc   2015-08-10 
07:54:47 UTC (rev 18193)
+++ trunk/edk2/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Fadt.aslc   2015-08-10 
07:54:55 UTC (rev 18194)
@@ -92,14 +92,8 @@
   NULL_GAS                                                                  // 
EFI_ACPI_5_0_GENERIC_ADDRESS_STRUCTURE  SleepStatusReg
 };
 
-VOID*
-ReferenceAcpiTable (
-  VOID
-  )
-{
-  //
-  // Reference the table being generated to prevent the optimizer from 
removing the
-  // data structure from the executable
-  //
-  return (VOID*)&Fadt;
-}
+//
+// Reference the table being generated to prevent the optimizer from removing 
the
+// data structure from the executable
+//
+VOID* CONST ReferenceAcpiTable = &Fadt;

Modified: trunk/edk2/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Gtdt.aslc
===================================================================
--- trunk/edk2/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Gtdt.aslc   2015-08-10 
07:54:47 UTC (rev 18193)
+++ trunk/edk2/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Gtdt.aslc   2015-08-10 
07:54:55 UTC (rev 18194)
@@ -96,14 +96,8 @@
   };
 #endif
 
-VOID*
-ReferenceAcpiTable (
-  VOID
-  )
-{
-  //
-  // Reference the table being generated to prevent the optimizer from 
removing the
-  // data structure from the exeutable
-  //
-  return (VOID*)&Gtdt;
-}
+//
+// Reference the table being generated to prevent the optimizer from removing 
the
+// data structure from the executable
+//
+VOID* CONST ReferenceAcpiTable = &Gtdt;

Modified: trunk/edk2/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Madt.aslc
===================================================================
--- trunk/edk2/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Madt.aslc   2015-08-10 
07:54:47 UTC (rev 18193)
+++ trunk/edk2/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Madt.aslc   2015-08-10 
07:54:55 UTC (rev 18194)
@@ -123,14 +123,8 @@
   };
 #endif
 
-VOID*
-ReferenceAcpiTable (
-  VOID
-  )
-{
-  //
-  // Reference the table being generated to prevent the optimizer from 
removing the
-  // data structure from the executable
-  //
-  return (VOID*)&Madt;
-}
+//
+// Reference the table being generated to prevent the optimizer from removing 
the
+// data structure from the executable
+//
+VOID* CONST ReferenceAcpiTable = &Madt;


------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to