[PATCH] D15575: [ELF] Allow target to configure ELF header flags in the output file

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 18 15:29:18 PST 2015


ruiu accepted this revision.
ruiu added a comment.
This revision is now accepted and ready to land.

LGTM with a nit.


================
Comment at: ELF/Writer.cpp:1009-1017
@@ +1008,11 @@
+static uint32_t getELFFlags() {
+  uint32_t ELFFlags = 0;
+  if (Config->EMachine == EM_MIPS) {
+    // FIXME: In fact ELF flags depends on ELF flags of input object files
+    // and selected emulation. For now just use hadr coded values.
+    ELFFlags = EF_MIPS_ABI_O32 | EF_MIPS_CPIC | EF_MIPS_ARCH_32R2;
+    if (Config->Shared)
+      ELFFlags |= EF_MIPS_PIC;
+  }
+  return ELFFlags;
+}
----------------
Can you return early?

  if (Config->EMachine != EM_MIPS)
    return 0;
  uint32_t V = EF_MIPS_ABI_O32 | ...;
  if (Config->Shared)
    return V | EF_MIPS_PIC;
  return V;


Repository:
  rL LLVM

http://reviews.llvm.org/D15575





More information about the llvm-commits mailing list