From 72e8fd5a0523c4bde155e9eaf477891ba9181aca Mon Sep 17 00:00:00 2001 From: whitequark Date: Sun, 30 Apr 2017 13:36:11 +0000 Subject: [PATCH] Mark .debug_gdb_scripts as non-allocatable. See the discussion in https://github.com/rust-lang/rust/pull/41627 for an explanation of why this is necessary. --- link.x | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/link.x b/link.x index 9f37fa7f..7dee11c0 100644 --- a/link.x +++ b/link.x @@ -35,6 +35,17 @@ SECTIONS _sidata = LOADADDR(.data); + /* Due to an unfortunate combination of legacy concerns, + toolchain drawbacks, and insufficient attention to detail, + rustc has no choice but to mark .debug_gdb_scripts as allocatable. + We really do not want to upload it to our target, so we + remove the allocatable bit. Unfortunately, it appears + that the only way to do this in a linker script is + the extremely obscure "INFO" output section type specifier. */ + .debug_gdb_scripts 0 (INFO) : { + KEEP(*(.debug_gdb_scripts)) + } + /DISCARD/ : { /* Unused unwinding stuff */