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

Rémi Bernon rbernon at codeweavers.com
Mon Jul 13 12:49:22 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>

v2: Move code to PLATFORM_MINGW case.

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

diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
index 29c1b0549d3..274f93f40fd 100644
--- a/tools/winegcc/winegcc.c
+++ b/tools/winegcc/winegcc.c
@@ -521,6 +521,9 @@ static strarray *get_link_args( struct options *opts, const char *output_name )
         if (opts->debug_file && strendswith(opts->debug_file, ".pdb"))
             strarray_add(link_args, strmake("-Wl,-pdb,%s", opts->debug_file));
+        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;

More information about the wine-devel mailing list