From bf6d7087de0a7351fd1dfd5f41522a7f4f576180 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Thu, 19 Sep 2024 16:45:30 +0100 Subject: ld: Move the .note.build-id section to near the start of the memory map. This helps GDB to locate the debug information associated with a core dump. Core dumps include the first page of an executable's image, and if this page include the .note.build-id section then GDB can find it and then track down a debug info file for that build-id. --- ld/scripttempl/elf.sc | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'ld') diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc index 54716110b61..6ef93dcc906 100644 --- a/ld/scripttempl/elf.sc +++ b/ld/scripttempl/elf.sc @@ -397,6 +397,19 @@ fi # =========================================================================== # Functions for generating parts of the linker script +# Helper function for putting comments into scripts. +# Useful when trying to track down script composition problems. +# Use by adding: +# emit_comment "a message" +# wherever necessary. + +emit_comment() +{ +cat <