← Back to context

Comment by pjmlp

5 days ago

Strings is the easy part.

Try to link two binary libraries in Linux, both compiled with GCC, while not using exactly the same compiler flags, or the same data padding, for example things like structures.

Since committee people can explain it even better,

"To Save C, We Must Save ABI"

https://thephd.dev/to-save-c-we-must-save-abi-fixing-c-funct...

Sorry, this is nonsense. Binaries link just fine on Linux. If you use a compiler flag that changes the ABI, then you are on your own, of course, but the GCC docu makes it very clear which specific flags those are. There is some corner cases with problems where you get problems if you use different compilers, e.g. atomic alignment (by adopting the broken C++ design into C) and some other corner cases where compilers did things slightly different.

  • > e.g. atomic alignment (by adopting the broken C++ design into C)

    I would like to learn more about that. Do you mean this:

    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65146

    • Things like this resulting in differnt alignment between Clang and GCC on x86_64 for _Atomic struct { char a[3]; }; See: https://godbolt.org/z/v5hsjhzj9

      The problem is that in C++ these atomics are library types, but in C they are built-in types which should have a clearly specified ABI. But the goal was to make them compatibility with C++ library types, which is a rather stupid idea, which pulls in even more problems.

  • Assuming you have control over all binaries.

    Exactly because one gets issues with multiple compilers is yet another prof why there isn't such thing as official C ABI.