[PATCH] D28898: [ELF] - Allow emulation to be different from input objects target.

Simon Atanasyan via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 23 07:56:15 PST 2017


On Mon, Jan 23, 2017 at 6:15 PM, Rafael Avila de Espindola
<rafael.espindola at gmail.com> wrote:
> Simon Atanasyan <simon at atanasyan.com> writes:
>
>> On Mon, Jan 23, 2017 at 5:54 PM, Rafael Avila de Espindola
>> <rafael.espindola at gmail.com> wrote:
>>> Rafael Avila de Espindola <rafael.espindola at gmail.com> writes:
>>>
>>>>> +  // Take machine type from emulation first. That is done early so
>>>>> +  // we are able to report wrong emulation values if any.
>>>>> +  if (!Config->Emulation.empty()) {
>>>>> +    std::tie(Config->EKind, Config->EMachine, Config->OSABI) =
>>>>> +        parseEmulation(Config->Emulation);
>>>>> +    Config->MipsN32Abi = Config->Emulation == "elf32btsmipn32" ||
>>>>> +                         Config->Emulation == "elf32ltsmipn32";
>>>>> +  }
>>>>
>>>> What breaks without this? I am probably OK with completely ignoring -m
>>>> if a .o is present (which I assume is what gold does), but it feels odd
>>>> to use only some bits of it.
>>>
>>> BTW, have you tried asking the original author why the mismatched -m and
>>> .o?
>>
>> The idea is to show an error if a user provides mismatched input *.o files and
>> -m option's value.
>
> Sorry, I was referring to whoever wrote the code in Linux using a
> mismatched .o and -m. If it is just an oversight he might be willing to
> change it. If there is a reason then we would know what the use case is.

We can ignore the mismatching and drop mips-n32-emul.s test case, but
if and when we parse emulation we have to setup Config->MipsN32Abi
because N32 ABI cannot be inferred from EKind, Machine, and OSABI
flags.

-- 
Simon Atanasyan


More information about the llvm-commits mailing list