[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
Tue Aug 3 21:11:03 PDT 2021


mhjacobson added inline comments.


================
Comment at: llvm/test/CodeGen/AVR/ctors.ll:11
+
+; CHECK: .globl __do_global_ctors
+ at llvm.global_ctors = appending global [1 x { i32, void () addrspace(1)*, i8* }] [{ i32, void () addrspace(1)*, i8* } { i32 65535, void () addrspace(1)* @do_nothing, i8* null }]
----------------
MaskRay wrote:
> This is insufficient. It should additionally check whether the label is defined.
The label isn't expected to be defined.  The symbol comes from libgcc.a.

This directive simply tells the assembler to emit an undefined-symbol reference to `__do_global_ctors`.  The actual implementation comes at link time, from libgcc.

For comparison, see `llvm/test/CodeGen/AVR/clear-bss.ll`, which does the same thing.

(Apologies if I'm misunderstanding your request here.)


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