diff options
Diffstat (limited to 'gcc/config/avr/driver-avr.c')
-rw-r--r-- | gcc/config/avr/driver-avr.c | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/gcc/config/avr/driver-avr.c b/gcc/config/avr/driver-avr.c index dbc5043d996..75d7e6f6791 100644 --- a/gcc/config/avr/driver-avr.c +++ b/gcc/config/avr/driver-avr.c @@ -55,9 +55,10 @@ avr_diagnose_devicespecs_error (const char *mcu, const char *filename) /* Implement spec function `device-specs-fileĀ“. - Compose -specs=<specs-file-name>. If everything went well then argv[0] - is the inflated specs directory and argv[1] is a device or core name as - supplied to -mmcu=*. */ + Compose -specs=<specs-file-name>%s. If everything went well then argv[0] + is the inflated (absolute) specs directory and argv[1] is a device or + core name as supplied by -mmcu=*. When building GCC the path might + be relative. */ const char* avr_devicespecs_file (int argc, const char **argv) @@ -79,16 +80,35 @@ avr_devicespecs_file (int argc, const char **argv) return X_NODEVLIB; case 1: + if (0 == strcmp ("device-specs", argv[0])) + { + /* FIXME: This means "device-specs%s" from avr.h:DRIVER_SELF_SPECS + has not been resolved to a path. That case can occur when the + c++ testsuite is run from the build directory. DejaGNU's + libgloss.exp:get_multilibs runs $compiler without -B, i.e.runs + xgcc without specifying a prefix. Without any prefix, there is + no means to find out where the specs files might be located. + get_multilibs runs xgcc --print-multi-lib, hence we don't actually + need information form a specs file and may skip it here. */ + return X_NODEVLIB; + } + mmcu = AVR_MMCU_DEFAULT; break; - case 2: + default: mmcu = argv[1]; - break; - default: - error ("specified option %qs more than once", "-mmcu="); - return X_NODEVLIB; + // Allow specifying the same MCU more than once. + + for (int i = 2; i < argc; i++) + if (0 != strcmp (mmcu, argv[i])) + { + error ("specified option %qs more than once", "-mmcu"); + return X_NODEVLIB; + } + + break; } specfile_name = concat (argv[0], dir_separator_str, "specs-", mmcu, NULL); |