[PATCH] winegcc: Add rpaths to help the macOS loader find ntdll.so.

Dean Greer gcenx83 at gmail.com
Fri Aug 20 15:06:43 CDT 2021


diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
index 426336e4536..0a72e6fbe49 100644
--- a/tools/winegcc/winegcc.c
+++ b/tools/winegcc/winegcc.c
@@ -492,6 +492,13 @@ static strarray *get_link_args( struct options *opts,
const char *output_name )
             strarray_add( flags, opts->image_base );
         }
         if (opts->strip) strarray_add( flags, "-Wl,-x" );
+        if (opts->unix_lib)
+        {
+            strarray_add( flags, "-install_name" );
+            strarray_add( flags, strmake( "@rpath/%s.so", output_name ) );
+            strarray_add( flags, "-Wl,-headerpad_max_inatall_names" );
+            strarray_add( flags, "-Wl,-rpath, at loader_path/" );
+        }
         strarray_addall( link_args, flags );
         return link_args;


On Fri, Aug 20, 2021 at 3:57 PM Dean Greer <gcenx83 at gmail.com> wrote:

> The only tweak I’d propose is adding  -Wl,-headerpad_max_install_names
>
>
> diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
> index 426336e4536..0a72e6fbe49 100644
> --- a/tools/winegcc/winegcc.c
> +++ b/tools/winegcc/winegcc.c
> @@ -492,6 +492,13 @@ static strarray *get_link_args( struct options *opts,
> const char *output_name )
>              strarray_add( flags, opts->image_base );
>          }
>          if (opts->strip) strarray_add( flags, "-Wl,-x" );
> +        if (opts->unix_lib)
> +        {
> +            strarray_add( flags, "-install_name" );
> +            strarray_add( flags, strmake( "@rpath/%s.so", output_name ) );
> +            strarray_add( flags, "-Wl,-headerpad_max_install_names" );
> +            strarray_add( flags, "-Wl,-rpath, at loader_path/" );
> +        }
>          strarray_addall( link_args, flags );
>          return link_args;
>
>
>
>
> On Fri, Aug 20, 2021 at 3:36 PM Huw Davies <huw at codeweavers.com> wrote:
>
>> On Fri, Aug 20, 2021 at 11:45:24AM -0400, Dean Greer wrote:
>> > That’s strange as this should work maybe only dylibs do this
>> correctly.. this
>> > is Apple.
>> >
>> > Could you instead implement adding this in the manner I explain above
>> instead
>> > so I can be used in a more general way?, aka UNIX_LDFLAGS that by
>> default add
>> > this needed -rpath, at loader_path/ but also allows adding additional
>> flags as
>> > needed.
>>
>> I'm not sure what your issue is with using LDFLAGS - they do only affect
>> unix libraries.  There shouldn't be an issue with passing an rpath in
>> that.
>>
>> Huw.
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20210820/b225cc15/attachment.htm>


More information about the wine-devel mailing list