cornell-brg / pydgin

A (Py)thon (D)SL for (G)enerating (In)struction set simulators.
BSD 3-Clause "New" or "Revised" License
165 stars 29 forks source link

Read as many ELF sections as possible. #35

Open snim2 opened 8 years ago

snim2 commented 8 years ago

This worked with the Revelation simulator, but I have not tested it with the other Pydin simulators.

Reading in the .debug, .comment or .stab sections caused problems with Epiphany ELFs, and I did find an "unknown" section type, so the check for that was necessary. Uncommenting the later code to read in the symbol table worked fine, but I haven't included that in this PR.

berkinilbeyi commented 8 years ago

This approach doesn't seem to work for other ISAs as indicated by Travis. I'll try to figure out how to do this correctly one of these days but haven't gotten the chance yet. Did this patch fix the issue in Revelation?

snim2 commented 8 years ago

I did a bit more digging around the e-loader code from Adapteva, and it looks like the .loader_cfg section that Revelation needed (and a few others) are always filled with zeroes in the ELF files. These sections are later populated with "real" values after the ELF file is loaded. The reason for this is that one ELF file can be loaded onto many Epiphany cores, and the user can choose which cores to use with which ELF files at load time, and can place the cores into workgroups. Some information about this configuration is written into .loader_cfg and some other sections.

So, the short story is that I have a work-around for all this in Revelation, so no need to change the Pydgin code upstream. Thanks for checking though!