Re: GccBase.lds


Laszlo Ersek
 

(+Ard)

On 03/24/21 02:49, Hernandez Miramontes, Jose Miguel wrote:
Hi

Is anyone familiar with this file? (Edk2\BaseTools\Scripts\GccBase.lds)
I would like to understand more what it does and why it is needed.

When looking at the .efi output of genfw, it seems the .build-id section generated by gcc is discarded.
git-blame is your friend. It leads to commit 7fd5d619806d ("BaseTools
GCC: drop GNU notes section from EFI image", 2016-08-02).

Thanks
Laszlo

What would it take to preserve it?

When reading this, https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html,
I understood that this section is needed so GDB can find the symbols when they are extracted from the binary.


objdump -fh PeiCore.dll

PeiCore.dll: file format elf32-i386
architecture: i386, flags 0x00000013:
HAS_RELOC, EXEC_P, HAS_SYMS
start address 0x00006089

Sections:
Idx Name Size VMA LMA File off Algn
0 .text 000060bc 00000220 00000220 00000080 2**5
CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
1 .data 00000348 000062e0 000062e0 00006140 2**5
CONTENTS, ALLOC, LOAD, RELOC, DATA
2 .build-id 00000024 00006628 00006628 00006488 2**2
CONTENTS, READONLY

$objdump -fh PeiCore.efi

PeiCore.efi: file format pei-i386
architecture: i386, flags 0x0000010b:
HAS_RELOC, EXEC_P, HAS_DEBUG, D_PAGED
start address 0x00006089

Sections:
Idx Name Size VMA LMA File off Algn
0 .text 000060c0 00000220 00000220 00000220 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 00000400 000062e0 000062e0 000062e0 2**2
CONTENTS, ALLOC, LOAD, DATA
2 .reloc 000001a0 000066e0 000066e0 000066e0 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
Jose Miguel Hernandez Miramontes
BIOS Engineer
jose.miguel.hernandez.miramontes@intel.com
+1 (512) 362-1230
Intel Corporation






Join discuss@edk2.groups.io to automatically receive all group messages.