bugAVR C Runtime Library - Bugs: bug #49567, Use meta-info from...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #49567: Use meta-info from --print-multi-lib and --print-multi-directory

Submitter:  Georg-Johann Lay <gjlayde>
Submitted:  Wed 09 Nov 2016 02:32:38 PM UTC
   
 
Category:  Build Infrastructure Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Build system
Status:  None Assigned to:  None
Percent Complete:  0% Open/Closed:  Open
Release:  2.0.0 Fixed Release:  None

Wed 18 Dec 2019 04:31:18 PM UTC, comment #2: 

Attached a new proposal mlib-gen-3.diff that has some minor simplifications and fixes typos in comments.

Apart from that, we should remove ./devtools/make-binary-dist.sh as it makes no more sense to have binary distributions because the binary will depend on the compiler used at configure time.  As make-binary-dist.sh invokes configure, that script is obsolete and should be removed so that nobody is misled by the existence of such a script.

Similar for ./avr-lib.spec[.in] which was supposed to build a RPM file.  The contents of that file are outdated, anyway.

(file #48085)

Georg-Johann Lay <gjlayde>
Thu 12 Dec 2019 02:02:45 PM UTC, comment #1: 

Attached a first draft version.

The $(srcdir)/avr tree is now generated by a new Python script mlib-gen.py which should work with Python v2.7 and v3.  Which parts of that tree will we used (and how) is determined by configure using -print-multi-lib and -print-multi-directory.

mlib-gen.py generates 4 files from the device-info still held in gen-avr-lib-tree.sh which are included by configure.ac.

There is still some build-in knowledge about avr-gcc multilib layout, for example about orthogonality of -mdouble=64 etc and which devices are asm-only.


        * configure.ac (asm_only): New var.
        (CHECK_AVR_DEVICE): Rewrite.
        (CHECK_MULTI_OPTION, CHECK_MULTI_VARIANT): New AC_DEFUNs.
        (CHECK_MULTI_OPTION) <-mdouble=32, -mlong-double=32>: New tests.
        (CHECK_MULTI_OPTION) <-mdouble=64, -mlong-double=64>: New tests.
        (devices.m4, devlist.m4, multilib.m4, files.m4): New m4_include's.
        (CHECK_AVR_DEVICE(<mcu>)): Remove all of them.
        (AM_CONDITIONAL(HAS_<mcu>)): Same.
        (AC_CONFIG_FILES) <avr/Makefile, avr/lib/Makefile>: Remove.
        (AC_CONFIG_FILES) <avr/lib/*/Makefile>: Remove all of them.
devtools/
        * Avr.am: Remove file.
        * Lib.am: Remove file.
        * mlib-gen.py: New Python script.
        * Makefile.am (EXTRA_DIST): Adjust to added / removed files.
        * gen-avr-lib-tree.sh: Let mlib-gen.py build $(srcdir)/avr.
        Clean up code.
        (CFLAGS_TINY_STACK): Remove.
        (CFLAGS_SHORT_CALLS): Remove.
        (AVR12_DEV_INFO): Assimilate AVR12TS_DEV_INFO.
        (AVR25_DEV_INFO): Assimilate AVR25TS_DEV_INFO.
        (AVRXMEGA3SC_DEV_INFO): Remove.
        (AVR_ARH_INFO): Remove assimilated entries.
        * Device.am (AVR_INSTALL_DIR): Set to $(MULTIDIR_<<dev>>).
        (if HAS_<<dev>>): Remove.
        * Architecture.am (SUBDIRS): Remove.
        (AVRLIB_DEVLIST) [!HAS_DEV_LIB]: Init from $(DEVLIST_<<ident>>).
        (AVRLIB_CFLAGS, AVRLIB_ASFLAGS) <-mmcu=$(AVR_TARGET)>: Remove option.
        (avrD32) [HAS_double32]: New secondary.
        (avrD64) [HAS_double64]: New secondary.
        (avrL32) [HAS_long_double32]: New secondary.
        (avrL64) [HAS_long_double64]: New secondary.
        (avrD64) [HAS_double64]: New secondary.
        (if HAS_<<arh>>): Remove.


Georg-Johann Lay <gjlayde>
Wed 09 Nov 2016 02:32:38 PM UTC, original submission:  

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 aka. https://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.

Georg-Johann Lay <gjlayde>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #48085:  mlib-gen-3.diff added by gjlayde (77KiB - text/x-patch - Proposed patch with some minor improvements compared to file #48056)
file #48056:  mlib-gen-2.diff added by gjlayde (76KiB - text/x-patch - Proposed patch.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gjlayde (Submitted the item)
  •  

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-12-18 gjlayde Attached File- Added mlib-gen-3.diff, #48085
    2019-12-13 gjlayde Attached File- Added mlib-gen-2.diff, #48056

    Back to the top

    Powered by Savane 3.13-cf05.
    Corresponding source code