)]}'
{
  "commit": "2c1900860c088a70f8a97e7de77f7546cb297a45",
  "tree": "2eaa968f31914f4a4011c1d701f2f545a5a12f02",
  "parents": [
    "f1cc0b607b03548028db3ca57bb057b2599b1711"
  ],
  "author": {
    "name": "Zhaoxin Yang",
    "email": "yangzhaoxin@loongson.cn",
    "time": "Wed Jul 02 16:09:51 2025 +0800"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Wed Jul 02 16:09:51 2025 +0800"
  },
  "message": "[lld][LoongArch] Support TLSDESC GD/LD to IE/LE (#123715)\n\nSupport TLSDESC to initial-exec or local-exec optimizations. Introduce a\nnew hook RE_LOONGARCH_RELAX_TLS_GD_TO_IE_PAGE_PC and use existing\nR_RELAX_TLS_GD_TO_IE_ABS to support TLSDESC \u003d\u003e IE, while use existing\nR_RELAX_TLS_GD_TO_LE to support TLSDESC \u003d\u003e LE.\n    \nIn normal or medium code model, there are two forms of code sequences:\n* pcalau12i  $a0, %desc_pc_hi20(sym_desc)\n* addi.d     $a0, $a0, %desc_pc_lo12(sym_desc)\n* ld.d       $ra, $a0, %desc_ld(sym_desc)\n* jirl       $ra, $ra, %desc_call(sym_desc)\n------\n* pcaddi     $a0, %desc_pcrel_20(sym_desc)\n* ld.d       $ra, $a0, %desc_ld(sym_desc)\n* jirl       $ra, $ra, %desc_call(sym_desc)\n    \nConvert to IE:\n* pcalau12i $a0, %ie_pc_hi20(sym_ie)\n* ld.[wd]   $a0, $a0, %ie_pc_lo12(sym_ie)\n\nConvert to LE:\n* lu12i.w $a0, %le_hi20(sym_le) # le_hi20 !\u003d 0, otherwise NOP\n* ori $a0 src, %le_lo12(sym_le) # le_hi20 !\u003d 0, src \u003d $a0, otherwise src \u003d $zero\n\nSimplicity, whether tlsdescToIe or tlsdescToLe, we always tend to\nconvert the preceding instructions to NOPs, due to both forms of code\nsequence (corresponding to relocation combinations:\nR_LARCH_TLS_DESC_PC_HI20+R_LARCH_TLS_DESC_PC_LO12 and\nR_LARCH_TLS_DESC_PCREL20_S2) have same process.\n    \nTODO: When relaxation enables, redundant NOPs can be removed. It will be\nimplemented in a future patch.\n    \nNote: All forms of TLSDESC code sequences should not appear interleaved\nin the normal, medium or extreme code model, which compilers do not\ngenerate and lld is unsupported. This is thanks to the guard in\nPostRASchedulerList.cpp in llvm.\n```\nCalls are not scheduling boundaries before register allocation,\nbut post-ra we don\u0027t gain anything by scheduling across calls\nsince we don\u0027t need to worry about register pressure.\n```",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "3c4ad53af1b51a63c681b2ebe998ac5fb1d89a9e",
      "old_mode": 33188,
      "old_path": "lld/ELF/Arch/LoongArch.cpp",
      "new_id": "fe804cbb0e6906de8be60f5a290e5732b8c4e3ee",
      "new_mode": 33188,
      "new_path": "lld/ELF/Arch/LoongArch.cpp"
    },
    {
      "type": "modify",
      "old_id": "f8786265029e80f8a54febf52f8d2f9f77debbe4",
      "old_mode": 33188,
      "old_path": "lld/ELF/InputSection.cpp",
      "new_id": "68e3feb1bd0486791001f8c5cebfc2c0470db0f5",
      "new_mode": 33188,
      "new_path": "lld/ELF/InputSection.cpp"
    },
    {
      "type": "modify",
      "old_id": "43f19186f09819b1adaeb8e2cc28cd1e7ae0866c",
      "old_mode": 33188,
      "old_path": "lld/ELF/Relocations.cpp",
      "new_id": "cebd564036b2c5f9b73b0a5807ff01aa52d686d4",
      "new_mode": 33188,
      "new_path": "lld/ELF/Relocations.cpp"
    },
    {
      "type": "modify",
      "old_id": "d2a77bc953109acb3a1708069be69eb4d2a0b224",
      "old_mode": 33188,
      "old_path": "lld/ELF/Relocations.h",
      "new_id": "02ddf707fd95000eb6904b3fbe4d6101389e864e",
      "new_mode": 33188,
      "new_path": "lld/ELF/Relocations.h"
    },
    {
      "type": "modify",
      "old_id": "9ce7c5881ca960ba8b9ccf5d1ab6c8e6c7d76639",
      "old_mode": 33188,
      "old_path": "lld/test/ELF/loongarch-relax-tlsdesc.s",
      "new_id": "5f4368343471c4d8c7d32cf9c54022e2f3f7227e",
      "new_mode": 33188,
      "new_path": "lld/test/ELF/loongarch-relax-tlsdesc.s"
    },
    {
      "type": "modify",
      "old_id": "99e21d9935197e016c2bcd69544a4d7278564acd",
      "old_mode": 33188,
      "old_path": "lld/test/ELF/loongarch-tlsdesc-pcrel20-s2.s",
      "new_id": "422592980d28fd58a3ab8051365f4037bd960234",
      "new_mode": 33188,
      "new_path": "lld/test/ELF/loongarch-tlsdesc-pcrel20-s2.s"
    },
    {
      "type": "modify",
      "old_id": "bf09b1e4bbae9208b2571195609880178b1515ed",
      "old_mode": 33188,
      "old_path": "lld/test/ELF/loongarch-tlsdesc.s",
      "new_id": "3dc31210d7ddb707599a7a82c2accbb73b07a50d",
      "new_mode": 33188,
      "new_path": "lld/test/ELF/loongarch-tlsdesc.s"
    }
  ]
}
