)]}'
{
  "commit": "c46f0d71c492e58b2c5d0f151d085065982b8430",
  "tree": "7134c95f300db64925efef7f8740e69af81b8445",
  "parents": [
    "24e2f7df92641de0351a96096fb2c490b2436bb8"
  ],
  "author": {
    "name": "Eli Lipsitz",
    "email": "elipsitz@fb.com",
    "time": "Thu Jul 15 14:26:15 2021 -0700"
  },
  "committer": {
    "name": "Commit Bot",
    "email": "commit-bot@chromium.org",
    "time": "Fri Jul 16 21:58:15 2021 +0000"
  },
  "message": "Fix linking dynamic libraries in Rust binaries\n\nAn earlier commit, 646a62e, changed how Rust links against native\ndependencies. Rather than a `-l...` argument to instruct rustc to\nlink against the specified library, GN uses `-Clink-arg\u003d` to bypass\nrustc and directly instruct the linker to link the native library.\n\nThis has a few implications: normally, Rust uses the `-Bstatic`\nand `-Bdynamic` linker arguments to tell the linker whether or not\nto link dynamic binaries. These flags take effect for the rest\nof the arguments specified (or until another one of the flags changes\nthe mode). rustc has logic to ensure that these flags are emitted\ncorrectly, switching the mode as necessary when it outputs linker\narguments to link objects of each type.\n\nBypassing rustc via `-Clink-arg` prevents this logic from being used,\nand so it may be the case that, when rustc is building up the linker\narguments, it\u0027s already emitted a `-Bstatic` flag, causing the linker\narguments to be in the wrong mode when we emit the arguments to\nlink the native libraries. Specicially, we cannot pass a dynamic object\nwhen the linker is in static-only mode.\n\nThis commit addresses this issue by emitting a `-Bdynamic` linker\nargument before emitting the `-Clink-arg` arguments for the native\nlibraries, ensuring that the linker is always in a mode that allows\nlinking dynamic libraries.\n\nChange-Id: I79c1f285e661dc7e4638b1374b718fbbc4f31049\nReviewed-on: https://gn-review.googlesource.com/c/gn/+/12000\nReviewed-by: Tyler Mandry \u003ctmandry@google.com\u003e\nCommit-Queue: Tyler Mandry \u003ctmandry@google.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "73cc9e8699ce8bc29826d3344f6f4a50bb698f74",
      "old_mode": 33188,
      "old_path": "src/gn/ninja_rust_binary_target_writer.cc",
      "new_id": "afdf5d9f96b3153fef996f167b6901b5a861f71b",
      "new_mode": 33188,
      "new_path": "src/gn/ninja_rust_binary_target_writer.cc"
    },
    {
      "type": "modify",
      "old_id": "d130abb966a23fad482586c1c88ddf00f36d8219",
      "old_mode": 33188,
      "old_path": "src/gn/ninja_rust_binary_target_writer_unittest.cc",
      "new_id": "8d3f07ec9c06e856f30ca0870d79a67a693b6245",
      "new_mode": 33188,
      "new_path": "src/gn/ninja_rust_binary_target_writer_unittest.cc"
    }
  ]
}
