)]}'
{
  "commit": "95ade9a5f4becb3905a9261ead9b274347010636",
  "tree": "57d94d13d231bee647949f25d79ec66e248561cc",
  "parents": [
    "44c70fb01ff2ec9bced4676cdde0fa7e49328003"
  ],
  "author": {
    "name": "Nick Alcock",
    "email": "nick.alcock@oracle.com",
    "time": "Fri Apr 22 23:08:48 2022 +0100"
  },
  "committer": {
    "name": "Nick Alcock",
    "email": "nick.alcock@oracle.com",
    "time": "Thu Apr 28 11:47:12 2022 +0100"
  },
  "message": "libctf: impose an ordering on conflicting types\n\nWhen two types conflict and they are not types which can have forwards\n(say, two arrays of different sizes with the same name in two different\nTUs) the CTF deduplicator uses a popularity contest to decide what to\ndo: the type cited by the most other types ends up put into the shared\ndict, while the others are relegated to per-CU child dicts.\n\nThis works well as long as one type *is* most popular -- but what if\nthere is a tie?  If several types have the same popularity count,\nwe end up picking the first we run across and promoting it, and\nunfortunately since we are working over a dynhash in essentially\narbitrary order, this means we promote a random one.  So multiple\nruns of ld with the same inputs can produce different outputs!\nAll the outputs are valid, but this is still undesirable.\n\nAdjust things to use the same strategy used to sort types on the output:\nwhen there is a tie, always put the type that appears in a CU that\nappeared earlier on the link line (and if there is somehow still a tie,\nwhich should be impossible, pick the type with the lowest type ID).\n\nAdd a testcase -- and since this emerged when trying out extern arrays,\ncheck that those work as well (this requires a newer GCC, but since all\nGCCs that can emit CTF at all are unreleased this is probably OK as\nwell).\n\nFix up one testcase that has slight type ordering changes as a result\nof this change.\n\nlibctf/ChangeLog:\n\n\t* ctf-dedup.c (ctf_dedup_detect_name_ambiguity): Use\n\tcd_output_first_gid to break ties.\n\nld/ChangeLog:\n\n\t* testsuite/ld-ctf/array-conflicted-ordering.d: New test, using...\n\t* testsuite/ld-ctf/array-char-conflicting-1.c: ... this...\n\t* testsuite/ld-ctf/array-char-conflicting-2.c: ... and this.\n\t* testsuite/ld-ctf/array-extern.d: New test, using...\n\t* testsuite/ld-ctf/array-extern.c: ... this.\n\t* testsuite/ld-ctf/conflicting-typedefs.d: Adjust for ordering\n\tchanges.\n",
  "tree_diff": [
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "a6736a8a114d57e8d2bb1bf34b3f555a4d8e3703",
      "new_mode": 33188,
      "new_path": "ld/testsuite/ld-ctf/array-char-conflicting-1.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "1cc46f0a31b95e1ce11077b5a0f75490b4f343a4",
      "new_mode": 33188,
      "new_path": "ld/testsuite/ld-ctf/array-char-conflicting-2.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "a8bbc3dd65e5d9b94e815bb71c5e0c236977e0b4",
      "new_mode": 33188,
      "new_path": "ld/testsuite/ld-ctf/array-conflicted-ordering.d"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "730ba5a7d811c70d4ad856246a852f75be6e00a2",
      "new_mode": 33188,
      "new_path": "ld/testsuite/ld-ctf/array-extern.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "4c9ce784e6a60c95e612eee6b0e747ae9fb92807",
      "new_mode": 33188,
      "new_path": "ld/testsuite/ld-ctf/array-extern.d"
    },
    {
      "type": "modify",
      "old_id": "4ae8de413640dd63ffbc490488cabd1da19ecc8b",
      "old_mode": 33188,
      "old_path": "ld/testsuite/ld-ctf/conflicting-typedefs.d",
      "new_id": "beb1f7776c6916c71301fdff41f27954c8778f3c",
      "new_mode": 33188,
      "new_path": "ld/testsuite/ld-ctf/conflicting-typedefs.d"
    },
    {
      "type": "modify",
      "old_id": "b2fb0a1344151531f91eac0664cfcde81dd4bbf9",
      "old_mode": 33188,
      "old_path": "libctf/ctf-dedup.c",
      "new_id": "cddf4376eae2a76908acb9d8473c370f0b4cf131",
      "new_mode": 33188,
      "new_path": "libctf/ctf-dedup.c"
    }
  ]
}
