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

Ben Shi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 30 22:36:35 PDT 2021


benshi001 added inline comments.


================
Comment at: llvm/lib/Target/AVR/AVRAsmPrinter.cpp:64
   const MCRegisterInfo &MRI;
+  bool EmittedStructorSymbolAttrs = false;
 };
----------------
It would not be good to use such a flag. But would be better to put your code into MCTargetDesc/AVRTargetStreamer.cpp where `__do_copy_data` is emitted, and make a check like

```
if (current module has constructor)
  emit do_global_ctors
if (current module has destructor)
  emit do_global_dtors
```


================
Comment at: llvm/lib/Target/AVR/AVRAsmPrinter.cpp:206
+
+    MCSymbol *DtorsSym = OutContext.getOrCreateSymbol("__do_global_dtors");
+    DtorsSym->setExternal(true);
----------------
Do we need to emit some comments for ` __do_global_dtors` as `__do_copy_data` has ?


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