[PATCH] D140830: [AVR] correctly declare __do_copy_data and __do_clear_bss
Ayke via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 1 17:10:09 PST 2023
aykevl created this revision.
aykevl added reviewers: benshi001, dylanmckay.
Herald added subscribers: Jim, hiraditya, arichardson.
Herald added a project: All.
aykevl requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
These two symbols are declared in object files to indicate whether .data needs to be copied from flash or .bss needs to be cleared. They are supported on avr-gcc and reduce firmware size a bit, which is especially important on very small chips.
I checked the behavior of avr-gcc and matched it as well as possible. From my investigation, it seems to work as follows:
__do_copy_data is set when the compiler finds a data symbol:
- without a section name
- with a section name starting with ".data" or ".gnu.linkonce.d"
- with a section name starting with ".rodata" or ".gnu.linkonce.r" and flash and RAM are in the same address space
__do_clear_bss is set when the compiler finds a data symbol:
- without a section name
- with a section name that starts with .bss
Simply checking whether the calculated section name starts with ".data", ".rodata" or ".bss" should result in the same behavior.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D140830
Files:
llvm/lib/Target/AVR/AVRAsmPrinter.cpp
llvm/lib/Target/AVR/AVRDevices.td
llvm/lib/Target/AVR/AVRSubtarget.h
llvm/test/CodeGen/AVR/clear-bss.ll
llvm/test/CodeGen/AVR/no-clear-bss.ll
llvm/test/CodeGen/AVR/no-copy-data.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140830.485829.patch
Type: text/x-patch
Size: 7184 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230102/e68654a9/attachment.bin>
More information about the llvm-commits
mailing list