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

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 30 10:04:53 PST 2023


MaskRay requested changes to this revision.
MaskRay added a comment.
This revision now requires changes to proceed.

In D142595#4089391 <https://reviews.llvm.org/D142595#4089391>, @benshi001 wrote:

> 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, which will be overwritten by user's explicit specification.
>
> I will do that solution in a different patch, it needs more extra work. Currently we just guarantee avr-gcc users's `-T` option will not be broken.

I think checking whether there is a linker script in any way is not a right solution.
GNU ld supports `-dT` which lld doesn't support. A linker script can be used without a -T/-dT option as well (it gets appended).
Any chance to remove `-Tdata=` and require the user to specify a `-Tdata=`?


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

https://reviews.llvm.org/D142595



More information about the cfe-commits mailing list