[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/28619] New: -m option is not ignored when is immediately precede
egor_suvorov at mail dot ru
[Bug ld/28619] New: -m option is not ignored when is immediately preceded by -o option
Mon, 22 Nov 2021 21:09:06 +0000
Bug ID: 28619
Summary: -m option is not ignored when is immediately preceded
by -o option
Assignee: unassigned at sourceware dot org
Reporter: egor_suvorov at mail dot ru
Target Milestone: ---
Here are upstream bugs for GCC and Clang:
And the initial StackOverflow question:
Steps to reproduce:
1. Take an arbitrary small C program, compile it to an object file e.g. `a.o`.
I've used the following incorrect one compiled with `gcc main.c -c`:
2. `ld main.o -o -main` - note that the dash before `main` is not a typo.
Expected result: linking is successful, output is written to a file name
ld: unrecognised emulation mode: ain
Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 elf_iamcu elf_l1om
elf_k1om i386pep i386pe
It seems to me that the `-main` command line argument is parsed twice: once as
an argument for the `-o` option, and once as a `-m` flag.
For example, if I run `ld main.o -o -melf_x86_64`, linking succeeds and output
is written to `./-melf_x86_64`.
If I try `ld main.o -o -mi386` it fails with the following message:
ld: i386:x86-64 architecture of input file `main.o' is incompatible with i386
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/28619] New: -m option is not ignored when is immediately preceded by -o option,
egor_suvorov at mail dot ru <=