From 58772cdbfc97c8021475c0f0b0da3c56d2eb22d0 Mon Sep 17 00:00:00 2001
From: Dylan McKay <me@dylanmckay.io>
Date: Wed, 22 Jul 2020 23:32:45 +1200
Subject: [PATCH] [AVR] Disable passing of the '--eh-frame-hdr' argument to the
 linker

In general, the GNU AVR linker that is distributed does not support this flag.
On Arch Linux, the most recently distributed version of avr-ld
corresponds to binutils 2.34, which is the most recent version of
binutils as of today (2020-07-22), however - it still does not list
this argument in its --help list compared to the host LD, which does.

As AVR has no exception handling support, the exception handling frame header
argument is redundant. This patch disables passing of the '--eh-frame-hdr' argument
to avr-ld, similar to the existing exclusions (i.e. Windows, Solaris,
UEFI).
---
 src/librustc_codegen_ssa/back/linker.rs | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/librustc_codegen_ssa/back/linker.rs b/src/librustc_codegen_ssa/back/linker.rs
index e64aafa599fd8..85c2715ba9065 100644
--- a/src/librustc_codegen_ssa/back/linker.rs
+++ b/src/librustc_codegen_ssa/back/linker.rs
@@ -623,6 +623,7 @@ impl<'a> Linker for GccLinker<'a> {
             && !self.sess.target.target.options.is_like_windows
             && !self.sess.target.target.options.is_like_solaris
             && self.sess.target.target.target_os != "uefi"
+            && self.sess.target.target.arch != "avr"
         {
             self.linker_arg("--eh-frame-hdr");
         }