[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
Sat Jan 28 19:02:26 PST 2023


benshi001 added a comment.

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

> This is probably not a good idea. See https://github.com/llvm/llvm-project/issues/60203#issuecomment-1407532083

I agree with your comment in `https://github.com/llvm/llvm-project/issues/60203#issuecomment-1407532083`, But I still think my patch is worth to be applied.

Since you mentioned `It's not a problem to have multiple -Tdata=. The last wins.` But what will happen if both a linker script and a `-Wl,-Tdata` are specified? ASFAIK, the command line option will win.

But the default "-Tdata" is added according to each specific AVR device SRAM layout (https://github.com/llvm/llvm-project/blob/main/clang/lib/Driver/ToolChains/AVR.cpp#L35).

My opinion is:

1. We should add a default SRAM address to the linker, if user does not specify any link options. This is current behaviour of clang's main branch.
2. If the user explictly specifies a linker scrpit, we should follow the user's willing, and do not decide the SRAM address for him.


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