[PATCH] D54920: [ELF][MIPS] Handle mips in the OUTPUT_FORMAT directive

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 27 09:29:07 PST 2018


ruiu added a comment.

In D54920#1309178 <https://reviews.llvm.org/D54920#1309178>, @atanasyan wrote:

> - Return a boolean value indicating whether the name is MIPS N32 ABI or not from the `readBfdName` .
>
>   I think one of the problem is that there are multiple really different architectures and ABIs under the same `EM_MIPS` name. In particular, maybe it was better to introduce two different names `EM_MIPS` and `EM_MIPS_64` many years ago. In that case `ntradmips` (N32 ABI) could be describes like `{ELF32LEKind, EM_MIPS_64}`.


I agree with that. Too many different things are categorized under the same name just because it is considered just "MIPS". That's unfortunate.



================
Comment at: ELF/ScriptParser.cpp:428-435
+  ELFKind BfdEKind;
+  uint16_t BfdEMachine;
+  bool IsMipsN32Abi;
+  std::tie(BfdEKind, BfdEMachine, IsMipsN32Abi) = readBfdName();
   if (Config->EKind == ELFNoneKind) {
-    Config->EKind = P.first;
-    Config->EMachine = P.second;
+    Config->EKind = BfdEKind;
+    Config->EMachine = BfdEMachine;
----------------
This is a bit shorter:

  std::tuple<ELFKind, uint16_t, bool> Tuple = readBfdName();
  if (Config->EKind == ELFNoneKind)
    std::tie(Config->EKind, Config->EMachine, COnfig->MipsN32ABI) = Tuple;


Repository:
  rLLD LLVM Linker

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54920/new/

https://reviews.llvm.org/D54920





More information about the llvm-commits mailing list