Dear ArmPkg maintainers,

I'm trying to debug AArch64 code built with Linaro GCC and don't have proper 
correlation for global variables.

I'm digging into how .data/.bss is correlated across ELF and PE-COFF and I see 
different offsets (in ELF the data appears to be 64KB higher up than PE-COFF).  
I'm also seeing warning in GenFw related to multiple ELF sections being 
squashed into one PE-COFF section.

I'm not an expert in the GNU linker configuration but it seems that if we could 
get the ELF and PE-COFF layouts to match that it would fix the debugger 
correlation.  

Here's the GenFw output:
3>  Convert 
c:\ecedk2\Build\ArmVExpress-FVP-AArch64\DEBUG_GCC49\AARCH64\MdeModulePkg\Core\PiSmmCore\PiSmmIpl\DEBUG\PiSmmIpl.dll
 from ELF to PE/COFF.
3>  Check Elf Image Header
3>  Set EHDR
3>  Check ELF64 Header Information
3>  Update Header Pointers
3>  Create COFF Section Offset Buffer
3>  Fill in Function Pointers
3>  Compute sections new address.
3>  GenFw: WARNING
3>    Mulitple sections in 
c:\ecedk2\Build\ArmVExpress-FVP-AArch64\DEBUG_GCC49\AARCH64\MdeModulePkg\Core\PiSmmCore\PiSmmIpl\DEBUG\PiSmmIpl.dll
 are merged into 1 text section. Source level debug might not work correctly.
3>  GenFw: WARNING
3>    Mulitple sections in 
c:\ecedk2\Build\ArmVExpress-FVP-AArch64\DEBUG_GCC49\AARCH64\MdeModulePkg\Core\PiSmmCore\PiSmmIpl\DEBUG\PiSmmIpl.dll
 are merged into 1 data section. Source level debug might not work correctly.
3>  Write and relocate sections.
3>  Applying Relocations...
3>  Applying Relocations

Here's the ELF layout for the module, notice how far out data starts (and with 
rodata which will be squashed into .text and .bss which will be squashed into 
.data)
Idx Name          Size      VMA               LMA               File off  Algn
  0 .text         00009c90  0000000000000000  0000000000000000  00010000  2**3
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  1 .rodata       00002458  0000000000009c90  0000000000009c90  00019c90  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .data         00000460  000000000001c0e8  000000000001c0e8  0001c0e8  2**3
                  CONTENTS, ALLOC, LOAD, RELOC, DATA
  3 .bss          00000088  000000000001c548  000000000001c548  0001c548  2**3
                  ALLOC

And PE-COFF has data at a different offset with data much closer in:
SECTION HEADER #1
   .text name
    C100 virtual size
     260 virtual address (0000000000000260 to 000000000000C35F)
    C100 size of raw data

SECTION HEADER #2
   .data name
     500 virtual size
    C360 virtual address (000000000000C360 to 000000000000C85F)
     500 size of raw data

So we can see that the data offset from text is inconsistent between the two.

Thanks,

Eugene

------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to