Sending these patches here as well as it could be useful for anyone wanting to make performance analysis, although it's a little bit hacky.
Rémi Bernon (2): makefiles: Align PE sections so that they get directly mmap-ed makefiles: Split PE debug sections to separate ELF file
tools/makedep.c | 9 +++++++++ 1 file changed, 9 insertions(+)
-- 2.20.1
This will make linux perf tool able to find the origin of the code in memory.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- tools/makedep.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/tools/makedep.c b/tools/makedep.c index 24866b31455..9713f62b25d 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -3242,6 +3242,7 @@ static void output_module( struct makefile *make ) output_filenames_obj_dir( make, make->res_files ); output_filenames( all_libs ); output_filename( make->is_cross ? "$(CROSSLDFLAGS)" : "$(LDFLAGS)" ); + output_filename( make->is_cross ? "-Wl,--file-alignment,4096" : "" ); output( "\n" );
if (spec_file && make->importlib)
Linux perf tool cannot parse PE files for debug information, but it also looks for external debug info alongside to the binaries it detects.
We can use this feature to provide DWARF information for PE files by splitting the sections to a separate ELF that perf will understand.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- tools/makedep.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/tools/makedep.c b/tools/makedep.c index 9713f62b25d..b5474dc24f5 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -3244,6 +3244,14 @@ static void output_module( struct makefile *make ) output_filename( make->is_cross ? "$(CROSSLDFLAGS)" : "$(LDFLAGS)" ); output_filename( make->is_cross ? "-Wl,--file-alignment,4096" : "" ); output( "\n" ); + if (make->is_cross) + { + output( "ifeq ($(CROSSTARGET),x86_64-w64-mingw32)\n"); + output( "\tmkdir -p $(@D)/.debug && objcopy -O elf64-x86-64 --only-keep-debug --file-alignment=4096 $@ $(@D)/.debug/$(@F)\n" ); + output( "else\n"); + output( "\tmkdir -p $(@D)/.debug && objcopy -O elf32-i386 --only-keep-debug --file-alignment=4096 $@ $(@D)/.debug/$(@F)\n" ); + output( "endif\n"); + }
if (spec_file && make->importlib) {