Skip to content

Undefined weak symbols #133

Closed Answered by iains
ilg-ul asked this question in Q&A
Jun 6, 2024 · 1 comments · 9 replies
Discussion options

You must be logged in to vote

Default ELF linker semantics are different from default Mach-O linker semantics. ELF allows any undefined symbols, Mach-O does not (note that there are ELF linker options to make it reject missing symbols and, as I am going to write below, options to allow missing symbols on Mach-O).

In both cases, weak referenced symbols do operate at runtime in the same way (if the symbol is not present in the dynamically-linked exe, it will be 0).

For Mach-O, using current linkers, you have two ways to deal with this;

  1. you tell the linker that it's OK for a set of symbols to be undefined at static-link time -U,_symbol .. or (if there are many) by providing the list in a file [ man ld ].
  2. you tell the li…

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@iains
Comment options

@iains
Comment options

@ilg-ul
Comment options

@iains
Comment options

@ilg-ul
Comment options

Answer selected by iains
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants