mcfgthread icon indicating copy to clipboard operation
mcfgthread copied to clipboard

Support for clang++ and libcxx?

Open lhmouse opened this issue 7 years ago • 13 comments

Should we add support for clang++ and libcxx on Windows?

If somebody wants to contribute, here is some pseudo documentation.

lhmouse avatar Dec 25 '16 14:12 lhmouse

Worth trying.

FrankHB avatar Dec 25 '16 15:12 FrankHB

@FrankHB

make it happen? :joy:

lhmouse avatar Dec 26 '16 05:12 lhmouse

If I had time... -1s :(

FrankHB avatar Dec 26 '16 09:12 FrankHB

Does this project have any problems compiling with clang on windows?

And what the target is? mingw-w64? msvc?

CarterLi avatar Dec 26 '16 11:12 CarterLi

@CarterLi There might be. I haven't tested it yet.

lhmouse avatar Dec 26 '16 11:12 lhmouse

https://gcc.godbolt.org can generate Intel-style ASM somehow https://godbolt.org/g/MyraQx

CarterLi avatar Mar 29 '17 05:03 CarterLi

That is irrelevant. The problem is that at the moment _seh_top.h doesn't compile on clang for i686. On x64 there is no problem because the AT&T and Intel dialects happen to be the same.

lhmouse avatar Mar 29 '17 05:03 lhmouse

not sure but __asm__ volatile ( "mov{l} {%%fs:0, %0|%0, dword ptr fs:[0]} \n" "mov{l} {%0, (%1)|dword ptr[%1], %0} \n" "mov{l} {%2, 4(%1)|dword ptr[%1 + 4], %2} \n" "mov{l} {%1, %%fs:0|dword ptr fs:[0], %1} \n" : "=&r"(__pUnused) : "r"(__pSehNode), "p"(__MCFCRT_SehTopDispatcher) ); ` will generate the same code for at&t and Intel syntax?

vyache76 avatar May 01 '21 09:05 vyache76

I suspect that's correct.

At the moment we have -masm=intel which should be removed first. PRs are welcome.

lhmouse avatar May 02 '21 05:05 lhmouse

Refactored so far. I am not sure whether clang people would show any interest on this project as they seem to prefer native TLS (using MSVC as the backend).

lhmouse avatar Apr 19 '22 17:04 lhmouse

will generate the same code for at&t and Intel syntax?

https://github.com/lhmouse/mcfgthread/blob/12c53d5a8b396caec688511ecf14af0ca6e980e2/src/win32.h#L127

It seems there is no way to make clang accept Intel syntax, so I decide to stick to AT&T syntax, and leave Intel syntax in comments. This piece of assembly was actually created by disassembling GCC's output with GDB.

lhmouse avatar Apr 19 '22 17:04 lhmouse

This is the last error that is blocking Clang support: https://github.com/llvm/llvm-project/issues/55329

lhmouse avatar May 08 '22 10:05 lhmouse