SPM: Add shim layer to Ivy partition and enable PIE

Add a shim layer that runs at S-EL1 to the Ivy partition.
Also enable Ivy to be built with PIE.

Signed-off-by: Ruari Phipps <ruari.phipps@arm.com>
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
Change-Id: I821a8ac99d07200aec93ca29d182f8ab6716616c
diff --git a/spm/ivy/ivy.ld.S b/spm/ivy/ivy.ld.S
index 634db15..a247ee4 100644
--- a/spm/ivy/ivy.ld.S
+++ b/spm/ivy/ivy.ld.S
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -32,6 +32,16 @@
         . = ALIGN(PAGE_SIZE);
         __RODATA_START__ = .;
         *(.rodata*)
+        /*
+         * Keep the .got section in the RO section as it is patched
+         * prior to enabling the MMU, so having it in RO is better for
+         * security. GOT is a table of addresses so ensure 8-byte alignment.
+         */
+        . = ALIGN(8);
+        __GOT_START__ = .;
+        *(.got)
+        __GOT_END__ = .;
+
         . = NEXT(PAGE_SIZE);
         __RODATA_END__ = .;
     }
@@ -44,6 +54,18 @@
         __DATA_END__ = .;
     }
 
+    /*
+     * .rela.dyn needs to come after .data for the read-elf utility
+     * to parse this section correctly. Ensure 8-byte alignment so
+     * that the fields of RELA data structure are aligned.
+     */
+    . = ALIGN(8);
+    __RELA_START__ = .;
+    .rela.dyn . : {
+    }
+    __RELA_END__ = .;
+
+
     .bss (NOLOAD) : {
         . = ALIGN(PAGE_SIZE);
         __BSS_START__ = .;