diff mbox

[edk2,v3,2/6] ArmVirtPkg/ArmVirtPrePiUniCoreRelocatable: ignore .hash and .note sections

Message ID 1469264601-31356-3-git-send-email-ard.biesheuvel@linaro.org
State Superseded
Headers show

Commit Message

Ard Biesheuvel July 23, 2016, 9:03 a.m. UTC
Newer versions of ld automatically emit .gnu.hash and .note.gnu.build-id
sections, which are not listed in the linker script, and will end up
breaking the build with an allocation conflict, e.g.,

  /usr/bin/aarch64-linux-gnu-ld: section .note.gnu.build-id loaded at
    [0000000000000000,0000000000000023] overlaps section .text loaded at
    [0000000000000000,0000000000017dbf]

Since we don't require or care about these sections, update the linker
script so that they are discarded. Note that this involves emitting the
.note.gnu.build-id section into a non-allocatable segment to prevent the
linker from noticing that it is being discarded (and subsequently
complaining about it)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds | 3 +++
 1 file changed, 3 insertions(+)

-- 
2.7.4

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

Comments

Laszlo Ersek July 25, 2016, 8:08 a.m. UTC | #1
On 07/23/16 11:03, Ard Biesheuvel wrote:
> Newer versions of ld automatically emit .gnu.hash and .note.gnu.build-id

> sections, which are not listed in the linker script, and will end up

> breaking the build with an allocation conflict, e.g.,

> 

>   /usr/bin/aarch64-linux-gnu-ld: section .note.gnu.build-id loaded at

>     [0000000000000000,0000000000000023] overlaps section .text loaded at

>     [0000000000000000,0000000000017dbf]

> 

> Since we don't require or care about these sections, update the linker

> script so that they are discarded. Note that this involves emitting the

> .note.gnu.build-id section into a non-allocatable segment to prevent the

> linker from noticing that it is being discarded (and subsequently

> complaining about it)

> 

> Contributed-under: TianoCore Contribution Agreement 1.0

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---

>  ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds | 3 +++

>  1 file changed, 3 insertions(+)

> 

> diff --git a/ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds b/ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds

> index 832ad1474468..44df7840adfd 100644

> --- a/ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds

> +++ b/ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds

> @@ -30,8 +30,11 @@ SECTIONS

>      PROVIDE(__reloc_end = .);

>    }

>  

> +  .note (INFO) : { *(.note.gnu.build-id) }

> +

>    /DISCARD/ : {

>      *(.note.GNU-stack)

> +    *(.gnu.hash)

>      *(.gnu_debuglink)

>      *(.interp)

>      *(.dynamic)

> 


Acked-by: Laszlo Ersek <lersek@redhat.com>

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

Patch

diff --git a/ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds b/ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds
index 832ad1474468..44df7840adfd 100644
--- a/ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds
+++ b/ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds
@@ -30,8 +30,11 @@  SECTIONS
     PROVIDE(__reloc_end = .);
   }
 
+  .note (INFO) : { *(.note.gnu.build-id) }
+
   /DISCARD/ : {
     *(.note.GNU-stack)
+    *(.gnu.hash)
     *(.gnu_debuglink)
     *(.interp)
     *(.dynamic)