[PATCH] winegcc: Align sections in PE files to page size.

Rémi Bernon rbernon at codeweavers.com
Mon Jul 13 09:41:21 CDT 2020


This makes sure it will be possible to mmap the section directly instead
of having to copy them. It then also makes perf able to figure the code
origin for Wine modules.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---

I'm resending just this one as I am now trying to upstream PE support
directly in Linux perf. This should still be useful to avoid copying
sections when Wine modules are loaded.

 tools/winegcc/winegcc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
index 29c1b0549d3..24da839fd83 100644
--- a/tools/winegcc/winegcc.c
+++ b/tools/winegcc/winegcc.c
@@ -547,6 +547,9 @@ static strarray *get_link_args( struct options *opts, const char *output_name )
         else if (!opts->strip)
             strarray_add(link_args, "-Wl,-debug:dwarf");
 
+        if (!try_link( opts->prefix, link_args, "-Wl,--file-alignment:0x1000"))
+            strarray_add( link_args, "-Wl,--file-alignment:0x1000" );
+
         strarray_addall( link_args, flags );
         return link_args;
 
-- 
2.27.0




More information about the wine-devel mailing list