/GCC 7

8.3.1 Legacy Type Encoding

Unfortunately, historically GCC used to have a number of bugs in its encoding code. The NeXT runtime expects GCC to emit type encodings in this historical format (compatible with GCC-3.3), so when using the NeXT runtime, GCC will introduce on purpose a number of incorrect encodings:

  • the read-only qualifier of the pointee gets emitted before the ’^’. The read-only qualifier of the pointer itself gets ignored, unless it is a typedef. Also, the ’r’ is only emitted for the outermost type.
  • 32-bit longs are encoded as ’l’ or ’L’, but not always. For typedefs, the compiler uses ’i’ or ’I’ instead if encoding a struct field or a pointer.
  • enums are always encoded as ’i’ (int) even if they are actually unsigned or long.

In addition to that, the NeXT runtime uses a different encoding for bitfields. It encodes them as b followed by the size, without a bit offset or the underlying field type.

© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.