On Fri, Apr 23, 2021 at 10:51:40AM +0200, Jan Beulich wrote: > On 23.04.2021 09:30, Roger Pau Monné wrote: > > /* > > * Explicitly list debug section for the PE output so that they don't > > * end up at VA 0 which is below image base and thus invalid. Also use > > * the NOLOAD directive, even when currently ignored by PE output, in > > * order to note those sections shouldn't be loaded into memory. > > * > > * Note such sections are past _end, so if loaded will be discarded by > > * Xen anyway. > > */ > > > > Feel free to reword or expand the comment. > > Yes, I've edited it some while inserting. Will see to get to > submitting v2 then. > > > Not sure there's some > > reference we could add here about how debug sections are placed in PE > > files usually. > > As said before - I don't think there's any "usually" here, which is > why different environments have invented different ways. The debug > info native to COFF is more like ELF's symbol table (with a little > bit of extra information) plus Dwarf's .debug_line, but not really > fully covering what you'd expect from debug info.
One last thing, do you know if the newly added debug_* sections get the IMAGE_SCN_MEM_DISCARDABLE section flag set? Not sure there's a way we can force it from the linker script TBH, but would be nice and seems to be a recommended flag for debug sections according to Microsoft [0]. Thanks, Roger. [0] https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#section-flags