[ITA] clang

Takashi Yano takashi.yano@nifty.ne.jp
Thu Apr 24 11:54:40 GMT 2025


Hi Jeremy,

On Tue, 22 Apr 2025 15:50:52 +0900
Takashi Yano wrote:
> > but it is not worked around by defining the macro.  There should also be a
> > big red warning that, due to the macro being defined, clang++ and g++
> > compiled objects might not be able to link to each other if they try to
> > pass std::strings (or possibly other stl objects) between them.
> 
> Ah, that might be. This probelm may also happen when dll is called from
> the app compiled by g++ if the dll is built with clang++. This is more
> likely to happen.

To avoid this incompatibility, I tried to build llvm/clang without
both 0005-use_cxx11_abi.patch and 0110-use_cxx11_abi.patch, and add
-DCMAKE_CXX_STANDARD=20
instead. It makes llvm/clang be built successfully.

Then, the linkage between objects compiled by g++ and clang++ succeeded.
$ g++ -c b.cc -o b.o
$ clang++ -std=c++14 -c a.cc -o a.o
$ clang++ a.o b.o
$ ./a.exe
Received string: Processed: Hello, World!
$

Without -std=c++14, an error occurs in linking.

I also tested dll like:
$ g++ -shared b.cc -o b.dll
$ clang++ -c a.cc -o a.o
$ clang++ a.o b.dll
$ ./a.exe
Received string: Processed: Hello, World!
$
and it scceeded as well.

Isn't this better than mixed ABI problem, is it?

I'm still not sure why the llvm-min-tblgen.exe crashes, so
there may be still have problems even with this hack.

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: a.cc
Type: text/x-c++src
Size: 384 bytes
Desc: not available
URL: <https://cygwin.com/pipermail/cygwin-apps/attachments/20250424/be0e43a2/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: b.cc
Type: text/x-c++src
Size: 108 bytes
Desc: not available
URL: <https://cygwin.com/pipermail/cygwin-apps/attachments/20250424/be0e43a2/attachment-0003.bin>


More information about the Cygwin-apps mailing list