> Oh, I see, I didn't know it's already broken on aarch64. FWIW, I just wanted
> to fix a warning on clang msvcrt target and while doing that, I generalized the
> solution. We can wait with that for aarch64 solution.
Though what I was waiting on was to find out whether or was my problem
or somebody else's (i.e. would it still be an issue on our eventual BSP).
Which is, at least a bit, independent of whether wine needs a solution in general.
I probably should have at filed the bug anyway 😊
> Depending on -latomic may be problematic in PE builds. If I read libatomic
Mingw should have a -latomic too, it's the underlying runtime for the C++11 atomics
(but it just contains the C-API out-of-line implementations to fall back on
when there aren't appropriate intrinsics).
> source right, libatomic resorts to using lock in this case (pthread_mutex_lock
> or equivalent, depending on host).
Yes, that's what it does, which seemed equivalent to what wine had previously done,
and was easy to drop in as a workaround.
> We could probably just add a variant of affected RtlInterlocked*SList* functions
> that would use critical section instead of interlocked operations.
Yep. Or do what I think MS actually did, and implement the Header8 layout for when
you can't use double-pointer compare-and-exchange. They need that anyway,
(though maybe not anymore) since original amd64 CPUs don't have cmpxchg16b either.
I don't know the details on SLIST_HEADER::Header8 (presumably the same, just with
fewer bits in some of the fields), and there doesn't seem to be a lot of MSDN documentation
But here's some references I've dug up that at least mention it existed for such cases...
And obviously the Header8 struct in wine and reactos came from somewhere...
https://docs.microsoft.com/en-us/windows/win32/sync/interlocked-singly-link…https://devblogs.microsoft.com/oldnewthing/20110819-00/?p=9853https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/m…https://cbloomrants.blogspot.com/2010/05/05-29-10-lock-free-in-x64.html
> Thanks,
>
> Jacek
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
This code path is used mostly when cross target can't be found, which
means that mingw is most likely not available. *windows-gnu targets,
however, require cross compiled libgcc (or compiler-rt), which is
roughly a part of mingw distro, so they will most likely not work
anyway. When using *-windows target (meaning msvc compatibility mode),
Wine is self sufficient and doesn't need any external cross compiled
bits. If someone has an unusual setup and wants the old behaviour, it's
probably good idea to explicitly specify CROSSTARGET anyway.
configure.ac | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Allows setting file alignment on LLD 10.
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
Martin already added support for mingw-style option to upstream LLD, so
that it will not be needed with future versions. Supporting older
versions is easy enough that I decided to send this patch, but I don't
mind if it's dropped.
tools/winegcc/winegcc.c | 5 +++++
1 file changed, 5 insertions(+)
When getauxval isn't available we can read the auxillary vector after
environment pointers according to System V ABI.
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
---
I'm not sure if this is very useful, but some runtimes (steamrt for
instance) have old glibc where getauxval isn't available and it then
causes SymInitializeW to fail because of NULL process image addresses.
dlls/ntdll/unix/loader.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c
index bd3a0958757..02ffc0ca775 100644
--- a/dlls/ntdll/unix/loader.c
+++ b/dlls/ntdll/unix/loader.c
@@ -1343,6 +1343,27 @@ ULONG_PTR get_image_address(void)
if (task_info(mach_task_self(), TASK_DYLD_INFO, (task_info_t)&dyld_info, &size) == KERN_SUCCESS)
return dyld_info.all_image_info_addr;
+#elif defined(__linux__)
+ ULONG_PTR size, num, phdr_addr;
+ ElfW(Phdr) *phdr;
+ Elf64_auxv_t *auxp;
+ char **envp = main_envp;
+ while (*envp++ != NULL);
+
+ for (auxp = (Elf64_auxv_t *)envp; auxp->a_type != 0; auxp++)
+ {
+ if (auxp->a_type == AT_PHDR) phdr_addr = auxp->a_un.a_val;
+ if (auxp->a_type == AT_PHENT) size = auxp->a_un.a_val;
+ if (auxp->a_type == AT_PHNUM) num = auxp->a_un.a_val;
+ }
+
+ if (!phdr_addr) return 0;
+ phdr = (ElfW(Phdr) *)phdr_addr;
+ while (num--)
+ {
+ if (phdr->p_type == PT_PHDR) return phdr_addr - phdr->p_offset;
+ phdr = (ElfW(Phdr) *)((char *)phdr + size);
+ }
#endif
return 0;
}
--
2.27.0