[Top][All Lists]

[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

From: egor_suvorov at mail dot ru
Subject: [Bug ld/28619] New: -m option is not ignored when is immediately preceded by -o option
Date: Mon, 22 Nov 2021 21:09:06 +0000


            Bug ID: 28619
           Summary: -m option is not ignored when is immediately preceded
                    by -o option
           Product: binutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          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`:

`void _start(){}

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

Real result:

ld: unrecognised emulation mode: ain
Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 elf_iamcu elf_l1om
elf_k1om i386pep i386pe

Extra details:

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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]