Am 03/03/2015 um 02:21 PM schrieb Senthil Kumar Selvaraj: > On Mon, Mar 02, 2015 at 08:40:17PM +0100, Georg-Johann Lay wrote: >> The new specs file generation introduces several problems. This patch >> >> - Fix build warnings >> >> - Clean up unused code and the old, now dead specs definitions. >> >> - Removes unused files and adjust build scripts / rules. >> >> - Issues with avr-libc awareness: >> >> -- Makes specs-generation aware of avr-libc (include tm.h in build script >> and depend on WITH_AVRLIBC). >> >> -- avr-libc implements functions in libm.a which usually live in libgcc, >> hence add -lm to libgcc_spec, cf. PR54461. >> >> -- The new libdev.a is a feature of avr-libc and not available with, e.g., >> newlib. Hence remove it from lib_spec if the compiler is not configured for >> avr-libc (--with-avrlibc=no). >> >> - Many minor issues with option propagation. >> >> - -march had been added to multilib generation some time ago, but >> driver_self_spec was not aware of that option. >> >> >> Ok for trunk? >> >> >> BTW, anyone knows what -march= is good for? It allows all kinds of silly >> option combinations like "-march=avrtiny -mmcu=atmega8" without any >> complaints. > > IIRC, -march was added because replacing -mmcu= to > -mmcu= in the driver's self specs broke multilib selection - the > driver always acted as if no -mmcu was specified. Adding For me both multilib selection and multilib generation are working as expected with -mmcu= and without that -march=. Attached is a 2nd part of improvements for the specs file generation: - Remove -arch= and use -mmcu= again. - Wrap specs file selection into a new specs function so that a comprehensible error message can be issued if no specs file is found. It also informs about a link to spec file documentation of gcc inline docs. - Remove genopt.sh and avr-tables.opt. These files are no more used because -mmcu= is a vanilla string option now. Using Enum option for -mmcu= does not allow to specify unknown devices, and target_handle_option cannot letgigimize unknown strings of Enum options. - Resurrect driver-avr.c but with new content: The new specs function. - New file specs.h with specs known to gcc and which can be overridden by avrlibc.h, rtems.h, etc. - New device-specs files mostly repeat spec definitions, e.g. fprintf (f, "*startfile:\n\t%s\n\n", STARTFILE_SPEC); fprintf (f, "*endfile:\n\t%s\n\n", ENDFILE_SPEC); - Device feature are expressed as subspecs now, e.g. avrlibc_startfile spec. - Clean up code from "current device" stuff, adjust diagnostics, avr-arch.h, etc. - Use INSTALL_DATA to install spec files, not INSTALL_PROGRAM. Ok to install this, too? Johann PR target/65296 * config.gcc (extra_options) [avr]: Remove. (extra_gcc_objs) [avr]: Use driver-avr.o, avr-devices.o. (tm_file) [avr]: Add avr/specs.h after avr/avr.h. (tm_defines) [avr, rtems]: Add WITH_RTEMS. * config/avr/genmultilib.awk: Use -mmcu= instead of -march=. * config/avr/t-multilib: Regenerate. * config/avr/specs.h: New file. * config/avr/driver-avr.c: New file. * config/avr/genopt.sh: Remove file. * config/avr/avr-tables.opt: Remove file. * config/avr/predicates.md (avr_current_arch): Rename to avr_arch. * config/avr/avr-c.c: Same. * avr-arch.h: Same. (avr_current_device): Remove proto. * config/avr/avr.c (avr_current_arch): Rename to avr_arch. (avr_current_device): Remove definition and usage. (avr_set_core_architecture): New static function. (avr_option_override): Use it. * config/avr/avr.h (avr_current_arch): Rename to avr_arch. (AVR_HAVE_8BIT_SP): Don't depend on avr_current_device. (EXTRA_SPEC_FUNCTIONS): Define. (avr_devicespecs_file): New specs function proto. (DRIVER_SELF_SPECS): Use device-specs-file spec function. * config/avr/avr-devices.c (diagnostic.h, avr-arch.h): Include them. (mcu_name): New static array. (comparator, avr_archs_str, avr_mcus_str): New static functions. (avr_inform_devices, avr_inform_core_architectures): New functions. * config/avr/gen-avr-mmcu-specs.c (avr-arch.h, specs.h): Include. (avrlibc.h) [WITH_AVRLIBC]: Include. (../rtems.h, rtems.h) [WITH_RTEMS]: Include. (print_mcu): Rewrite from scratch. * config/avr/avrlibc.h (LIB_SPEC, LIBGCC_SPEC, STARTFILE_SPEC): Forward to avr-specific specs defined in device-specs file. * config/avr/avr.opt (config/avr/avr-arch.h): Remove include. (-mmcu=): Add Var and MissingArgError properties. (-march=): Remove. * config/avr/t-avr (driver-avr.o): New rule. (avr-devices.o): Depend on avr-arch.h. (avr-mcus): No more depend on avr-tables.opt. (avr-tables.opt): Remove rule. (install-device-specs): Use INSTALL_DATA, not INSTALL_PROGRAM. > a new option (-march), translating mmcu= to march= and then > basing t-multilib on that worked ok. > >> >> What's wrong with -mmcu=avr* ? All architecture names start with "avr", and >> /no/ device name starts /with/ "avr", hence -mmcu= should be fine and work >> as smooth as in the last 10 years. >> >> Why that -march= option? If there is not a good reason for -march=, I'd >> propose to clean it up and use -mmcu=avr* instead. >> >> >> Johann