[PATCH] D142595: [Driver][AVR] Don't emit default '-Tdata' when a linker script is specified

Ben Shi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 29 17:42:41 PST 2023


benshi001 added a comment.

In D142595#4089124 <https://reviews.llvm.org/D142595#4089124>, @MaskRay wrote:

> OK. If this doesn't add `-Tdata=` driver options, I'm fine with it.
> But why is default `-Tdata` added in the first place?
>
> Most linker scripts are added as `-Wl,-T,a.lds` (`-Wl,` values are opaque to the driver), so the driver cannot really know whether a linker script is used.

So how about change to

1. move the default `-Tdata` to a later position.
2. clang driver just checks `-T` but omits `-Wl`, this can not 100% fix the issue, but at least improve it. Current most users are from avr-gcc, who have get used to `-T`.

A good solution is using default linker script provided by the avr-libc, in which all sections start addresses are undefined symbols, which need users define them via command line options. -- I will do that solution in a different patch. Currently we just guarantee avr-gcc users's `-T` option will not be broken.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142595



More information about the cfe-commits mailing list