[clang][driver] Do not emit default '-Tdata' for AVR devices
authorBen Shi <powerman1st@163.com>
Wed, 1 Mar 2023 07:38:22 +0000 (15:38 +0800)
committerBen Shi <powerman1st@163.com>
Wed, 1 Mar 2023 07:55:30 +0000 (15:55 +0800)
commit1c112897b20274852a9280d20cebd5c9f3619a7a
tree3ec9b440cd4103f30cb5acd244c74ebb35453357
parent5c943e36881815807e0f52743eabe785bf24e2db
[clang][driver] Do not emit default '-Tdata' for AVR devices

Different AVR devices have different data regions. Current clang
driver emits a default '-Tdata' option to the linker. This way
works fine if there is no user specified linker script, but it
will cause conflicts if there is one.

A better solution for setting the default data region to GNU ld
is defining symbol __DATA_REGION_ORIGIN__, which is expected by
GNU ld's default AVR linker script.

Fixes https://github.com/llvm/llvm-project/issues/60362

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D144533
clang/lib/Driver/ToolChains/AVR.cpp
clang/test/Driver/avr-ld.c