)]}'
{
  "commit": "646a62e029de4827e384c8517dc62fd3c7f85207",
  "tree": "0d0378b483a8586f688a5c35ca72fe414d4e2368",
  "parents": [
    "4a164c8f55619e2bf79f9f62c86b8e4448c931d4"
  ],
  "author": {
    "name": "David \u0027Digit\u0027 Turner",
    "email": "digit@google.com",
    "time": "Fri Nov 20 12:45:00 2020 +0100"
  },
  "committer": {
    "name": "Commit Bot",
    "email": "commit-bot@chromium.org",
    "time": "Fri Nov 20 20:55:36 2020 +0000"
  },
  "message": "[rust] Fix command arguments for non-rust native dependencies.\n\nThe ninja Rust binary target writer did the following to generate\nthe command arguments set to \u0027rustc\u0027 for non-rust native library\ndependencies (e.g. any native object file or shared library):\n\n  1- Collect the ordered set of each dependency\u0027s directory,\n     then write it as a series of `-Lnative\u003d\u003cdir\u003e` arguments.\n\n  2- For any dependency whose name begins with \u0027lib\u0027, write it\n     as `-l\u003cname\u003e`, where \u003cname\u003e is the dependency\u0027s file name\n     without a \"lib\" prefix and without a file extension.\n\n  2- For non-\"lib\" dependencies, just use `-Clink-arg\u003d\u003cpath\u003e`\n     instead.\n\nHowever, while working on the Fuchsia build system, I found that rules 1\nand 2 are both problematic:\n\n  - Rule 1 means there is a possibility of linking the wrong library\n    in the final binary. E.g. consider a dependency list like:\n\n        dir1/libfoo.so\n        dir2/libbar.so\n\n    This gets translated into:\n\n        -Lnative\u003ddir1 -Lnative\u003ddir2 -lfoo -lbar\n\n    And if dir1/libbar.so happens to exist, it will be wrongly selected\n    by the linker.\n\n  - Rule 2 assumes the file extension is something like \".so\", \".dylib\"\n    or \".a\" , i.e. something the linker will look for automatically,\n    however, in the Fuchsia build, we have to link against files named\n    \"libc.so.debug\" and \"libzircon.so.debug\" (where the \".debug\" prefix\n    means these are the unstripped versions of the libraries). This\n    ends up translated into:\n\n      -Lnative\u003d\u003cdir2\u003e -Lnative\u003d\u003cdir1\u003e -lc.so -lzircon.so\n\n    And the linker will look for libc.so.so and libzircon.so.so instead\n    of the real files (and of course print an error message). Our\n    current work-around is to create link scripts with this name that\n    redirect to the real file, but this is ugly.\n\nThis CL simply fixes the issue by using `-Clink-arg\u003d\u003cpath\u003e` in all\ncases. The `-Lnative\u003d\u003cdir\u003e` arguments are still required to make\n`#[link(...)]` directives work correctly.\n\nBug: 217\nChange-Id: I5f7210300eea0effe3ed99b4f6aff5f07fb05518\nReviewed-on: https://gn-review.googlesource.com/c/gn/+/10721\nCommit-Queue: David Turner \u003cdigit@google.com\u003e\nReviewed-by: Petr Hosek \u003cphosek@google.com\u003e\nReviewed-by: Brett Wilson \u003cbrettw@chromium.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "59960a1d6553a5750e94730b36035a1d64736ebd",
      "old_mode": 33188,
      "old_path": "src/gn/ninja_rust_binary_target_writer.cc",
      "new_id": "38f4686485606502db137b7f51a56b286d8551ce",
      "new_mode": 33188,
      "new_path": "src/gn/ninja_rust_binary_target_writer.cc"
    },
    {
      "type": "modify",
      "old_id": "e58572b5898ff5ced47aac00630a44fc66106f3d",
      "old_mode": 33188,
      "old_path": "src/gn/ninja_rust_binary_target_writer_unittest.cc",
      "new_id": "6840b721b54f127d2f4e8e23db3ba56d65cbd355",
      "new_mode": 33188,
      "new_path": "src/gn/ninja_rust_binary_target_writer_unittest.cc"
    }
  ]
}
