bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/29954] bpf sim tests fail due to linker triggering LOAD segment


From: guillermo.e.martinez at oracle dot com
Subject: [Bug ld/29954] bpf sim tests fail due to linker triggering LOAD segment with RWX permissions test by default
Date: Tue, 03 Jan 2023 21:36:20 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=29954

--- Comment #3 from Guillermo E. Martinez <guillermo.e.martinez at oracle dot 
com> ---
(In reply to Jose E. Marchesi from comment #2)
> Hi Nick.
> 
> I tried that locally and definitely works.  But I don't think it is the
> right fix in this case.
> 
> When linked without -Ttext=0x0, the following segments are created in the
> resulting executable:
> 
>  Elf file type is EXEC (Executable file)                                    
> 
>  Entry point 0x400000                                                       
> 
>  There are 2 program headers, starting at offset 64                         
> 
>                                                                             
> 
>  Program Headers:                                                           
> 
>    Type           Offset             VirtAddr           PhysAddr            
> 
>                   FileSiz            MemSiz              Flags  Align       
> 
>    LOAD           0x0000000000100000 0x0000000000400000 0x0000000000400000  
> 
>                   0x0000000000000648 0x0000000000000648  R E    0x100000    
> 
>    LOAD           0x0000000000101648 0x0000000000801648 0x0000000000801648  
> 
>                   0x0000000000000006 0x0000000000000006  RW     0x100000    
> 
>                                                                             
> 
>   Section to Segment mapping:                                               
> 
>    Segment Sections...                                                      
> 
>     00     .text                                                            
> 
>     01     .data                                                            
> 
> 
> Which is perfectly fine.  But then it is the simulator that fails with:
> 
>   spawn ./bpf/run --memory-size=4Mb
> /home/jemarch/gnu/src/binutils-gdb/build-bpf/sim/alu.s.x
>   core: 8 byte read to unmapped address 0x400000 at 0x400000
> 
> Meaning the simulator is somehow not loading the segments at the right VMA.

Increasing `--memory-size' in the simulator from 4Mb to 10MB SIGSEGV is gone,
because .data start at address: 0x801648,

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  LOAD           0x0000000000100000 0x0000000000400000 0x0000000000400000
                 0x0000000000000648 0x0000000000000648  R E    0x100000
  LOAD           0x0000000000101648 0x0000000000801648 0x0000000000801648
                 0x0000000000000006 0x0000000000000006  RW     0x100000

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]