Why can a T* be passed in register, but a unique_ptr cannot?

Is this actually an ABI requirement, or maybe it’s just some pessimization in certain scenarios? One example is System V Application Binary Interface AMD64 Architecture Processor Supplement. This ABI is for 64-bit x86-compatible CPUs (Linux x86_64 architecure). It is followed on Solaris, Linux, FreeBSD, macOS, Windows Subsystem for Linux: If a C++ object has either … Read more

Linking problems due to symbols with abi::cxx11?

Disclaimer, the following is not tested in production, use at your own risk. You can yourself release your library under dual ABI. This is more or less analogous to OSX “fat binary”, but built entirely with C++. The easiest way to do so would be to compile the library twice: with -D_GLIBCXX_USE_CXX11_ABI=0 and with -D_GLIBCXX_USE_CXX11_ABI=1. … Read more

Why does the Mac ABI require 16-byte stack alignment for x86-32?

From “IntelĀ®64 and IA-32 Architectures Optimization Reference Manual”, section 4.4.2: “For best performance, the Streaming SIMD Extensions and Streaming SIMD Extensions 2 require their memory operands to be aligned to 16-byte boundaries. Unaligned data can cause significant performance penalties compared to aligned data.” From Appendix D: “It is important to ensure that the stack frame … Read more

Does C have a standard ABI?

C defines no ABI. In fact, it bends over backwards to avoid defining an ABI. Those people, who like me, who have spent most of their programming lives programming in C on 16/32/64 bit architectures with 8 bit bytes, 2’s complement arithmetic and flat address spaces, will usually be quite surprised on reading the convoluted … Read more