[PATCH] D86629: [AVR][clang] Pass the address of the data section to the linker for ATmega328

Ben Shi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 28 20:36:27 PDT 2020


benshi001 added a comment.

I think this patch is OK to be committed.

And I hope

1. Temporarily using an array for more devices, before a solution of getting info from the tblgen.

2. Distinghuish the arguments for "-L" and "-m". It is correct for atmega328 that avr-ld needs "-L/usr/lib/avr/lib/avr5" ... "-latmega328p" "-mavr5" But for some special devices, such as attiny24, the following options is needed by avr-ld "-L/usr/lib/avr/lib/avr25/tiny-stack" ... "-lattiny24" "-mavr25", since the avr-lib's file organization.

I am glad to maintain an array before a formal tblgen solution, which includes device family (-m), 
lib file sub path (-L), data segment address (-T)



================
Comment at: clang/lib/Driver/ToolChains/AVR.cpp:40
 
+llvm::Optional<unsigned> GetMcuSectionAddressData(StringRef MCU) {
+  return llvm::StringSwitch<llvm::Optional<unsigned>>(MCU)
----------------
aykevl wrote:
> I don't think the LLVM coding style says something about this, but coming from Go I'm more used to capitalized abbreviations (`MCU`, `GetMCUSectionAddressData`).
> 
> However, this is just a superficial thing, feel free to ignore.
I prefer to "Mcu"


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86629



More information about the cfe-commits mailing list