[PATCH] D144533: [clang][driver] Do not emit default '-Tdata' for AVR devices

Ben Shi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 28 21:01:52 PST 2023


benshi001 added a comment.

In D144533#4160297 <https://reviews.llvm.org/D144533#4160297>, @MaskRay wrote:

> This change is an improvement but why is `__DATA_REGION_ORIGIN__` defined?

Because,

1. Different AVR devices have different SRAM address range (start & length), and `__DATA_REGION_ORIGIN__` specifies the start address.
2. `__DATA_REGION_ORIGIN__` is a expected symbol by GNU-ld's default AVR linker script. Please refer to https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=ld/scripttempl/avr.sc;h=9abfc536121cdfad67dfed295d4d879fa3722b1b;hb=d80081ef39c729b0f5f548c9567be2d80dcc2fd0

The benefit

1. User can fully use the SRAM region without concerning about linking, by using default values/choices.
2. User can specify his own device's SRAM region by using his own linker script, (of course, he should not use `__DATA_REGION_ORIGIN__` in his linker script, but this is much better than current `-Tdata`).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144533



More information about the cfe-commits mailing list