Michael Witten wrote:
I still don't understand why gcc imposes these libraries, when they
have nothing to do with compilation. It just seems like bad design.
You can't divorce a compiler from the target. The target's ABI
specifies a great number of details that are very much relevant to the
compiler, such as:
- calling conventions
- how assembler names are decorated
- size of pointers
- how SIMD and floating registers are passed and saved/restored
- alignment of the stack
- struct and bitfield padding
- register used for PIC and how PIC code is generated
- how TLS variables are created and accessed
- method for unwinding the stack for exception handling
- accessing shared variables and calling into shared libraries
- etc.
As an example I present Linux (ELF) and Windows (PE). These both
run on
identical ia32 and x64 hardware. But they could not be more different
in a number of the above.