[PATCH] D107133: [AVR] emit `MCSA_Global` references to `__do_global_ctors` and `__do_global_dtors`

Matt Jacobson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 30 23:45:21 PDT 2021


mhjacobson added a comment.

You're right, AVR does have a section (`.ctors`) for the *table* of constructors.  But there has to be some code that actually calls the functions in that table.  That's what `__do_global_ctors` does.  When present, it gets linked into the boot path (after things like `__do_copy_data` and `__do_clear_bss`) to do its work.  But if nothing requests it, it won't be linked, and the constructor table will just sit around, never to be consulted.

I see this code as similar to the code that links in `__do_copy_data`, which I think would also fall into the category of "magic symbols"—symbols that are necessary to make the program run correctly on AVR.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107133/new/

https://reviews.llvm.org/D107133



More information about the llvm-commits mailing list