Another non-classical behavior: weak symbols vs. strong symbols. Symbols are strong by default and can be marked as weak with the __attribute__((weak)) syntax in GCC and GCC-like compilers (I'm unsure if any of the Microsoft compilers support a similar feature).
If the symbol is already in the module marked as resolved:
- If both the original symbol and the new symbol are marked __attribute__((weak)), then do not raise an error. Pick one arbitrarily and discard the other.
- If one of the original symbol and the new symbol is marked __attribute__((weak)), then do not raise an error. Pick the strong symbol and discard the weak symbol.
- Otherwise, raise an error complaining that an object has multiple definitions.