- if (old_flags & E_FLAG_RL78_G10)
- (*_bfd_error_handler) (_("- %s is G10, %s is not"),
- bfd_get_filename (obfd), bfd_get_filename (ibfd));
+ if (in_cpu == E_FLAG_RL78_ANY_CPU || in_cpu == out_cpu)
+ /* It does not matter what new_cpu may have. */;
+ else if (out_cpu == E_FLAG_RL78_ANY_CPU)
+ {
+ if (in_cpu == E_FLAG_RL78_G10)
+ {
+ /* G10 files can only be linked with other G10 files.
+ If the output is set to "any" this means that it is
+ a G14 file that does not use hardware multiply/divide,
+ but that is still incompatible with the G10 ABI. */
+ error = TRUE;
+
+ (*_bfd_error_handler)
+ (_("RL78 ABI conflict: G10 file %s cannot be linked with %s file %s"),
+ bfd_get_filename (ibfd),
+ rl78_cpu_name (out_cpu), bfd_get_filename (obfd));
+ }
+ else
+ {
+ old_flags &= ~ E_FLAG_RL78_CPU_MASK;
+ old_flags |= in_cpu;
+ elf_elfheader (obfd)->e_flags = old_flags;
+ }
+ }