)]}'
{
  "commit": "31ed3a9d691493486f6e32357d89a55229dbdc0a",
  "tree": "2f359f29f3f1684fc18a507b545df2e5709f0da1",
  "parents": [
    "9a3781f12032153e27a38ec0894f8b663ed67306"
  ],
  "author": {
    "name": "Christophe Lyon",
    "email": "christophe.lyon@linaro.org",
    "time": "Wed Jun 19 12:35:30 2024 +0000"
  },
  "committer": {
    "name": "Christophe Lyon",
    "email": "christophe.lyon@linaro.org",
    "time": "Wed Sep 04 13:35:10 2024 +0000"
  },
  "message": "arm: Do not insert stubs needing Arm code on Thumb-only cores.\n\nWe recently fixed a bug in libgcc\n(https://gcc.gnu.org/bugzilla/show_bug.cgi?id\u003d115360)\nwhere a symbol was missing a %function .type decoration.\n\nThis meant the linker would silently pick the wrong type of \u0027farcall\nstub\u0027, involving Arm-mode instructions on Thumb-only CPUs.\n\nThis patch emits an error instead, and warns in some other cases, to\nencourage users to add the missing \u0027.type foo,%function\u0027 directive.\n\nIn practice: in arm_type_of_stub() we no longer try to infer which\nstub to use if the destination is of unknown type and the CPU is\nThumb-only; so we won\u0027t lie to elf32_arm_size_stubs() which does not\ncheck branch_type.\n\nIf branch_type is ST_BRANCH_TO_ARM but the CPU is Thumb-only, we now\nconvert it to ST_BRANCH_TO_THUMB only if the destination is of\nabsolute type.  This is to support the case where the destination of\nthe branch is defined by the linker script (see thumb-b-lks-sym.s and\nthumb-bl-lks-sym.s testcases for instance).\n\nThe motivating case is covered by the new farcall-missing-type\ntestcase, where we now emit an error message.  We do not emit an error\nwhen branch_type is ST_BRANCH_UNKNOWN and the CPU supports Arm-mode: a\nlot of legacy code (e.g. newlib\u0027s crt0.S) lacks the corresponding\n\u0027.type foo, %function\u0027 directives and even a (too verbose) warning\ncould be perceived as a nuisance.\n\nExisting testcases where such a warning would trigger:\narm-static-app.s (app_func, app_func2)\narm-rel32.s (foo)\narm-app.s (app_func)\nrel32-reject.s () main)\nfix-arm1176.s (func_to_branch_to)\nbut this list is not exhaustive.\n\nFor the sake of clarity, the patch replaces occurrences of\nsym.st_target_internal \u003d 0; with\nsym.st_target_internal \u003d ST_BRANCH_TO_ARM;\n\nenum arm_st_branch_type is defined in include/elf/arm.h, and relies on\nST_BRANCH_TO_ARM\u003d\u003d0, as sym.st_target_internal is also initialized to\n0 in other target-independent parts of BFD code.  (For instance,\nswapping the ST_BRANCH_TO_ARM and ST_BRANCH_TO_THUMB entries in the\nenum definition leads to \u0027interesting\u0027 results...)\n\nRegarding the testsuite:\n* new expected warning for thumb-b-lks-sym and thumb-bl-lks-sym\n* new testcase farcall-missing-type to check the new error case\n* attr-merge-arch-2b.s, branch-futures (and bfs-1.s) updated to avoid\n  a diagnostic\n\nTested on arm-eabi and arm-pe with no regression.\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "ca76bee6adcbdd8fccaeef973c501bf0cf9c0c65",
      "old_mode": 33188,
      "old_path": "bfd/elf32-arm.c",
      "new_id": "7441ee2cc38a9ac08d228a67bb077a07de63bfab",
      "new_mode": 33188,
      "new_path": "bfd/elf32-arm.c"
    },
    {
      "type": "modify",
      "old_id": "272d518c4d47c1c74278ac8dfb66b21a9406c6d4",
      "old_mode": 33188,
      "old_path": "ld/testsuite/ld-arm/arm-elf.exp",
      "new_id": "5f380e383d04b802b75bbfb9360c9c3f71411e9f",
      "new_mode": 33188,
      "new_path": "ld/testsuite/ld-arm/arm-elf.exp"
    },
    {
      "type": "modify",
      "old_id": "57718354145892154dc8ed4a042417a717f7414c",
      "old_mode": 33188,
      "old_path": "ld/testsuite/ld-arm/attr-merge-arch-2b.s",
      "new_id": "f20522f81d21d54236b937a058eb63c53ff523a6",
      "new_mode": 33188,
      "new_path": "ld/testsuite/ld-arm/attr-merge-arch-2b.s"
    },
    {
      "type": "modify",
      "old_id": "2b72819598edf1509d12cf8b01e5d2028bddda38",
      "old_mode": 33188,
      "old_path": "ld/testsuite/ld-arm/bfs-1.s",
      "new_id": "1e31d440cc21dde3345a886a4edb6d44fed38b00",
      "new_mode": 33188,
      "new_path": "ld/testsuite/ld-arm/bfs-1.s"
    },
    {
      "type": "modify",
      "old_id": "427ecce62a4d2f22b3b64fe03435802845c567cf",
      "old_mode": 33188,
      "old_path": "ld/testsuite/ld-arm/branch-futures.d",
      "new_id": "bc9ae8eddf752d5f33983d8665c26444af064016",
      "new_mode": 33188,
      "new_path": "ld/testsuite/ld-arm/branch-futures.d"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "e087992b33fed37a25161df6c0bb949497cf89bc",
      "new_mode": 33188,
      "new_path": "ld/testsuite/ld-arm/farcall-missing-type-bad.s"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "c97df0cf4595526e17ec4bf081f5df0115da3cc3",
      "new_mode": 33188,
      "new_path": "ld/testsuite/ld-arm/farcall-missing-type-main.s"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "9766bf1e10c463a47f57545a2b2bc6030ef1ee5a",
      "new_mode": 33188,
      "new_path": "ld/testsuite/ld-arm/farcall-missing-type.d"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "b1136de93bae68e5f4abc7c4680fe6dbd55b7dab",
      "new_mode": 33188,
      "new_path": "ld/testsuite/ld-arm/farcall-missing-type.ld"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "49612042910d4def1e9a2e968de98df41943ddf5",
      "new_mode": 33188,
      "new_path": "ld/testsuite/ld-arm/thumb-b-lks-sym.output"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "7c5e3543d84972ce28db25ca50f07995712453f6",
      "new_mode": 33188,
      "new_path": "ld/testsuite/ld-arm/thumb-bl-lks-sym.output"
    }
  ]
}
