[PATCH] D105867: [lld-macho] Optimize bind opcodes with multiple passes

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 15 11:59:49 PDT 2021


int3 added a comment.

@tschuett we already sort the bindings (in `sortBindings`) so the order should be pretty amenable to optimization



================
Comment at: lld/MachO/Driver.cpp:1144
   config->mapFile = args.getLastArgValue(OPT_map);
+  config->optimize = args::getInteger(args, OPT_O, 0);
   config->outputFile = args.getLastArgValue(OPT_o, "a.out");
----------------
LLD-ELF defaults this to 1; I think we should follow suit (and gate the bind opcode optimization to `> 1`)


================
Comment at: lld/MachO/SyntheticSections.cpp:373-375
+  if (i == opcodes.size()) {
+    opcodes[pWrite] = opcodes[i - 1];
+  }
----------------
nit: LLVM convention is to omit braces for one-liners


================
Comment at: lld/test/MachO/lit.local.cfg:19
 # shortest substitution of "%lld".
-lld = ('ld64.lld -arch x86_64 -platform_version macos 10.15 11.0 -syslibroot ' +
+lld = ('ld64.lld -arch x86_64 -O1 -platform_version macos 10.15 11.0 -syslibroot ' +
     os.path.join(config.test_source_root, "MachO", "Inputs", "MacOSX.sdk"))
----------------
The `-O` flag should be in the `bind-opcodes.s` test file, instead of being turned on for all tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105867



More information about the llvm-commits mailing list