mirror of
https://git.code.sf.net/p/mingw-w64/mingw-w64
synced 2024-11-23 01:44:43 +08:00
19fb46e9e8
First, these intrins read from and write to thread-local memory. The TEB contains a pointer to itself in the DS segment, known as the `Self` field of `struct _NT_TIB`, which means the TEB is semantically in the same address space as other objects, so these asm statements must clobber "memory". If an asm statement writes to memory that is not passed with "m" constraints, then the compiler shall be noted that it has unknown side effects, by adding a `volatile` qualifier. Second, for Intel syntax, this commit removes superfluous prefixes in front of segment register names. Third, previously `Offset` was cast to a pointer and dereferenced, and then passed to inline assembly as a memory operand using the `m` constraint. This was a pure hack. GCC assumes that a memory operand should belong in the DS segment, so it appeared to reference unknown memory, and caused warnings like intrin-impl.h:849:1: warning: array subscript 0 is outside array bounds of 'long long unsigned int[0]' [-Warray-bounds=] 849 | __buildreadseg(__readgsqword, unsigned __int64, "gs", "q") | ^~~~~~~~~~~~~~ This commit passes the address by register instead. For Intel syntax, there is no way to print the `DWORD PTR` thing, so unfortunately the value also has to be passed by register. It's suboptimal, but should be safe. For x86-64, the use of a 32-bit address requires an address size override prefix. However, it's deliberate, as zero-extending a 32-bit register (like `mov edi, edi`) would require two additional bytes. Signed-off-by: LIU Hao <lh_mouse@126.com> |
||
---|---|---|
build-aux | ||
COPYING.MinGW-w64 | ||
COPYING.MinGW-w64-runtime | ||
mingw-w64-crt | ||
mingw-w64-doc | ||
mingw-w64-headers | ||
mingw-w64-libraries | ||
mingw-w64-tools | ||
.gitignore | ||
aclocal.m4 | ||
AUTHORS | ||
config.h.in | ||
configure | ||
configure.ac | ||
COPYING | ||
DISCLAIMER | ||
DISCLAIMER.PD | ||
Makefile.am | ||
Makefile.in |