[bug #49567] Use meta-info from --print-multi-lib and --print-multi-directory · Issue #642 · avrdudes/avr-libc (original) (raw)
Wed 09 Nov 2016 03:32:38 PM CET
Currently, all the multilib layout and device -> multilib mapping and multilib -> options mapping is hand coded in scripts like devtools/gen-avr-lib-tree.sh
avr-gcc is able to provide information about the multilib layout. Using this feature can be used to dynamically adjust avr-libc build machinery to the actual multilib layout implemented by avr-gcc.
- Left of ";" you see the relative path where the files belonging to respective multilib variant will be situated.- Right of ";" are the options ("@" stands for " -") to select that multilib)```
$ avr-gcc --print-multi-lib
.;
avr25;@mmcu=avr25
avr3;@mmcu=avr3
avr31;@mmcu=avr31
avr35;@mmcu=avr35
avr4;@mmcu=avr4
avr5;@mmcu=avr5
avr51;@mmcu=avr51
avr6;@mmcu=avr6
avrxmega2;@mmcu=avrxmega2
avrxmega4;@mmcu=avrxmega4
avrxmega5;@mmcu=avrxmega5
avrxmega6;@mmcu=avrxmega6
avrxmega7;@mmcu=avrxmega7
avrtiny;@mmcu=avrtiny
tiny-stack;@msp8
avr25/tiny-stack;@mmcu=avr25@msp8
Notice how -msp8 is required to select "tiny-stack" (and **not** -mtiny-stack) which cause quite some confusion in the past.
In order to find out in which multilib a specific device is located, there is
$ avr-gcc -mmcu=at43usb320 --print-multi-directory
avr31
$ avr-gcc -mmcu=attiny261 --print-multi-directory
avr25/tiny-stack
The advantage of factoring out multilib layout is obvious. Suppose there is some avr-gcc flaw like [http://gcc.gnu.org/PR78275](https://savannah.nongnu.orghttp://gcc.gnu.org/PR78275) aka. [https://savannah.nongnu.org/bugs/index.php?49565](https://savannah.nongnu.orghttps://savannah.nongnu.org/bugs/index.php?49565)
If meta information from the compiler driver was used, there wouldn't have been a need to file a libc bug for a wrong multilib for AT43usb320 because avr-libc would factor out the multilib location and draw that information from avr-gcc.
[file #48056: mlib-gen-2.diff](https://savannah.nongnu.org/bugs/download.php?file_id=48056)
[file #48085: mlib-gen-3.diff](https://savannah.nongnu.org/bugs/download.php?file_id=48085)
This issue was migrated from https://savannah.nongnu.org/bugs/?49567