[all-commits] [llvm/llvm-project] 88b7b7: [AVR][clang] Pass the address of the data section ...

Dylan McKay via All-commits all-commits at lists.llvm.org
Wed Oct 28 10:35:50 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 88b7b76a0b2365fe4ea9f686c6346667bfe48488
      https://github.com/llvm/llvm-project/commit/88b7b76a0b2365fe4ea9f686c6346667bfe48488
  Author: Dylan McKay <me at dylanmckay.io>
  Date:   2020-10-29 (Thu, 29 Oct 2020)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticDriverKinds.td
    M clang/lib/Driver/ToolChains/AVR.cpp

  Log Message:
  -----------
  [AVR][clang] Pass the address of the data section to the linker for ATmega328

This patch modifies the Clang AVR toolchain so that it always passes
the '-Tdata=0x800100' to the linker for ATmega328 devices. This matches
AVR-GCC behaviour, and also corresponds to the address of the start of
the data section in data space according to the ATmega328 datasheet.

Without this, clang does not produce a valid ATmega328 binary.

When targeting all non-ATmega328 chips, a warning will be emitted due to
the fact that proper handling for the chips data section address is
not yet implemented.

I've held off adding other microcontrollers for now, mostly because the
AVR toolchain logic is smeared across LLVM core TableGen files, and two Clang
libraries. The 'family detection' logic is also only implemented for
ATmega328 at the moment, for similar reasons.

In the future, I aim to write an RFC to llvm-dev to find a better way
for LLVM to expose target-specific details such as these to compiler
frontends.

Differential Revision: https://reviews.llvm.org/D86629




More information about the All-commits mailing list