$ nm a.o
0000000000000000 t _bar
0000000000000000 T _foo
0000000000000000 t ltmp0
0000000000000008 s ltmp1
$ clang b.c a.o # b.c just tries to call `bar()`
Undefined symbols for architecture arm64:
"_bar", referenced from:
_main in b-457c5f.o
ld: symbol(s) not found for architecture arm64
0000000000000000 W bar
0000000000000000 T foo
Sample code:
This should make a symbol that is linkable from external libraries, but instead
bargets placed in private text. Attempting to link fails.On Linux,
barcorrectly gets made a public weak symbol:This functionality should be supported in MacOS: