Page MenuHomePhabricator

[clang][AVR] Improve avr-ld command line options

Authored by benshi001 on Sep 28 2020, 5:36 AM.



Improve avr-ld options for total 249 devices:

  1. the argument of "-L" (device library sub path)
  2. the argument of "-m" (device family)

Diff Detail

Event Timeline

benshi001 created this revision.Sep 28 2020, 5:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 28 2020, 5:36 AM
benshi001 requested review of this revision.Sep 28 2020, 5:36 AM

For some devices, the library sub path "-L" and family name "-m" are not always equal.
-L/usr/lib/avr/lib/XXX" "-L/usr/lib/gcc/avr/5.4.0/XXX" "-mYYY"

XXX and YYY do not always equal to each other. But current clang/lib/Driver/ToolChains/AVR.cpp assumes they equal.

For example, "./bin/clang -O2 -Wall b.c --target=avr -mmcu=atmega2313" needs the following avr-ld options
"/usr/bin/avr-ld" *** "-L/usr/lib/avr/lib/avr25/tiny-stack" "-L/usr/lib/gcc/avr/5.4.0/avr25/tiny-stack" "-mavr25"

Here XXX=avr25/tiny-stack but YYY = avr25

benshi001 updated this revision to Diff 294854.Sep 28 2020, 6:23 PM
benshi001 edited the summary of this revision. (Show Details)
benshi001 updated this revision to Diff 294872.Sep 28 2020, 8:02 PM

I haven't verified this all but this looks reasonable to me, at least until a better way is figured out to store MCU specific information in the compiler.

The tests may be a little bit excessive though, they all seem to be testing the same thing.

dylanmckay accepted this revision.Nov 16 2020, 10:11 PM

Looks good to me, thanks for the patch @benshi001

NOTE: It looks like you will need to rebase this one prior to merge.
This revision is now accepted and ready to land.Nov 16 2020, 10:11 PM
This revision was automatically updated to reflect the committed changes.