Mail Archives: djgpp/1994/08/26/01:56:37
Marty Leisner writes:
>
> I'm on a sparc, trying to build a cross sytem to support
> 386 development (djgcc, netbsd, freebsd, linux)
>
> [deletion]
>
> I consistently get:
> leisner AT gasface$ gnu-ld -v foo.o
> ld version 2.4 (with BFD 2.4)
> gnu-ld: warning: i386 architecture of input file `foo.o' is incompatible with sparc output
> gnu-ld:a.out: can't set architecture: File in wrong format
i also had this problem when trying to cross-link from linux to target
`i386-msdos-go32'. after running ld through the debugger, it turns
out that the `-o' option was being interpreted as `-oformat' option,
so it is trying to create an object file of type `foo.o'.
it turns out that `getopt_long_only ()' was returning incorrect
information when called from `parse_args ()' in ld/lexsup.c, but when
i tried to trace into `getopt_long_only ()' the debugger barfed
because of the no symbols were found for getopt[1].c, even tho they
had been compiled `-g'. i didn't have time to investigate the failure
further, but this total hack patch produces a working cross-ld:
- Cotton
*** lexsup.c- Sat Feb 26 14:01:59 1994
--- lexsup.c Tue Aug 23 03:02:25 1994
***************
*** 218,226 ****
--- 218,229 ----
set_default_dirlist (optarg);
break;
case 'o':
+ really_option_o:
lang_add_output (optarg, 0);
break;
case OPTION_OFORMAT:
+ if (!strcmp (argv[optind - 2], "-o"))
+ goto really_option_o;
lang_add_output_format (optarg, 0);
break;
case 'r':
- Raw text -