)]}'
{
  "commit": "3d16b64e28ab2cd7e69c0b31bc3ab1601891c969",
  "tree": "437086ea5f07f3be6400e95422735a446ce28801",
  "parents": [
    "83d59285d549dab64d1be496408c0e62f30030b4"
  ],
  "author": {
    "name": "Nick Alcock",
    "email": "nick.alcock@oracle.com",
    "time": "Fri Nov 20 13:34:04 2020 +0000"
  },
  "committer": {
    "name": "Nick Alcock",
    "email": "nick.alcock@oracle.com",
    "time": "Fri Nov 20 13:34:07 2020 +0000"
  },
  "message": "bfd, include, ld, binutils, libctf: CTF should use the dynstr/sym\n\nThis is embarrassing.\n\nThe whole point of CTF is that it remains intact even after a binary is\nstripped, providing a compact mapping from symbols to types for\neverything in the externally-visible interface of an ELF object: it has\nconnections to the symbol table for that purpose, and to the string\ntable to avoid duplicating symbol names.  So it\u0027s a shame that the hooks\nI implemented last year served to hook it up to the .symtab and .strtab,\nwhich obviously disappear on strip, leaving any accompanying the CTF\ndict containing references to strings (and, soon, symbols) which don\u0027t\nexist any more because their containing strtab has been vaporized.  The\noriginal Solaris design used .dynsym and .dynstr (well, actually,\n.ldynsym, which has more symbols) which do not disappear. So should we.\n\nThankfully the work we did before serves as guide rails, and adjusting\nthings to use the .dynstr and .dynsym was fast and easy.  The only\nannoyance is that the dynsym is assembled inside elflink.c in a fairly\npiecemeal fashion, so that the easiest way to get the symbols out was to\nhook in before every call to swap_symbol_out (we also leave in a hook in\nfront of symbol additions to the .symtab because it seems plausible that\nwe might want to hook them in future too: for now that hook is unused).\nWe adjust things so that rather than being offered a whole hash table of\nsymbols at once, libctf is now given symbols one at a time, with st_name\nindexes already resolved and pointing at their final .dynstr offsets:\nit\u0027s now up to libctf to resolve these to names as needed using the\nstrtab info we pass it separately.\n\nSome bits might be contentious.  The ctf_new_dynstr callback takes an\nelf_internal_sym, and this remains an elf_internal_sym right down\nthrough the generic emulation layers into ldelfgen.  This is no worse\nthan the elf_sym_strtab we used to pass down, but in the future when we\ngain non-ELF CTF symtab support we might want to lower the\nelf_internal_sym to some other representation (perhaps a\nctf_link_symbol) in bfd or in ldlang_ctf_new_dynsym.  We rename the\n\u0027apply_strsym\u0027 hooks to \u0027acquire_strings\u0027 instead, becuse they no longer\nhave anything to do with symbols.\n\nThere are some API changes to pieces of API which are technically public\nbut actually totally unused by anything and/or unused by anything but ld\nso they can change freely: the ctf_link_symbol gains new fields to allow\nsymbol names to be given as strtab offsets as well as strings, and a\nsymidx so that the symbol index can be passed in.  ctf_link_shuffle_syms\nloses its callback parameter: the idea now is that linkers call the new\nctf_link_add_linker_symbol for every symbol in .dynsym, feed in all the\nstrtab entries with ctf_link_add_strtab, and then a call to\nctf_link_shuffle_syms will apply both and arrange to use them to reorder\nthe CTF symtab at CTF serialization time (which is coming in the next\ncommit).\n\nInside libctf we have a new preamble flag CTF_F_DYNSTR which is always\nset in v3-format CTF dicts from this commit forwards: CTF dicts without\nthis flag are associated with .strtab like they used to be, so that old\ndicts\u0027 external strings don\u0027t turn to garbage when loaded by new libctf.\nDicts with this flag are associated with .dynstr and .dynsym instead.\n(The flag is not the next in sequence because this commit was written\nquite late: the missing flags will be filled in by the next commit.)\n\nTests forthcoming in a later commit in this series.\n\nbfd/ChangeLog\n2020-11-20  Nick Alcock  \u003cnick.alcock@oracle.com\u003e\n\n\t* elflink.c (elf_finalize_dynstr): Call examine_strtab after\n\tdynstr finalization.\n\t(elf_link_swap_symbols_out): Don\u0027t call it here.  Call\n\tctf_new_symbol before swap_symbol_out.\n\t(elf_link_output_extsym): Call ctf_new_dynsym before\n\tswap_symbol_out.\n\t(bfd_elf_final_link): Likewise.\n\t* elf.c (swap_out_syms): Pass in bfd_link_info.  Call\n\tctf_new_symbol before swap_symbol_out.\n\t(_bfd_elf_compute_section_file_positions): Adjust.\n\nbinutils/ChangeLog\n2020-11-20  Nick Alcock  \u003cnick.alcock@oracle.com\u003e\n\n\t* readelf.c (dump_section_as_ctf): Use .dynsym and .dynstr, not\n\t.symtab and .strtab.\n\ninclude/ChangeLog\n2020-11-20  Nick Alcock  \u003cnick.alcock@oracle.com\u003e\n\n\t* bfdlink.h (struct elf_sym_strtab): Replace with...\n\t(struct elf_internal_sym): ... this.\n\t(struct bfd_link_callbacks) \u003cexamine_strtab\u003e: Take only a\n\tsymstrtab argument.\n\t\u003cctf_new_symbol\u003e: New.\n\t\u003cctf_new_dynsym\u003e: Likewise.\n\t* ctf-api.h (struct ctf_link_sym) \u003cst_symidx\u003e: New.\n\t\u003cst_nameidx\u003e: Likewise.\n\t\u003cst_nameidx_set\u003e: Likewise.\n\t(ctf_link_iter_symbol_f): Removed.\n\t(ctf_link_shuffle_syms): Remove most parameters, just takes a\n\tctf_dict_t now.\n\t(ctf_link_add_linker_symbol): New, split from\n\tctf_link_shuffle_syms.\n\t* ctf.h (CTF_F_DYNSTR): New.\n\t(CTF_F_MAX): Adjust.\n\nld/ChangeLog\n2020-11-20  Nick Alcock  \u003cnick.alcock@oracle.com\u003e\n\n\t* ldelfgen.c (struct ctf_strsym_iter_cb_arg): Rename to...\n\t(struct ctf_strtab_iter_cb_arg): ... this, changing fields:\n\t\u003csyms\u003e: Remove.\n\t\u003csymcount\u003e: Remove.\n\t\u003csymstrtab\u003e: Rename to...\n\t\u003cstrtab\u003e: ... this.\n\t(ldelf_ctf_strtab_iter_cb): Adjust.\n\t(ldelf_ctf_symbols_iter_cb): Remove.\n\t(ldelf_new_dynsym_for_ctf): New, tell libctf about a single\n\tsymbol.\n\t(ldelf_examine_strtab_for_ctf): Rename to...\n\t(ldelf_acquire_strings_for_ctf): ... this, only doing the strtab\n\tportion and not symbols.\n\t* ldelfgen.h: Adjust declarations accordingly.\n\t* ldemul.c (ldemul_examine_strtab_for_ctf): Rename to...\n\t(ldemul_acquire_strings_for_ctf): ... this.\n\t(ldemul_new_dynsym_for_ctf): New.\n\t* ldemul.h: Adjust declarations accordingly.\n\t* ldlang.c (ldlang_ctf_apply_strsym): Rename to...\n\t(ldlang_ctf_acquire_strings): ... this.\n\t(ldlang_ctf_new_dynsym): New.\n\t(lang_write_ctf): Call ldemul_new_dynsym_for_ctf with NULL to do\n\tthe actual symbol shuffle.\n\t* ldlang.h (struct elf_strtab_hash): Adjust accordingly.\n\t* ldmain.c (bfd_link_callbacks): Wire up new/renamed callbacks.\n\nlibctf/ChangeLog\n2020-11-20  Nick Alcock  \u003cnick.alcock@oracle.com\u003e\n\n\t* ctf-link.c (ctf_link_shuffle_syms): Adjust.\n\t(ctf_link_add_linker_symbol): New, unimplemented stub.\n\t* libctf.ver: Add it.\n\t* ctf-create.c (ctf_serialize): Set CTF_F_DYNSTR on newly-serialized\n\tdicts.\n\t* ctf-open-bfd.c (ctf_bfdopen_ctfsect): Check for the flag: open the\n\tsymtab/strtab if not present, dynsym/dynstr otherwise.\n\t* ctf-archive.c (ctf_arc_bufpreamble): New, get the preamble from\n\tsome arbitrary member of a CTF archive.\n\t* ctf-impl.h (ctf_arc_bufpreamble): Declare it.\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "2aa89d01db8927becc77197026cbed4b1e598f58",
      "old_mode": 33188,
      "old_path": "bfd/ChangeLog",
      "new_id": "b2553a651663c65d6deeccb91cb69bec3fe710e8",
      "new_mode": 33188,
      "new_path": "bfd/ChangeLog"
    },
    {
      "type": "modify",
      "old_id": "288548d8e5909491e0544c97e8f783d2cd3312c7",
      "old_mode": 33188,
      "old_path": "bfd/elf.c",
      "new_id": "9624df7271ea9deba7b451b10ac0d3af0c83a643",
      "new_mode": 33188,
      "new_path": "bfd/elf.c"
    },
    {
      "type": "modify",
      "old_id": "6cc636142c77e2aaae01362205080e54a080b370",
      "old_mode": 33188,
      "old_path": "bfd/elflink.c",
      "new_id": "7ba667a824821cbd6af9c134c1beb57c2c0cdc18",
      "new_mode": 33188,
      "new_path": "bfd/elflink.c"
    },
    {
      "type": "modify",
      "old_id": "6555615fbfef6a24892a612ca510d46727d9d2a8",
      "old_mode": 33188,
      "old_path": "binutils/ChangeLog",
      "new_id": "f899b6d3f132e6104cfd0f814c2c0e760506403a",
      "new_mode": 33188,
      "new_path": "binutils/ChangeLog"
    },
    {
      "type": "modify",
      "old_id": "4d484dbe5f76a3bc4469744d7e6f8bbde7bd7f22",
      "old_mode": 33188,
      "old_path": "binutils/readelf.c",
      "new_id": "e4d96bb9b34aac0a48434082df8c247c3c03ba64",
      "new_mode": 33188,
      "new_path": "binutils/readelf.c"
    },
    {
      "type": "modify",
      "old_id": "11ec1f4c712400cbf101c2c7d297d4a7112e2f83",
      "old_mode": 33188,
      "old_path": "include/ChangeLog",
      "new_id": "5c0f6b9a8d628146f6ae5fcc2f0b72e76378d593",
      "new_mode": 33188,
      "new_path": "include/ChangeLog"
    },
    {
      "type": "modify",
      "old_id": "55020e31f454261df862a11a7481f31b1cc910aa",
      "old_mode": 33188,
      "old_path": "include/bfdlink.h",
      "new_id": "b92ef5408d54400a66ae6f14fb6703440d836e53",
      "new_mode": 33188,
      "new_path": "include/bfdlink.h"
    },
    {
      "type": "modify",
      "old_id": "38d7758a48e635d2193cece93e6ad8d14fe717b0",
      "old_mode": 33188,
      "old_path": "include/ctf-api.h",
      "new_id": "93bd5f359bfbd33b592b60dc61cff04afb557fbb",
      "new_mode": 33188,
      "new_path": "include/ctf-api.h"
    },
    {
      "type": "modify",
      "old_id": "6b8aa5315ca82eb66fde97e8900ea1997d59ae3c",
      "old_mode": 33188,
      "old_path": "include/ctf.h",
      "new_id": "d0a21f185e1d20371681af770d63d49219cb5d23",
      "new_mode": 33188,
      "new_path": "include/ctf.h"
    },
    {
      "type": "modify",
      "old_id": "a00cfe96a1538063a81a905866c6b111d67d7dd8",
      "old_mode": 33188,
      "old_path": "ld/ChangeLog",
      "new_id": "f8265f4fc30c6f2c54911b70da69e315eb141ec4",
      "new_mode": 33188,
      "new_path": "ld/ChangeLog"
    },
    {
      "type": "modify",
      "old_id": "c1fe705aa92bec09938d660ad766212e642c521a",
      "old_mode": 33188,
      "old_path": "ld/emultempl/aix.em",
      "new_id": "df7471bc4907949bf32b7c2af4471ad6d9e64273",
      "new_mode": 33188,
      "new_path": "ld/emultempl/aix.em"
    },
    {
      "type": "modify",
      "old_id": "ff22af4eb371fc15819190f9bc60ae992b6b7c91",
      "old_mode": 33188,
      "old_path": "ld/emultempl/armcoff.em",
      "new_id": "3a86af9ad27d5da21c37cd2959ee45ea6ec33fb2",
      "new_mode": 33188,
      "new_path": "ld/emultempl/armcoff.em"
    },
    {
      "type": "modify",
      "old_id": "ace6e3a123ca1a4a0ab0f8fe86bd9b58e2e60294",
      "old_mode": 33188,
      "old_path": "ld/emultempl/beos.em",
      "new_id": "d025f21f7772b181adb5befec07033b472a4af22",
      "new_mode": 33188,
      "new_path": "ld/emultempl/beos.em"
    },
    {
      "type": "modify",
      "old_id": "7e0923b20a6a65bdea3947a9b7fbd0136286d9d3",
      "old_mode": 33188,
      "old_path": "ld/emultempl/elf-generic.em",
      "new_id": "a4041486577496f48aa012646286aec4675e7f62",
      "new_mode": 33188,
      "new_path": "ld/emultempl/elf-generic.em"
    },
    {
      "type": "modify",
      "old_id": "59eed707ea7d6347d6df713b4ec4972e3f831168",
      "old_mode": 33188,
      "old_path": "ld/emultempl/elf.em",
      "new_id": "cfdf60e1365ee8e84a25b283c8d43dd7b303e2f0",
      "new_mode": 33188,
      "new_path": "ld/emultempl/elf.em"
    },
    {
      "type": "modify",
      "old_id": "24d3c1d9c68ed5895848eda1e622ee80d4e6a9d1",
      "old_mode": 33188,
      "old_path": "ld/emultempl/generic.em",
      "new_id": "5a69c011b6adce890b5e5c257be3d1f2e49fa984",
      "new_mode": 33188,
      "new_path": "ld/emultempl/generic.em"
    },
    {
      "type": "modify",
      "old_id": "14446109eaef0f60301566c68f760a2e82734967",
      "old_mode": 33188,
      "old_path": "ld/emultempl/linux.em",
      "new_id": "0cff374416093db23850353a6a208447d80b0e9f",
      "new_mode": 33188,
      "new_path": "ld/emultempl/linux.em"
    },
    {
      "type": "modify",
      "old_id": "7b78a53d7e13804466332a5dbfe4fbfbbd090ac1",
      "old_mode": 33188,
      "old_path": "ld/emultempl/msp430.em",
      "new_id": "31cba4a39786e9a4b585339483a8cff1b713fdd3",
      "new_mode": 33188,
      "new_path": "ld/emultempl/msp430.em"
    },
    {
      "type": "modify",
      "old_id": "00db3d0e8527a2432419a1ee0dd2f18ed9d57d0c",
      "old_mode": 33188,
      "old_path": "ld/emultempl/pe.em",
      "new_id": "e07dc9cb002e5853c383dbb83eddf89c469fb00c",
      "new_mode": 33188,
      "new_path": "ld/emultempl/pe.em"
    },
    {
      "type": "modify",
      "old_id": "2f4bdfb9fa23dbab912e270f66c438144b19ac19",
      "old_mode": 33188,
      "old_path": "ld/emultempl/pep.em",
      "new_id": "74468be0ccb5743af47ea9b26bd85aed38f67a91",
      "new_mode": 33188,
      "new_path": "ld/emultempl/pep.em"
    },
    {
      "type": "modify",
      "old_id": "11ddd0c9bada5b348aa1d16acc291b65625d0d60",
      "old_mode": 33188,
      "old_path": "ld/emultempl/ticoff.em",
      "new_id": "1cf82beb3c61ebfc2d1cc1adb501353d18475cc7",
      "new_mode": 33188,
      "new_path": "ld/emultempl/ticoff.em"
    },
    {
      "type": "modify",
      "old_id": "70d193c2c7941afe6d698895b33cb4fa31417308",
      "old_mode": 33188,
      "old_path": "ld/emultempl/vanilla.em",
      "new_id": "324e38acd861b5971a471757d8c868a22bd90940",
      "new_mode": 33188,
      "new_path": "ld/emultempl/vanilla.em"
    },
    {
      "type": "modify",
      "old_id": "e9496f918f5c316d0303a6b12355b0ab2b34b150",
      "old_mode": 33188,
      "old_path": "ld/ldelfgen.c",
      "new_id": "ca531ee7cfe54eaf1a25f11dcda04fe4d44517d3",
      "new_mode": 33188,
      "new_path": "ld/ldelfgen.c"
    },
    {
      "type": "modify",
      "old_id": "93bdf2981ba9c3d87e34f2e8358290901cccdc2f",
      "old_mode": 33188,
      "old_path": "ld/ldelfgen.h",
      "new_id": "3392c2b81a7b08b77dc4546bf702ad84d9c99b43",
      "new_mode": 33188,
      "new_path": "ld/ldelfgen.h"
    },
    {
      "type": "modify",
      "old_id": "6dc5112f7dd48907b00c4704af40bf427d587374",
      "old_mode": 33188,
      "old_path": "ld/ldemul.c",
      "new_id": "920afc8d6297521284f173f954ce8c0324bc7e72",
      "new_mode": 33188,
      "new_path": "ld/ldemul.c"
    },
    {
      "type": "modify",
      "old_id": "5efe4aa3a9f905755a1a94882a021e28eef63988",
      "old_mode": 33188,
      "old_path": "ld/ldemul.h",
      "new_id": "0b9653ed19375fe0578c3e732459c442d74e1b70",
      "new_mode": 33188,
      "new_path": "ld/ldemul.h"
    },
    {
      "type": "modify",
      "old_id": "eaf90a63cba0b1850b9e90d8214befb322b2481d",
      "old_mode": 33188,
      "old_path": "ld/ldlang.c",
      "new_id": "b70937a1f217b2132955916e3f19eb2e3d708047",
      "new_mode": 33188,
      "new_path": "ld/ldlang.c"
    },
    {
      "type": "modify",
      "old_id": "196debfa37e8ed15f2b1b67d57df05d8c9cf21f2",
      "old_mode": 33188,
      "old_path": "ld/ldlang.h",
      "new_id": "6675c57d74102b1f09ef996428ad996c18139f38",
      "new_mode": 33188,
      "new_path": "ld/ldlang.h"
    },
    {
      "type": "modify",
      "old_id": "cc3df76654ad6764f82c7385a5379bf00ae0c6fa",
      "old_mode": 33188,
      "old_path": "ld/ldmain.c",
      "new_id": "f8a03c6648fbce4f9f5798faa6a3665cb98e6a3c",
      "new_mode": 33188,
      "new_path": "ld/ldmain.c"
    },
    {
      "type": "modify",
      "old_id": "804f1314af25b2cd1bcce15d8f61d8abcf061753",
      "old_mode": 33188,
      "old_path": "libctf/ChangeLog",
      "new_id": "6670a6a8e1160de719e665deb53dca1f0601e02b",
      "new_mode": 33188,
      "new_path": "libctf/ChangeLog"
    },
    {
      "type": "modify",
      "old_id": "72cdef91ac4e53f89f017f531e29d182c4adf024",
      "old_mode": 33188,
      "old_path": "libctf/ctf-archive.c",
      "new_id": "25c30f64b50eba7963a1cc1a362c94e9bba24cd3",
      "new_mode": 33188,
      "new_path": "libctf/ctf-archive.c"
    },
    {
      "type": "modify",
      "old_id": "c1a7a8ac62d9ea3d6750b1c4a72304219946441d",
      "old_mode": 33188,
      "old_path": "libctf/ctf-create.c",
      "new_id": "384e8cfacc887e61a6145fe5d5d99871055ac245",
      "new_mode": 33188,
      "new_path": "libctf/ctf-create.c"
    },
    {
      "type": "modify",
      "old_id": "3f4cfac71528a2bd44b7ee759f6fec800b432811",
      "old_mode": 33188,
      "old_path": "libctf/ctf-impl.h",
      "new_id": "0e09a45b5bcbf562f5c791e37b5fee674fc5e135",
      "new_mode": 33188,
      "new_path": "libctf/ctf-impl.h"
    },
    {
      "type": "modify",
      "old_id": "192d4fd662213ea163e5fd144de9520534e8fc92",
      "old_mode": 33188,
      "old_path": "libctf/ctf-link.c",
      "new_id": "3f4f2ee72d97158871ef057bd9e24d323b753f20",
      "new_mode": 33188,
      "new_path": "libctf/ctf-link.c"
    },
    {
      "type": "modify",
      "old_id": "449347ee39a8836a471bfe88e00f8bf1082374b1",
      "old_mode": 33188,
      "old_path": "libctf/ctf-open-bfd.c",
      "new_id": "a6f0d3f6efe5e169ddcf6e31da845fd8efe20395",
      "new_mode": 33188,
      "new_path": "libctf/ctf-open-bfd.c"
    },
    {
      "type": "modify",
      "old_id": "cf4fa7396b52e102c3919a29fe9bb41dcd77630d",
      "old_mode": 33188,
      "old_path": "libctf/libctf.ver",
      "new_id": "317913e845080b381c92206f0d521fe894a0a752",
      "new_mode": 33188,
      "new_path": "libctf/libctf.ver"
    }
  ]
}
