Issue 60203
Summary [AVR] link failure: clang passes broken option `-T text=` and `-T data=` to the GNU linker
Labels
Assignees
Reporter sprintersb
    The GNU linker supports options `-Ttext=`,  `-Tdata=` etc.  But when clang passes these options to GNU `ld`, it adds an additional blank after `T`:

```none
> echo 'int main(){};' | avr-gcc -xc - -o x.elf -mmcu=atmega2560 -Ttext=0x10000 -v # ok
```
shows that `ld` gets `-Ttext=0x10000`.  With clang however it passes `-T text=0x10000`:

```none
> echo 'int main(){};' | avr-clang -xc - -o x.elf -mmcu=atmega2560 -Ttext=0x10000 -v
...
"/usr/bin/avr-ld" -o x.elf --gc-sections -L... -Tdata=0x800200 --start-group -l:crtatmega2560.o -lgcc -lm -lc -latmega2560 /tmp/--17d6c3.o --end-group -T text=0x10000 -mavr6
/usr/bin/avr-ld: cannot open linker script file text=0x10000: No such file or directory
clang: error: avr-ld command failed with exit code 1 (use -v to see invocation)
```

Using `-Wl,Tdata=` to pass options through to the linker is not a good idea, because the driver program must omit `-Tdata=` if the user specifies `-Tdata=`.  Using `-Wl,-Tdata=` would lead to two incompatible specifictions of data start.

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to