瀏覽代碼

discard .eh_frame sections

The .cfi_* assembler directives cause call frame information to be
emitted in a special .eh_frame section. But this is not needed in the
final binary, because we are not doing panic unwinding.

GNU ld already discards this section with its (default) --gc-sections
behaviour. Lld doesn't do that by default though, instead it complains:

    rust-lld: error: no memory region specified for section '.eh_frame'

So let's explicitly discard the .eh_frame section.
Dan Callaghan 6 年之前
父節點
當前提交
19254fa9b3
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      riscv-rt/link.x

+ 6 - 0
riscv-rt/link.x

@@ -72,6 +72,12 @@ SECTIONS
     KEEP(*(.got .got.*));
     _egot = .;
   } > RAM AT > FLASH /* LLD fails on AT > FLASH */
+
+  /* Discard .eh_frame, we are not doing unwind on panic so it is not needed */
+  /DISCARD/ :
+  {
+    *(.eh_frame);
+  }
 }
 
 /* Do not exceed this mark in the error messages below                | */