Since you have the perfect working (clang v20) vs non-working (clang v21)
situation, you could try using 

go build -x -work to see what .o files are being produced

and then

llvm-objdump -f your_object_file.o 

on all of the .o files to see if the types changed?

...and then try to contrast the two: see exactly which file has a "changed" 
format, if
any -- if you found one that changed, you could go deeper into exactly
what changed; the semantic equivalent of a binary "diff" but based on 
llvm-objdump
https://llvm.org/docs/CommandGuide/llvm-objdump.html



On Monday, September 1, 2025 at 1:26:12 AM UTC+1 Alex wrote:

> Well I have been using bleeding edge clang for a couple of years now, this 
> is the first stable release version to break.
> llvm-mingw is even the compiler the builders use so it's the opposite 
> actually, it would be surprising for clang to not work.
> See linked issue for reasons why the move to clang:
> https://github.com/golang/go/issues/35006#issuecomment-1122405895
>
> On Monday, 1 September 2025 at 2:25:51 am UTC+8 Jason E. Aten wrote:
>
>> ah, I see you said "using clang20 works as expected", so I guess clang is 
>> working fine
>> on that version...
>>
>> On Sunday, August 31, 2025 at 7:23:47 PM UTC+1 Jason E. Aten wrote:
>>
>>> Hi Alex,
>>>
>>> I haven't worked with Go on Windows in a year, so my knowledge
>>> might be out of date... That said, I found CGO very sensitive to
>>> the exact C compiler used, and even within GCC, the exact version.
>>> Here is the version that I had working at one point in the last couple 
>>> of years:
>>>
>>> mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0 (somewhere on sourceforge I 
>>> think).
>>>
>>> Mind you, I'm not saying you cannot get Clang to work. I'm just 
>>> suggesting
>>> that if you start with a positive control (that does let you build), 
>>> then you
>>> can confidently try other compilers knowing that everything else is held 
>>> the same.
>>>
>>> Or you might have gotten what you need with the mingw-w64 gcc, and that's
>>> good enough.  
>>>
>>> Let me know if you are able to make Clang work--it would be an 
>>> interesting data point.
>>>
>>> Best,
>>> Jason
>>>
>>> On Sunday, August 31, 2025 at 12:56:13 PM UTC+1 Alex wrote:
>>>
>>>> I am using the go compiler, this is about using cgo together with the 
>>>> go compiler.
>>>> And this was with the 1.24 and 1.25 toolchains 
>>>>
>>>> On Sunday, 31 August 2025 at 7:51:08 pm UTC+8 Michael Oguidan wrote:
>>>>
>>>>> Hi Alex, which version of Go are you using, and why don't use the 
>>>>> actual Go compiler which is written in Go.
>>>>>
>>>>> On Sunday, August 31, 2025 at 8:15:39 AM UTC Alex wrote:
>>>>>
>>>>>> Been trying to use go with clang21 on windows but compiling any cgo 
>>>>>> app results in "cannot parse *.o as ELF, Mach-O, PE or XCOFF"
>>>>>>
>>>>>> Tried with go1.24.* and 1.25, using clang20 works as expected.
>>>>>
>>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/bbb76917-57a7-4b96-aed0-6e234e3181a3n%40googlegroups.com.

Reply via email to