The test scripts have nothing to do with it. In ELF files, the program
header table exists somewhere in the image defined by an offset. That
offset could (and usually does) put it in a region which is also part of a
segment which an ELF loader would put into memory so that the
program/dynamic loader/etc. can look at it at run time. gem5's ELF loader
code compares the offset of the header table against the segments it knows
about to see if they overlap, and if they do uses the virtual address of
the segment to figure out the virtual address of the header table as it's
been loaded into memory. If the header table doesn't overlap with any
segment, it records its address as 0. The RISCV process loader code
attempts to read out the program header by using that address. Because 0
isn't mapped to anything, it blows up.
$ readelf -l /dist/m5/regression/test-progs/hello/bin/riscv/linux/hello
Elf file type is EXEC (Executable file)
Entry point 0x10000
There are 1 program headers, starting at offset 64
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD 0x0000000000001000 0x0000000000010000 0x0000000000010000
0x0000000000004b80 0x0000000000004c10 RWE 1000
Section to Segment mapping:
Segment Sections...
00 .text .rodata .init_array .fini_array .eh_frame .jcr .data .sdata
.sbss .bss
$ md5sum /dist/m5/regression/test-progs/hello/bin/riscv/linux/hello
f6a3aabca242749aecb543fe95abfa73
/dist/m5/regression/test-progs/hello/bin/riscv/linux/hello
On Wed, Sep 6, 2017 at 8:30 AM, Alec Roelke <[email protected]> wrote:
> My understanding was that gem5 uses libelf to read the segments of the
> program, which correctly identifies the program header table, entry point,
> and data, text, and bss segments (among other things). Are you saying that
> the test scripts cause it to do something different?
>
> On Wed, Sep 6, 2017 at 5:35 AM, Gabe Black <[email protected]> wrote:
>
> > The loader is using the readBlob function of the SE translating port
> proxy
> > which converts a virtual address into a physical one before sending out
> the
> > request. It's being fed the address 0, and that, as you might expect,
> > doesn't map to anything. It gets that address from where the ELF loader
> > tells it the ELF program header table is. The reason it thinks it's at
> > address 0 is that it didn't actually find an address for it, since the
> > program header isn't mapped into the only loadable segment. That segment
> > starts at file offset 0x1000, but the ELF program header starts at offset
> > 64 (maybe in hex?). That's a little unusual because in my experience the
> > linker likes to put the headers in a loadable segment, but that's what's
> on
> > zizzer right now.
> >
> > So basically, I would totally expect it to fail, and I'm surprised that
> it
> > works for you guys at all unless you're using binaries which are
> different
> > and have the headers within the loadable segment. I looked specifically
> at
> > hello world.
> >
> > Gabe
> >
> > On Tue, Sep 5, 2017 at 4:43 PM, Jason Lowe-Power <[email protected]>
> > wrote:
> >
> > > Hi Alec,
> > >
> > > The binaries seem to be up-to-date. They are what is in the gem5 repo
> as
> > of
> > > Sept. 3. The error is "fatal: readBlob(0x0, ...) failed".
> > >
> > > If I run the test without the test script, it works. If I run the test
> on
> > > my local machine it works. The only thing that's failing is running the
> > > test with the test scripts on zizzer.
> > >
> > > Anyone else have an idea?
> > >
> > > Jason
> > >
> > > On Wed, Aug 30, 2017 at 2:55 PM Jason Lowe-Power <[email protected]>
> > > wrote:
> > >
> > > > I'm not sure. I can look into it, but I'm not sure when I'll get the
> > > > chance. I'll try to do it in the next week or so. If I haven't gotten
> > to
> > > it
> > > > by 9/11, send me another email reminder ;).
> > > >
> > > > Jason
> > > >
> > > > On Wed, Aug 30, 2017 at 11:24 AM Alec Roelke <[email protected]>
> > wrote:
> > > >
> > > >> Hi Everyone,
> > > >>
> > > >> I've noticed that all of the RISC-V regression tests have been
> failing
> > > >> every day. They all pass when I run them on my machine with the
> > latest
> > > >> gem5. Is the machine running the regressions running the correct
> > > >> binaries?
> > > >>
> > > >> Thanks,
> > > >> Alec Roelke
> > > >> _______________________________________________
> > > >> gem5-dev mailing list
> > > >> [email protected]
> > > >> http://m5sim.org/mailman/listinfo/gem5-dev
> > > >
> > > >
> > > _______________________________________________
> > > gem5-dev mailing list
> > > [email protected]
> > > http://m5sim.org/mailman/listinfo/gem5-dev
> > >
> > _______________________________________________
> > gem5-dev mailing list
> > [email protected]
> > http://m5sim.org/mailman/listinfo/gem5-dev
> >
> _______________________________________________
> gem5-dev mailing list
> [email protected]
> http://m5sim.org/mailman/listinfo/gem5-dev
>
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev