From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 130284 invoked by alias); 20 Aug 2015 21:17:57 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 130265 invoked by uid 9674); 20 Aug 2015 21:17:56 -0000 Date: Thu, 20 Aug 2015 21:17:00 -0000 Message-ID: <20150820211756.130153.qmail@sourceware.org> From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] jankratochvil/gdbserverbuildid: Support build-id for main executables X-Git-Refname: refs/heads/jankratochvil/gdbserverbuildid X-Git-Reftype: branch X-Git-Oldrev: e5507f8594737d27a2f2fe16f2221e4ca649146d X-Git-Newrev: ab595d5e41323a5e17d4fa2d73fe534f3f83b08a X-SW-Source: 2015-q3/txt/msg00037.txt.bz2 List-Id: The branch, jankratochvil/gdbserverbuildid has been updated discards e5507f8594737d27a2f2fe16f2221e4ca649146d (commit) discards 5ff4e589f6fe2bc2a8650f787f9a19b1c5ab2dd2 (commit) discards 3751bb587bb5e1646a1fcba1ebffa27f6106dccd (commit) discards 5f63a388e55f85724b5d43612cfd50fe61c1d129 (commit) discards 5947a0c9cceb88d4a9ce62c67f3f61e363de7ddc (commit) discards 4e1494a43a52b384d696e02f2906d80e306a95f6 (commit) discards fbf2026ee8b96565184917aaa92bba3c9e1f14d5 (commit) discards 11dadb4d264555fd91ab0ae46a136dc61af990f5 (commit) discards a5f5b8ea74ee76db95178b3d2ce7623ba614007a (commit) discards 41492ad8abdaf4cc33c9f70550f45251a080eb23 (commit) discards 06333a2a928fc3336ab1bdcc881d6d7437d14086 (commit) discards f3deab52baf3eb5e375a7f336c9de79a9eb90a85 (commit) discards fc02788f47d59ce13086aa0877d62ee422d56c10 (commit) discards 28f27b3907e177dd11ee4c9bcc0c802a40ffb44d (commit) discards b13b54a2c120999e08bfca8e4d8ab2148a7745fe (commit) discards 3cb111fb4dedceda32b0daaf5c05d9b68751a048 (commit) discards 8b26582be65a0db52f849eebfdf60c7678e69779 (commit) discards 1042077e6bef94e03fe6371aa5ff02b6c7ecaa0a (commit) discards 26b420e6255539de37024a6af1927b886b1b510a (commit) discards 2179cd5a95f40a8bcafa2bfc55504c68631254d2 (commit) discards 21b5225718b928c4f47bfeb660f3d1af6dd281ed (commit) discards 1837127dfa8a55db25a410a5f6b705fc7c66499f (commit) discards 530b609f9e975ec38b2e234dfdbd6260f76ecaf6 (commit) discards fa098ccdf9a6eb22c98ec202d4b6ff605c0f785d (commit) discards 6e49cd7f3be2d9090b1afbea9ed8475d27a2afba (commit) discards 4df97c6d0d18295c788d8bf3f1dd62ccfdaa4810 (commit) discards 5f17ab81872a7e316cb83dcb814bd2444783978e (commit) discards e0b27412689ea95cc05d207f6091c70972077fc5 (commit) discards f6cd4980f1bb94b524dca174dcdd381ad2be32da (commit) discards ace8843332eb835e1010275d6ba2d4f2cddbdb5d (commit) discards ec0053bd4301d249eef54d95908e5849ab100724 (commit) discards d24163121891e5c67c2837c266831c5ca99328ee (commit) discards fa5a5a47b32c04b28dc134c9443c3d0d13b93f7b (commit) discards 6ebf8fd4c922433ab739998eb8696f3b705d3689 (commit) via ab595d5e41323a5e17d4fa2d73fe534f3f83b08a (commit) via 6fb3663ddc5d5a99199833d949942aad7b681380 (commit) via bf911121a5734434aad51b715cc19eb8170eb5ef (commit) via fcda11731bd2c9c40339e82bc80d5e35d6dcdeb8 (commit) via cbeb2450722667ef8d7f1266f3099c3406e150ea (commit) via ae205911e654b6b405807fc7c650ac0e2b2888f2 (commit) via 5a62beb82130814843c612d9359ec13f54308202 (commit) via b6717c38a322af00f62a943721db158dbc19f30d (commit) via 99f2fd6bfd044c983ded576e832d7887e48c2ebe (commit) via cb74b650510f3b6dd0ae6a03f6ba19ae2d7afc47 (commit) via 0f04cc7c1c666445744eea4a3eed119d9bec16b0 (commit) via de7fa43d28da0caea1fcd790d4b4e99b0ba3e2cc (commit) via 6015f7902e795eccac05b40bc55712c7f9603bab (commit) via 0d912487e5a386df01bc02645a44a9faef7de5d7 (commit) via e99ca88a03cd89a75e036bed16697f80f36a6c18 (commit) via 7cff29ba8a59f275ed0611fd71d6ffe00e1dd75f (commit) via 50c3d7c8425f78c29dcc6af0e46c0e0ad5456388 (commit) via 4824eb06420698e713da82269d23d809e153cd17 (commit) via 46eada5a83c042621b96bc61780f55289ef3d101 (commit) via cabfd87f9edbc4f6dcd3b13830788cae270adcff (commit) via 730480bb5f5546e854ee8b0bd1ac2675d1c78f6f (commit) via 20724d37ccb6523d45cc963f67ab6e39d346d7b8 (commit) via 0259aa4b5c8a64eaa5df90af54ed4721e052ad09 (commit) via 77fd6bd0e8adafc12638379be6c2f380e60f7c8f (commit) via 521bf6f14bd907949c0afe161a291392137f54f9 (commit) via 29a2e15387c7b901d3ff724eefc17da1d7c7972b (commit) via 98f9d97afa805f97e4d458b16487b3eda72d67f0 (commit) via 78902252d958c60f2e8bdc636a8580e685a42214 (commit) via 297e4cca9e1ddd859a9409063e6edeb75cc5c164 (commit) via dcf8f42dd92db632477b9d0f803c098951eb771a (commit) via c3ff2fcf809287543c310c40edb5a9fd872177c7 (commit) via 7d6a0cf97bf0080bac4686dbeb795f2bfbd7f4d2 (commit) via 0e433b32028e65f1f2f13e7c0d26061a37b7d583 (commit) via 221e1a37cd14f7c98b4ea1ab24bd721a8b144711 (commit) via 40e3ad0ebb0c71008b928d6d350e9258dc1dcf2a (commit) via af39b3270a1385027b2a5d145b9ba7564bd39f7a (commit) via 9215b98bb27c071386a277f5578dbb17569a1471 (commit) via 9d1f51209437ebee8f0a930b9613d59759ea8dc0 (commit) via 7d45c7c3f692d93c3a33a043c347f1386681deb4 (commit) via 07c9aa07cdcf00eff8e186f3ca1779e5e3ffdb75 (commit) via 4c5625238cccb048261d7ce0eb748ee5e0d67cf0 (commit) via 6ffe9a1ba36f3a896ae323e35a207b6451e8f7f9 (commit) via 49df5539f9070c01128135a7d63f44b2efc4de6a (commit) via 753999c1ec8fa76bd5ed5509d1e5909d010e80ee (commit) via 13289c10e20281adf480d9822861412a7ade721d (commit) via 45face3ba147a4c5f4f7e09cf10c95986b915002 (commit) via 64d94ba01a4f56ac10bb277e66bb00d82bd97f10 (commit) via 3cbc1e5e68341e53a03fe7e9d38fc02e0d78c418 (commit) via b45e00b3ed40589af75b8a36a67905ae265a20f8 (commit) via e49433d22dae92a56ae15a8b5742cbf1f31d5fd1 (commit) via 16d5f64295ccf2a8e9fe3ed350c94c38cee5a481 (commit) via 4d6cceb4e40a057dbe4d9ad94b0641d5f4725c09 (commit) from e5507f8594737d27a2f2fe16f2221e4ca649146d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit ab595d5e41323a5e17d4fa2d73fe534f3f83b08a Author: Jan Kratochvil Date: Thu Aug 20 22:32:38 2015 +0200 Support build-id for main executables Hi, make all the existing shlibs build-id functionality working also for the main executables. I think target_so_ops::open_symbol_file_object() is already replaced by what exec_file_and_symbols_resync(), target_pid_to_exec_file() etc. does but open_symbol_file_object() has been forgotten. This patch adds target_so_ops::main_build_id() which could be possibly marged with open_symbol_file_object() but I made it a separate function as I think it is easier to rather remove target_so_ops::open_symbol_file_object(). Jan gdb/ChangeLog 2015-08-20 Jan Kratochvil * build-id.c (build_id_verify): Add parameter advice. * build-id.h (build_id_verify): Likewise. * dwarf2read.c (dwarf2_get_dwz_file): Update build_id_verify caller. * exec.c: Include build-id.h. (exec_file_and_symbols_resync): Detect and use build-id by solib_main_build_id. * features/library-list-svr4.dtd: Add main-build-id. * solib-svr4.c (struct svr4_info, struct svr4_library_list): Add fields main_build_idsz and main_build_id. (hex2bin_allocate): Generalize messages to binary files. (svr4_library_list_start_list): Parse main-build-id. (svr4_library_list_attributes): Add main-build-id. (svr4_current_sos_direct): Set svr4_info main_build_id*. (svr4_main_build_id): New function. (svr4_clear_solib): Clear svr4_info main_build_id*. (_initialize_svr4_solib): Install svr4_main_build_id. * solib.c (solib_main_build_id): New function. * solist.h (struct target_so_ops): Add method main_build_id. (solib_main_build_id): New prototype. * source.c (file_location_from_filename): Update build_id_verify caller. gdb/gdbserver/ChangeLog 2015-08-20 Jan Kratochvil * linux-low.c (linux_qxfer_libraries_svr4): Print main-build-id. gdb/doc/ChangeLog 2015-08-20 Jan Kratochvil FIXME * gdb.texinfo (Files): (address the file was prelinked to during the library load.): (A simple memory map): (The format of an SVR4 library list is described by this DTD): gdb/testsuite/ChangeLog 2015-08-20 Jan Kratochvil * gdb.base/main-mismatch-mod.c: New file. * gdb.base/main-mismatch.c: New file. * gdb.base/main-mismatch.exp: New file. commit 6fb3663ddc5d5a99199833d949942aad7b681380 Author: Jan Kratochvil Date: Thu Aug 20 22:32:38 2015 +0200 Make only user-specified executable and symbol filenames sticky Message-ID: <559A7C37.6020501@redhat.com> On 07/03/2015 04:44 PM, Pedro Alves wrote: > (I still suspect that if we reverse the sense of the flag, then > its management ends up being more centralized, as then the > place that sets it is also the place that needs to check it, > instead of doing that in multiple places. But, see below.) It didn't seem fair to impose a subjective preference, so I tried this in order to understand it myself, and I now agree that is really doesn't make much difference, as then we'd have to mark auto-discovered in a few more places that I wasn't originally seeing. There's at least the execd handling in infrun.c, and also spu_symbol_file_add_from_memory. As I was playing with this already, I poked at the other review points I made, and came up with the variant of the patch below. > This function is called while the passed in PID is not the > current inferior. E.g., the remote_add_inferior path. > > Therefore seems to me that these symbol_file_add_main / exec_file_attach > calls can change the symbols of the wrong inferior. ... > I also notice that reread_symbols has an exec_file_attach > call which seems to me results in losing the is_user_supplied > flag if the executable's timestamp changed, at least here: > >> + /* Attempt to open the file that was executed to create this >> + inferior. If the user has explicitly specified executable >> + and/or symbol files then warn the user if their choices do >> + not match. Otherwise, set exec_file and symfile_objfile to >> + the new file. */ >> + exec_file_locate_attach (ptid_get_pid (inferior_ptid), from_tty); >> + >> + if (exec_file_is_user_supplied) >> { >> reopen_exec_file (); >> reread_symbols (); > > > I also notice that the clone-inferior command ends up with > an exec_file_attach call in clone_program_space. That one > should probably be setting the is_user_supplied flag too, > I'd think. Or at least, copying it from the original. > > At this point, I'm wondering about adding a parameter to > exec_file_attach to force considering (now and in future) > the right value to put in the flag in each case. I tried this too (see patch below). As this requires touching the user-supplied paths anyway, it didn't really matter to tag files user-supplied or auto-discovered, so I reverted back to user-supplied. For symbols, we already have the add_flags, so I added SYMFILE_USER_SUPPLIED instead of a new boolean. > >> @@ -2490,11 +2490,14 @@ attach_command_post_wait (char *args, int from_tty, int async_exec) >> inferior = current_inferior (); >> inferior->control.stop_soon = NO_STOP_QUIETLY; >> >> - /* If no exec file is yet known, try to determine it from the >> - process itself. */ >> - if (get_exec_file (0) == NULL) >> - exec_file_locate_attach (ptid_get_pid (inferior_ptid), from_tty); >> - else >> + /* Attempt to open the file that was executed to create this >> + inferior. If the user has explicitly specified executable >> + and/or symbol files then warn the user if their choices do >> + not match. Otherwise, set exec_file and symfile_objfile to >> + the new file. */ >> + exec_file_locate_attach (ptid_get_pid (inferior_ptid), from_tty); >> + >> + if (exec_file_is_user_supplied) >> { >> reopen_exec_file (); >> reread_symbols (); > > It seems to me that we should be able to move these reopen/reread > calls inside exec_file_locate_attach. I did this too. What do you think of the version below? I also tweaked the warnings a bit, to explicitly say "mismatch". This would still need docs/NEWS changes, and a test would be good too. ---------- - pass user-supplied / auto-discovered as arguments to exec_file_attach and symbol_file_add_main - Change exec_file_locate_attach parameter from pid to inferior pointer. - Flip current program space temporarily to make sure we add/reload symbols to/of the right inferior/program space. - Move reopen_exec_file and reread_symbols calls inside exec_file_locate_attach. - Warning message tweaks. - Rename exec_file_locate_attach -> exec_file_and_symbols_resync commit bf911121a5734434aad51b715cc19eb8170eb5ef Author: Jan Kratochvil Date: Thu Aug 20 22:32:38 2015 +0200 Code cleanup: New hex2bin_allocate() Hi, make hex->bin parsing standalone, to be reused in later patch. Jan gdb/ChangeLog 2015-08-20 Jan Kratochvil * solib-svr4.c (hex2bin_allocate): New function from ... (library_list_start_library): ... here, call it. commit fcda11731bd2c9c40339e82bc80d5e35d6dcdeb8 Author: Jan Kratochvil Date: Thu Aug 20 22:32:37 2015 +0200 testcase: Test also locating shlibs by build-id Hi, testcase from the previous patch tests verification of build-id in shared libraries found by their name. This test adds testing that a library can be found by its build-id (debug-file-directory/.build-id/XX/YYYYY...YYYYY). Jan gdb/testsuite/ChangeLog 2015-08-20 Jan Kratochvil * gdb.base/solib-mismatch.exp (nocrlf, expected_header): Make them global. (solib_locate_test): New function. commit cbeb2450722667ef8d7f1266f3099c3406e150ea Author: Jan Kratochvil Date: Thu Aug 20 22:32:37 2015 +0200 Tests for validate symbol file using build-id Hi, new testcase only. Jan gdb/testsuite/ChangeLog 2015-07-15 Aleksandar Ristovski Date: Thu Aug 20 22:32:37 2015 +0200 build_id_verify: Make it more verbose Hi, it was discussed on this list that if build-ids do not match they should be printed for troubleshooting. It is mostly independent from the other patches. Jan gdb/ChangeLog 2015-08-20 Jan Kratochvil * build-id.c: Include rsp-low.h. (build_id_verify): Print non-matching build-ids, update the messages. commit 5a62beb82130814843c612d9359ec13f54308202 Author: Jan Kratochvil Date: Thu Aug 20 22:32:37 2015 +0200 solib_bfd_open: Optimize opening twice Hi, this is one of the optimizations allowed by file_location that prevents opening file twice when target build-id is known and it needs to be verified. Jan gdb/ChangeLog 2015-08-20 Jan Kratochvil * solib.c (solib_bfd_fopen): Replace solib_find and solib_bfd_fopen by solib_find_file. commit b6717c38a322af00f62a943721db158dbc19f30d Author: Jan Kratochvil Date: Thu Aug 20 22:32:37 2015 +0200 Verify the build-id Hi, now it is possible to filter-out from openp() search files with non-matching build-id. Jan gdb/ChangeLog 2015-08-20 Jan Kratochvil * source.c: Include build-id.h. (file_location_from_filename): Call build_id_verify for the build-id parameters. commit 99f2fd6bfd044c983ded576e832d7887e48c2ebe Author: Jan Kratochvil Date: Thu Aug 20 22:32:37 2015 +0200 solib_find: Search also by build-id Hi, solib_find() can now try to search also by build-id. Jan gdb/ChangeLog 2015-08-20 Jan Kratochvil * solib.c: Include build-id.h. (solib_find_3): Call build_id_to_file. commit cb74b650510f3b6dd0ae6a03f6ba19ae2d7afc47 Author: Jan Kratochvil Date: Thu Aug 20 22:32:37 2015 +0200 build_id_to_bfd: Make it return file_location Hi, refactor build_id_to_bfd so that it returns file_location. Jan gdb/ChangeLog 2015-08-20 Jan Kratochvil * build-id.c: Include source.h. (build_id_to_bfd): Rename to ... (build_id_to_file): ... here, return file_location, add parameter opts, make it public. (build_id_to_debug_bfd): Use build_id_to_file. * build-id.h (build_id_to_file): New prototype. commit 0f04cc7c1c666445744eea4a3eed119d9bec16b0 Author: Jan Kratochvil Date: Thu Aug 20 22:32:36 2015 +0200 Add dummy build-id params to prototypes Hi, it is a lot of text with no functionality. Add build-id parameters where needed, pass them where they are already available, otherwise pass 0 in the top callers. Jan gdb/ChangeLog 2015-08-20 Jan Kratochvil * cli/cli-cmds.c (find_and_open_script): Pass zero build-id. * defs.h (openp, openp_file, source_full_path_of): Add build-id parameters. * dwarf2read.c (try_open_dwop_file): Pass zero build-id. * exec.c (exec_file_locate_attach): Likewise. * infrun.c (follow_exec): Likewise. * nto-tdep.c (nto_find_and_open_solib): Add build-id parameters, pass them. * nto-tdep.h (nto_find_and_open_solib): Add build-id parameters. * solib-aix.c (solib_aix_bfd_open): Add build-id parameters, pass them. * solib-darwin.c (darwin_bfd_open): Likewise. * solib-dsbt.c (enable_break): Pass zero build-id. * solib-frv.c (enable_break2): Likewise. * solib-spu.c (spu_bfd_open): Add build-id parameters, pass them. * solib-svr4.c (enable_break): Pass zero build-id. * solib.c (solib_find_3, solib_find_2, solib_find_1, exec_file_find) (solib_find_file, solib_find, solib_bfd_open): Add build-id parameters, pass them. (solib_map_sections): Pass so->build-id* to bfd_open. (reload_shared_libraries_1): Pass so->build-id* to solib_bfd_open. * solist.h (struct target_so_ops): Add build-id parameters to bfd_open and find_and_open_solib. (exec_file_find, solib_find, solib_bfd_open): Add build-id parameters. * source.c (file_location_from_filename): Add build-id parameters. (filename_to_bfd): Pass zero build-id. (openp): Add build-id parameters, pass them. (openp_bfd): Pass zero build-id. (openp_file, source_full_path_of): Add build-id parameters, pass them. (find_and_open_source): Pass zero build-id. * source.h (file_location_from_filename): Add build-id parameters. commit de7fa43d28da0caea1fcd790d4b4e99b0ba3e2cc Author: Jan Kratochvil Date: Thu Aug 20 22:32:36 2015 +0200 build_id_to_debug_bfd: Make it also non-.debug capable Hi, generalize the function by adding 'suffix' parameter. To be reused later. Jan gdb/ChangeLog 2015-08-20 Jan Kratochvil * build-id.c (build_id_to_debug_bfd): Rename to ... (build_id_to_bfd): ... here, add parameter suffix. (build_id_to_debug_bfd): New function. commit 6015f7902e795eccac05b40bc55712c7f9603bab Author: Jan Kratochvil Date: Thu Aug 20 22:32:36 2015 +0200 symfile_bfd_open: Make it use openp_bfd() Hi, another function gets converted to the new API. Jan gdb/ChangeLog 2015-08-20 Jan Kratochvil * symfile.c (symfile_bfd_open): Use openp_bfd instead of openp and gdb_bfd_open. commit 0d912487e5a386df01bc02645a44a9faef7de5d7 Author: Jan Kratochvil Date: Thu Aug 20 22:32:36 2015 +0200 solib_find: Make it use file_location Hi, refactor the solib*() code to use file_location functions. Jan gdb/ChangeLog 2015-08-20 Jan Kratochvil * nto-tdep.c: Include source.h. (nto_find_and_open_solib): Return file_location, remove parameter temp_pathname. Change openp to openp_file. * nto-tdep.h (nto_find_and_open_solib): Update prototype. * solib.c (solib_find_2): Rename to ... (solib_find_3): ... here, return file_location, change parameter fd to opts. Change gdb_open_cloexec to file_location_from_filename and openp to openp_file calls. (solib_find_1): Rename to ... (solib_find_2): ... here, return file_location, change parameter fd to opts. (solib_find_1): New function. (solib_find): Rename to ... (solib_find_file) ... here, return file_location, change parameter fd to opts. (solib_find): New function. * solist.h (find_and_open_solib): Return file_location, remove parameter temp_pathname. commit e99ca88a03cd89a75e036bed16697f80f36a6c18 Author: Jan Kratochvil Date: Thu Aug 20 22:32:36 2015 +0200 Refactor openp() to return file_location Hi, openp() remains as a backward compatibility wrapper around renamed openp->openp_file(). Jan gdb/ChangeLog 2015-08-19 Jan Kratochvil * defs.h (enum openp_flags): Remove OPF_OPEN_RW_TMP, add OPF_BFD_CANONICAL. (openp_bfd, openp_file): Add prototypes. * exec.c (exec_file_attach): Replace openp by openp_bfd calls. * source.c (file_location_from_filename): Support OPF_BFD_CANONICAL. (openp, openp_bfd): New functions. (openp): Rename to ... (openp_file): ... here, return file_location, remove filename_opened parameter. commit 7cff29ba8a59f275ed0611fd71d6ffe00e1dd75f Author: Jan Kratochvil Date: Thu Aug 20 22:32:36 2015 +0200 Add file_location utility functions Hi, build id verification faces a problem current codebase calls openp() and similar functions which search many directories and after they find the file they return its filename. Caller then typically opens that file as BFD. But to search the directories openp() needs to open each file it iterates to verify their build-id. Then it would close the file and caller would reopen it again. This is inefficient (+racy), so a new intermediate representation of the found files is created (file_location). Another possibility would be to depends on bfd cache as being done in exec_file_attach. But then a similar problem is needed for callers which want only fd (and not bfd). Besides that I find depending on pending make_cleanup_bfd_unref() from openp() calls would be tricky. Jan gdb/ChangeLog 2015-08-18 Jan Kratochvil * defs.h (enum openp_flags): Add OPF_IS_BFD. * gdb_bfd.c (fileio_errno_to_host): Make it public. * gdb_bfd.h (fileio_errno_to_host): Add prototype. * source.c: Include inferior.h and gdb/fileio.h. (file_location_enoent, file_location_free, file_location_cleanup) (file_location_is_valid, file_location_from_filename) (file_location_to_bfd, filename_to_bfd): New functions. * source.h (struct file_location): New definition. (file_location_enoent, file_location_free, file_location_is_valid) (file_location file_location_from_filename, file_location_to_bfd) (filename_to_bfd): New prototypes. commit 50c3d7c8425f78c29dcc6af0e46c0e0ad5456388 Author: Jan Kratochvil Date: Thu Aug 20 22:32:36 2015 +0200 gdb_bfd_open_from_target: Optionally do not close fd Hi, gdb_bfd_open_from_target currently always embedded passed fd into returned BFD and closed that fd after closing that BFD. As one cannot do dup() for target fileio FDs one could not use FD after BFD using it has been closed. Jan gdb/ChangeLog 2015-08-18 Jan Kratochvil * gdb_bfd.c (gdb_bfd_iovec_fileio_close_nop): New function. (gdb_bfd_open_from_target): Add parameter do_close. Optionally pass gdb_bfd_iovec_fileio_close_nop. (gdb_bfd_open): Update caller. * gdb_bfd.h (gdb_bfd_open_from_target): Update prototype. commit 4824eb06420698e713da82269d23d809e153cd17 Author: Jan Kratochvil Date: Thu Aug 20 22:32:35 2015 +0200 gdb_bfd_open_from_target: Support real fd Hi, gdb_bfd_open_from_target is extended so that it can be now passed also some non-(-1) fd. non-(-1) fd was not supported for remote files in mainline. Jan gdb/ChangeLog 2015-08-18 Jan Kratochvil * gdb_bfd.c (gdb_bfd_iovec_fileio_open_fd): New function. (gdb_bfd_open_from_target): Conditionally use it. commit 46eada5a83c042621b96bc61780f55289ef3d101 Author: Jan Kratochvil Date: Thu Aug 20 22:32:35 2015 +0200 Provide new gdb_bfd_open_from_target Hi, later code needs to call the gdb_bfd_openr_iovec part of gdb_bfd_open with more special parameters. So it is refactored out first (and extended later in the next patches). Jan gdb/ChangeLog 2015-08-18 Jan Kratochvil * gdb_bfd.c (gdb_bfd_open_from_target): New function from ... (gdb_bfd_open): ... here. Call it. * gdb_bfd.h (gdb_bfd_open_from_target): New prototype. commit cabfd87f9edbc4f6dcd3b13830788cae270adcff Author: Jan Kratochvil Date: Thu Aug 20 22:32:35 2015 +0200 Code cleanup: openp parameter filename_opened is never NULL Hi, this parameter is never passed as NULL in the codebase so the check can be removed. Jan gdb/ChangeLog 2015-08-18 Jan Kratochvil * source.c (openp): Update function comment for filename_opened. Remove NULL check for filename_opened. commit 730480bb5f5546e854ee8b0bd1ac2675d1c78f6f Author: Jan Kratochvil Date: Thu Aug 20 22:32:35 2015 +0200 Code cleanup: Remove openp parameter mode Hi, simplify the code, make it also suitable for more code refactorings. The new flag OPF_OPEN_RW_TMP is removed later in this patch series. Jan gdb/ChangeLog 2015-08-18 Jan Kratochvil * cli/cli-cmds.c (find_and_open_script): Update openp caller. * defs.h (enum openp_flags): Add OPF_OPEN_RW_TMP. (openp): Remove parameter mode. * dwarf2read.c (try_open_dwop_file): Update openp caller. * exec.c (exec_file_attach): Likewise. * nto-tdep.c (nto_find_and_open_solib): Remove parameter o_flags, update openp caller. * nto-tdep.h (nto_find_and_open_solib): Remove parameter o_flags. * solib.c (solib_find_2): Update openp and find_and_open_solib caller. * solist.h (struct target_so_ops): Remove parameter o_flags from find_and_open_solib method. * source.c (openp): Change parameter mode to a new variable. (source_full_path_of, find_and_open_source): Update openp caller. * symfile.c (symfile_bfd_open): Likewise. commit 20724d37ccb6523d45cc963f67ab6e39d346d7b8 Author: Jan Kratochvil Date: Thu Aug 20 22:32:35 2015 +0200 Code cleanup: Remove OPF_RETURN_REALPATH Hi, OPF_RETURN_REALPATH is used only at the end of openp() to convert the returned values. That is not useful, code can be simplified if callers that passed OPF_RETURN_REALPATH adjust the returned values on their own. Or at least it helps further refactorizations. Jan gdb/ChangeLog 2015-08-18 Jan Kratochvil * cli/cli-cmds.c (find_and_open_script): Remove OPF_RETURN_REALPATH. Call gdb_realpath_and_xfree. * defs.h (enum openp_flags): Add OPF_NONE, remove OPF_RETURN_REALPATH. * dwarf2read.c (try_open_dwop_file): Remove OPF_RETURN_REALPATH. Call gdb_realpath_and_xfree. * nto-tdep.c (nto_find_and_open_solib): Remove OPF_RETURN_REALPATH. Call gdb_realpath_and_xfree and xstrdup. * solib.c (solib_find_2): New variable temp_pathname_is_realpath. Remove OPF_RETURN_REALPATH. Conditionally call gdb_realpath_and_xfree. * source.c (openp): Remove OPF_RETURN_REALPATH processing. (source_full_path_of, find_and_open_source): Remove OPF_RETURN_REALPATH. Call gdb_realpath_and_xfree. * symfile.c (symfile_bfd_open): Likewise. * utils.c (gdb_realpath_and_xfree): New function. * utils.h (gdb_realpath_and_xfree): New prototype. commit 0259aa4b5c8a64eaa5df90af54ed4721e052ad09 Author: Jan Kratochvil Date: Thu Aug 20 22:32:35 2015 +0200 Code cleanup: Add enum for openp_flags Hi, it is for many reasons better, in C++ it could be even type safe. Jan gdb/ChangeLog 2015-08-18 Jan Kratochvil * cli/cli-cmds.c (find_and_open_script): Use enum openp_flags for search_flags. * defs.h (OPF_TRY_CWD_FIRST, OPF_SEARCH_IN_PATH, OPF_RETURN_REALPATH): Wrap them to a new ... (enum openp_flags): ... enum. (openp): Update prototype. * dwarf2read.c (try_open_dwop_file): Use enum openp_flags for flags. * source.c (openp): Update opts parameter type. Move out OPF_* comments. commit 77fd6bd0e8adafc12638379be6c2f380e60f7c8f Author: Jan Kratochvil Date: Thu Aug 20 22:32:34 2015 +0200 Change sysroot to ":target:" Hi, that is try "" first and "target:" second. Various performance problems should be fixed by trying to look up the remote file first on local filesystem. Thanks to build-ids it is quick and safe to verify both files are the same build. Jan gdb/ChangeLog 2015-08-18 Jan Kratochvil * NEWS (Changes since GDB 7.10): Mention sysroot. * main.c (captured_main): Initialize new gdb_sysroot. gdb/testsuite/ChangeLog * gdb.base/attach.exp (do_attach_tests): Update sysroot parsing. * gdb.base/break-probes.exp: Likewise. commit 521bf6f14bd907949c0afe161a291392137f54f9 Author: Jan Kratochvil Date: Thu Aug 20 22:32:34 2015 +0200 Permit multiple sysroot directories Hi, the goal is to have both "" and "target:" as the default gdb_sysroot, in this order. Therefore permit multiple directory components of gdb_sysroot. Jan gdb/ChangeLog 2015-08-18 Jan Kratochvil * NEWS (Changes since GDB 7.10): Mention set sysroot and show sysroot. * solib.c: Include source.h. (solib_find_1): Rename to ... (solib_find_2): ... here and change the sysroot variable to parameter. (solib_find_1): Call it using dirnames_to_char_ptr_vec_target_exc. * source.c (dirnames_to_char_ptr_vec_target_exc): New function. * source.h (dirnames_to_char_ptr_vec_target_exc): New declaration. gdb/doc/ChangeLog 2015-08-18 Jan Kratochvil * gdb.texinfo (Files): Permit set sysroot and show sysroot to have multiple components. commit 29a2e15387c7b901d3ff724eefc17da1d7c7972b Author: Jan Kratochvil Date: Thu Aug 20 22:32:34 2015 +0200 Code cleanup: Make solib_find_1 variable const Hi, it gets used in the next patch. Jan 2015-08-18 Jan Kratochvil * solib.c (solib_find_1): Make sysroot variable const. commit 98f9d97afa805f97e4d458b16487b3eda72d67f0 Author: Jan Kratochvil Date: Thu Aug 20 22:32:34 2015 +0200 Validate symbol file using build-id Consumer part of the "build-id" attribute. gdb/ChangeLog 2015-07-15 Aleksandar Ristovski Validate symbol file using build-id. * NEWS (Changes since GDB 7.10): Add 'set validate-build-id' and 'show validate-build-id'. Add build-id attribute. * build-id.c: Include gdbcmd.h. (validate_build_id, show_validate_build_id, _initialize_build_id): New. * build-id.h (validate_build_id): New declaration. * solib-svr4.c: Include rsp-low.h. (svr4_copy_library_list): Duplicate field build_id. (library_list_start_library): Parse 'build-id' attribute. (svr4_library_attributes): Add 'build-id' attribute. * solib.c (free_so): Free build_id. * solist.h (struct so_list): New fields 'build_idsz' and 'build_id'. gdb/doc/ChangeLog 2015-07-15 Jan Kratochvil * gdb.texinfo (Files): Add 'set validate-build-id' and 'show validate-build-id'. commit 78902252d958c60f2e8bdc636a8580e685a42214 Author: Jan Kratochvil Date: Thu Aug 20 22:32:34 2015 +0200 gdbserver build-id attribute generator Producer part of the new "build-id" XML attribute. gdb/ChangeLog 2015-07-15 Aleksandar Ristovski gdbserver build-id attribute generator. * features/library-list-svr4.dtd (library-list-svr4): New 'build-id' attribute. gdb/doc/ChangeLog 2015-07-15 Aleksandar Ristovski gdbserver build-id attribute generator. * gdb.texinfo (Library List Format for SVR4 Targets): Add 'build-id' in description, example, new attribute in dtd. gdb/gdbserver/ChangeLog 2015-07-15 Aleksandar Ristovski gdbserver build-id attribute generator. * linux-low.c (linux-maps.h, search.h, rsp-low.h): Include. (ElfXX_Ehdr, ElfXX_Phdr, ElfXX_Nhdr): New. (ELFXX_FLD, ELFXX_SIZEOF, ELFXX_ROUNDUP, BUILD_ID_INVALID): New. (find_phdr): New. (get_dynamic): Use find_pdhr to traverse program headers. (struct mapping_entry, mapping_entry_s, free_mapping_entry_vec) (compare_mapping_entry_range, struct find_memory_region_callback_data) (read_build_id, find_memory_region_callback, lrfind_mapping_entry) (get_hex_build_id): New. (linux_qxfer_libraries_svr4): Add optional build-id attribute to reply XML document. commit 297e4cca9e1ddd859a9409063e6edeb75cc5c164 Author: Jan Kratochvil Date: Thu Aug 20 22:32:33 2015 +0200 Move linux_find_memory_regions_full & co. This should be just a move with no changes. gdb/ChangeLog 2015-07-15 Aleksandar Ristovski Move linux_find_memory_regions_full & co. * linux-tdep.c (linux-maps.h): Include. (gdb_regex.h): Remove the include. (enum filterflags, struct smaps_vmflags, read_mapping, decode_vmflags) (mapping_is_anonymous_p, dump_mapping_p): Moved to common/linux-maps.c. (linux_find_memory_region_ftype): Moved typedef to common/linux-maps.h. (linux_find_memory_regions_full): Moved definition to common/linux-maps.c. * common/linux-maps.c: Include ctype.h, target/target-utils.h, gdb_regex.h and target/target.h. (struct smaps_vmflags, read_mapping, decode_vmflags) (mapping_is_anonymous_p, dump_mapping_p): Move from linux-tdep.c. (linux_find_memory_regions_full): Move from linux-tdep.c. * common/linux-maps.h (read_mapping): New declaration. (linux_find_memory_region_ftype, enum filterflags): Moved from linux-tdep.c. (linux_find_memory_regions_full): New declaration. * target.c (target/target-utils.h): Include. (read_alloc_pread_ftype): Moved typedef to target/target-utils.h. (read_alloc, read_stralloc_func_ftype, read_stralloc): Moved definitions to target/target-utils.c. * target.h (target_fileio_read_stralloc): Move it to target/target.h. * target/target-utils.c (read_alloc, read_stralloc): Move definitions from target.c. * target/target-utils.h (read_alloc_pread_ftype): New typedef. (read_alloc): New declaration. (read_stralloc_func_ftype): New typedef. (read_stralloc): New declaration. * target/target.h (target_fileio_read_stralloc): Move it from target.h. gdb/gdbserver/ChangeLog 2015-07-15 Aleksandar Ristovski * target.c: Include target/target-utils.h and fcntl.h. (target_fileio_read_stralloc_1_pread, target_fileio_read_stralloc_1) (target_fileio_read_stralloc): New functions. commit dcf8f42dd92db632477b9d0f803c098951eb771a Author: Jan Kratochvil Date: Thu Aug 20 22:32:33 2015 +0200 Prepare linux_find_memory_regions_full & co. for move Prepare code for move into gdb/common/. gdb/ChangeLog 2015-07-15 Aleksandar Ristovski Prepare linux_find_memory_regions_full & co. for move. * linux-tdep.c (linux_find_memory_region_ftype): Comment. (linux_find_memory_regions_full): Change signature and prepare for moving to linux-maps. (linux_find_memory_regions_data): Rename field 'obfd' to 'data'. (linux_find_memory_regions_thunk): New. (linux_find_memory_regions_thunk): Use 'data' field instead of 'obfd'. (linux_find_memory_regions_gdb): New. (linux_find_memory_regions): Rename argument 'obfd' to 'func_data'. (linux_make_mappings_corefile_notes): Use linux_find_memory_regions_gdb. * target.c (read_alloc_pread_ftype): New typedef. (target_fileio_read_alloc_1_pread): New function. (read_alloc): Refactor from target_fileio_read_alloc_1. (read_stralloc_func_ftype): New typedef. (target_fileio_read_alloc_1): New implementation. Use read_alloc. (read_stralloc): Refactored from target_fileio_read_stralloc. (target_fileio_read_stralloc): New implementation, use read_stralloc. commit c3ff2fcf809287543c310c40edb5a9fd872177c7 Author: Jan Kratochvil Date: Thu Aug 20 22:32:33 2015 +0200 Move gdb_regex* to common/ Later patches need regex support also in gdbserver. gdb/ChangeLog 2015-07-15 Jan Kratochvil * Makefile.in (HFILES_NO_SRCDIR): Change gdb_regex.h to common/gdb_regex.h. (COMMON_OBS): Add gdb_regex.o. (gdb_regex.o): New. * common/common.m4 (GDB_AC_COMMON): Add gdb_use_included_regex, --without-included-regex and USE_INCLUDED_REGEX. * common/gdb_regex.c: New file from utils.c functions. * common/gdb_regex.h: Move it here from gdb_regex.h, update include file wrapping define name. * configure: Rebuilt. * configure.ac (gdb_use_included_regex, --without-included-regex) (USE_INCLUDED_REGEX): Move them to common/common.m4. * gdb_regex.h: Move it to common/gdb_regex.h. * utils.c: Remove include gdb_regex.h. (do_regfree_cleanup, make_regfree_cleanup, get_regcomp_error) (compile_rx_or_error): Move them to common/gdb_regex.c. gdb/gdbserver/ChangeLog 2015-07-15 Jan Kratochvil * Makefile.in (OBS): Add gdb_regex.o. (gdb_regex.o): New. * config.in: Rebuilt. * configure: Rebuilt. commit 7d6a0cf97bf0080bac4686dbeb795f2bfbd7f4d2 Author: Jan Kratochvil Date: Thu Aug 20 22:32:33 2015 +0200 Create empty common/linux-maps.[ch] and common/target-utils.[ch] Prepare new files for later move. gdb/ChangeLog 2015-07-15 Aleksandar Ristovski Create empty common/linux-maps.[ch] and common/target-utils.[ch]. * Makefile.in (ALL_TARGET_OBS): Add linux-maps.o. (HFILES_NO_SRCDIR); Add common/linux-maps.h, common/target-utils.h. (COMMON_OBS): Add target-utils.o. (linux-maps.o, target-utils.o): New. * target/target-utils.c: New file. * target/target-utils.h: New file. * common/linux-maps.c: New file. * common/linux-maps.h: New file. * configure.tgt (aarch64*-*-linux*, alpha*-*-linux*) (am33_2.0*-*-linux*, arm*-*-linux*, bfin-*-*linux*, cris*, frv-*-*) (hppa*-*-linux*, i[34567]86-*-linux*, ia64-*-linux*, m32r*-*-linux*) (m68*-*-linux*, microblaze*-linux-*, microblaze*-*-linux*) (mips*-*-linux*, nios2*-*-linux*, powerpc*-*-linux*, s390*-*-linux*) (sh*-*-linux*, sparc-*-linux*, sparc64-*-linux*, tic6x-*-*linux) (tilegx-*-linux*, x86_64-*-linux*, xtensa*-*-linux*): Add linux-maps.o to gdb_target_obs. gdb/gdbserver/ChangeLog 2015-07-15 Aleksandar Ristovski Create empty common/linux-maps.[ch] and common/target-utils.[ch]. * Makefile.in (OBS): Add target-utils.o. (linux-maps.o, target-utils.o): New. * configure.srv (srv_linux_obj): Add linux-maps.o. commit 0e433b32028e65f1f2f13e7c0d26061a37b7d583 Author: Pedro Alves Date: Thu Aug 20 20:08:48 2015 +0100 Fix gdb.server/solib-list.exp native-extended-gdbserver regression Commit 221e1a37 (remote non-stop: Process initially stopped threads before other commands) caused a test regression when testing with the native-extended-gdbserver board: FAIL: gdb.server/solib-list.exp: non-stop 1: non-stop interior stop (timeout) This "interior stop" now happens before "target remote" prints the prompt, so we should no longer explicitly expect it. gdb/testsuite/ChangeLog: 2015-08-20 Pedro Alves * gdb.server/solib-list.exp: No longer expect an interior stop in non-stop mode. commit 221e1a37cd14f7c98b4ea1ab24bd721a8b144711 Author: Pedro Alves Date: Thu Aug 20 18:27:55 2015 +0100 remote non-stop: Process initially stopped threads before other commands The main motivation for this is making non-stop / all-stop behave similarly on initial connection, in order to move in the direction of reimplementing all-stop mode with the remote target always running in non-stop mode. When we connect to a remote target in non-stop mode, we may find threads either running or already stopped. The act of connecting itself does not force threads to stop. To handle that, the remote non-stop connection is currently roughly like this: #1 - Fetch list of remote threads (qXfer:threads:read, qfThreadInfo, etc). All threads are assumed to be running until the target reports an asynchronous stop reply for them. #2 - Fetch the initial set of threads that were already stopped, with the '?' packet. (In non-stop, this is coupled with the vStopped mechanism to be able to retrieve the status of more than one thread.) The stop replies fetched in #2 are placed in the pending stop reply queue, and left for the regular event loop to process. That is, "target remote" finishes and returns _before_ those stops are processed. That means that it's possible to have GDB process further commands before the initial set of stopped threads is reported to the user. E.g., before the patch, note how the prompt is printed before the frame: Remote debugging using :9999 (gdb) [Thread 15296] #1 stopped. 0x0000003615a011f0 in ?? () Even though thread #1 was not running, for a moment, the user can see it as such: $ gdb a.out -ex "set non-stop 1" -ex "tar rem :9999" -ex "info threads" -ex "info registers" Remote debugging using :9999 Id Target Id Frame * 1 Thread 4772 (running) Target is executing. <<<<<<< info registers (gdb) [Thread 4772] #1 stopped. 0x0000003615a011f0 in ?? () To fix that, this commit makes gdb process all threads found already stopped at connection time, before giving the prompt to the user. The fix takes a cue from fork-child.c:startup_inferior [1], and processes the events locally in remote.c, avoiding the whole wait_for_inferior/handle_inferior_event path. I decided to try this approach after noticing that: - several cases in handle_inferior_event miss checking stop_soon. - we don't want to fetch the thread list in normal_stop. and trying to fix them was resulting in sprinkling stop_soon checks in many places, and uglifying normal_stop even more. While with this patch, I'm avoiding changing GDB's output other than when the prompt is printed, I think this approach is more flexible if we do want to change it. And also, it's likely easier to get rid of the MI *running event that is still sent for threads that are initially found stopped, if we want to. This happens to fix the testsuite too. All non-stop tests are racy against "target remote" / gdbserver testing currently. That is, sometimes the tests run, but other times they're just skipped without any indication of PASS/FAIL. When that happens, the logs show: target remote localhost:2346 Remote debugging using localhost:2346 (gdb) [Thread 25418] #1 stopped. 0x0000003615a011f0 in ?? () ^CQuit (gdb) Remote debugging from host 127.0.0.1 Killing process(es): 25418 monitor exit (gdb) Remote connection closed (gdb) testcase /home/pedro/gdb/mygit/build/../src/gdb/testsuite/gdb.threads/multi-create-ns-info-thr.exp completed in 61 seconds The trouble here is that there's output after the prompt, and the regex in question doesn't expect that: -re "Remote debugging using .*$serialport_re.*$gdb_prompt $" { verbose "Set target to $targetname" return 0 } [1] - before startup_inferior was added, we'd go through wait_for_inferior/handle_inferior_event while going through the shell, and that turned out problematic. Tested on x86_64 Fedora 20, gdbserver. gdb/ChangeLog: 2015-08-20 Pedro Alves * infrun.c (print_target_wait_results): Make extern. * infrun.h (print_target_wait_results): Declare. * remote.c (set_stop_requested_callback): Delete. (process_initial_stop_replies): New function. (remote_start_remote): Use it. (stop_reply_queue_length): New function. gdb/testsuite/ChangeLog: 2015-08-20 Pedro Alves * gdb.server/connect-stopped-target.c: New file. * gdb.server/connect-stopped-target.exp: New file. commit 40e3ad0ebb0c71008b928d6d350e9258dc1dcf2a Author: Pedro Alves Date: Thu Aug 20 12:30:08 2015 +0100 Fix language of compilation unit with unknown file extension Here, in dwarfread.c:process_full_comp_unit: /* Set symtab language to language from DW_AT_language. If the compilation is from a C file generated by language preprocessors, do not set the language if it was already deduced by start_subfile. */ if (!(cu->language == language_c && COMPUNIT_FILETABS (cust)->language != language_c)) COMPUNIT_FILETABS (cust)->language = cu->language; in case start_subfile doesn't manage to deduce a language COMPUNIT_FILETABS(cust)->language ends up as language_unknown, not language_c. So the condition above evals false and we never set the language from the cu's language. gdb/ChangeLog: 2015-08-20 Pedro Alves * dwarf2read.c (process_full_comp_unit): To tell whether start_subfile managed to deduce a language, test for language_unknown instead of language_c. gdb/testsuite/ChangeLog: 2015-08-20 Pedro Alves * gdb.dwarf2/comp-unit-lang.exp: New file. * gdb.dwarf2/comp-unit-lang.c: New file. commit af39b3270a1385027b2a5d145b9ba7564bd39f7a Author: Pierre-Marie de Rodat Date: Wed Aug 19 17:12:48 2015 +0200 [Ada] Fix parsing for expressions with attributes and characters Before this change, trying to evaluate the following Ada expression yielded a syntax error, even though it's completely legal: (gdb) p s'first = 'a' Error in expression, near `'. The problem lies in the lexer (gdb/ada-lex.l): at the point we reach "'a'", we're still in the BEFORE_QUAL_QUOTE start condition (the mechanism to distinguish character literals from other "tick" usages: qualified expressions and attributes), so we consider that this quote is actually a separate "tick". This changes resets the start condition to INITIAL in the {TICK}[a-zA-Z][a-zA-Z]+ rule (for attributes): attributes activate this BEFORE_QUAL_QUOTE condition and in this case the above rule is always executed rather than the "'" one (in flex, it's always the longest match that is chosen). We now have instead: (gdb) p s'first = 'a' $1 = true gdb/ChangeLog: * ada-lex.l: Reset the start condition to INITIAL in the rule that matches attributes. gdb/testsuite/ChangeLog: * gdb.ada/attr_ref_and_charlit.exp: New testcase. * gdb.ada/attr_ref_and_charlit/foo.adb: New file. Tested on x86_64-linux, no regression. commit 9215b98bb27c071386a277f5578dbb17569a1471 Author: Alan Modra Date: Thu Aug 20 12:02:45 2015 +0930 gold --emit-relocs A symbol value in an ELF final linked binary is absolute, in contrast to a relocatable object file where the value is section relative. For --emit-relocs it is therefore incorrect to use the value of a section symbol as the addend when adjusting relocs against input section symbols to output section symbols. PR gold/18846 * target-reloc.h (relocate_relocs ): Subtract os->address() from addend. * powerpc.cc (relocate_relocs): Likewise. commit 9d1f51209437ebee8f0a930b9613d59759ea8dc0 Author: GDB Administrator Date: Thu Aug 20 00:00:10 2015 +0000 Automatic date update in version.in commit 7d45c7c3f692d93c3a33a043c347f1386681deb4 Author: Kevin Buettner Date: Mon Aug 3 14:17:17 2015 -0700 dwarf2read.c: Check type of string valued attributes prior to decoding. This change introduces a new function, dwarf2_string_attr(), which is a wrapper for dwarf2_attr(). dwarf2read.c has been updated to call dwarf2_string_attr in most instances where a string-valued attribute is decoded to produce a string value. In most cases, it simplifies the code; in some instances, the complexity of the code remains unchanged. I performed this change by looking for instances where the result of DW_STRING was used in an assignment. Many of these had a pattern which (roughly) looks something like this: struct attribute *attr = NULL; attr = dwarf2_attr (die, name, cu); if (attr != NULL && DW_STRING (attr)) { const char *str; ... str = DW_STRING (attr); ... /* Use str in some fashion. */ } Code of this form is transformed to look like this instead: const char *str; str = dwarf2_string_attr (die, name, cu) if (str != NULL) { ... /* Use str in some fashion. */ ... } In addition to invoking dwarf2_attr() and DW_STRING(), dwarf2_string_attr() checks to make sure that the attribute's `form' field matches one of DW_FORM_strp, DW_FORM_string, or DW_FORM_GNU_strp_alt. If it does not match one of these forms, it will return a NULL value in addition to calling complaint(). An earlier version of this patch did this type checking for one particular instance where a string attribute was being decoded. The situation that I was attempting to handle in that earlier patch is this: The Texas Instruments compiler uses the encoding for DW_AT_MIPS_linkage_name for other purposes. TI uses the encoding, 0x2007, for TI_AT_TI_end_line which, unlike DW_AT_MIPS_linkage_name, does not have a string-typed value. In this instance, GDB was attempting to use an integer value as a string pointer, with predictable results. (GDB would die with a segmentation fault.) I've added a test which reproduces the problem that I was orignally wanting to fix. It uses DW_AT_MIPS_linkage name with an associate value which is a string, and again, where the value is a small integer. My test case causes GDB to segfault in an unpatched GDB. There will be two PASSes in a patched GDB. Unpatched GDB: (gdb) ptype f ERROR: Process no longer exists UNRESOLVED: gdb.dwarf2/dw2-bad-mips-linkage-name.exp: ptype f ERROR: Couldn't send ptype g to GDB. UNRESOLVED: gdb.dwarf2/dw2-bad-mips-linkage-name.exp: ptype g Patched GDB: (gdb) ptype f type = bool () (gdb) PASS: gdb.dwarf2/dw2-bad-mips-linkage-name.exp: ptype f ptype g type = bool () (gdb) PASS: gdb.dwarf2/dw2-bad-mips-linkage-name.exp: ptype g I see no regressions on an x86_64 native target. gdb/ChangeLog: * dwarf2read.c (dwarf2_string_attr): New function. (lookup_dwo_unit, process_psymtab_comp_unit_reader) (dwarf2_compute_name, dwarf2_physname, find_file_and_directory) (read_call_site_scope, namespace_name, guess_full_die_structure_name) (anonymous_struct_prefix, prepare_one_comp_unit): Use dwarf2_string_attr in place of dwarf2_attr and DW_STRING. gdb/testsuite/ChangeLog: * gdb.dwarf2/dw2-bad-mips-linkage-name.c: New file. * gdb.dwarf2/dw2-bad-mips-linkage-name.exp: New file. commit 07c9aa07cdcf00eff8e186f3ca1779e5e3ffdb75 Author: Jiong Wang Date: Wed Aug 19 11:26:56 2015 +0100 [AArch64][6/6] LD support TLSLD load/store relocation types 2015-08-19 Jiong Wang bfd/ * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize new relocation types, including BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12, BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC, BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12, BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC, BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12, BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC, BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12, BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC. (elfNN_aarch64_final_link_relocate): Likewise. * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise. (_bfd_aarch64_elf_resolve_relocation): Likewise. ld/testsuite/ * ld-aarch64/emit-relocs-531.s: New testcase. * ld-aarch64/emit-relocs-531-overflow.s: Likewise. * ld-aarch64/emit-relocs-532.s: Likewise. * ld-aarch64/emit-relocs-533.s: Likewise. * ld-aarch64/emit-relocs-533-overflow.s: Likewise. * ld-aarch64/emit-relocs-534.s: Likewise. * ld-aarch64/emit-relocs-535.s: Likewise. * ld-aarch64/emit-relocs-535-overflow.s: Likewise. * ld-aarch64/emit-relocs-536.s: Likewise. * ld-aarch64/emit-relocs-537.s: Likewise. * ld-aarch64/emit-relocs-537-overflow.s: Likewise. * ld-aarch64/emit-relocs-538.s: Likewise. * ld-aarch64/emit-relocs-531.d: New expectation file. * ld-aarch64/emit-relocs-531-overflow.d: Likewise. * ld-aarch64/emit-relocs-532.d: Likewise. * ld-aarch64/emit-relocs-533.d: Likewise. * ld-aarch64/emit-relocs-533-overflow.d: Likewise. * ld-aarch64/emit-relocs-534.d: Likewise. * ld-aarch64/emit-relocs-535.d: Likewise. * ld-aarch64/emit-relocs-535-overflow.d: Likewise. * ld-aarch64/emit-relocs-536.d: Likewise. * ld-aarch64/emit-relocs-537.d: Likewise. * ld-aarch64/emit-relocs-537-overflow.d: Likewise. * ld-aarch64/emit-relocs-538.d: Likewise. * ld-aarch64/aarch64-elf.exp: Run new testcases. commit 4c5625238cccb048261d7ce0eb748ee5e0d67cf0 Author: Jiong Wang Date: Wed Aug 19 11:22:22 2015 +0100 [AArch64][5/6] GAS support TLSLD load/store relocation types 2015-08-19 Jiong Wang bfd/ * reloc.c: New entries, including BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12, BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC, BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12, BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC, BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12, BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC. BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12, BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC. * elfnn-aarch64.c (elfNN_aarch64_howto_table): Likewise. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. gas/ * config/tc-aarch64.c (reloc_table): New relocation types support for dtprel_lo12. (ldst_lo12_determine_real_reloc_type): Support BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12, BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC, BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12, BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC, BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12, BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC, BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12, BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC. (parse_operands): Likewise. (md_apply_fix): Likewise (aarch64_force_relocation): Likewise. (process_movw_reloc_info): Likewise. gas/testsuite/ * gas/aarch64/reloc-dtprel_lo12-ldst8.s: New testcase. * gas/aarch64/reloc-dtprel_lo12_nc-ldstc.s: Likewise. * gas/aarch64/reloc-dtprel_lo12-ldst16.s: Likewise. * gas/aarch64/reloc-dtprel_lo12_nc-ldst16.s: Likewise. * gas/aarch64/reloc-dtprel_lo12-ldst32.s: Likewise. * gas/aarch64/reloc-dtprel_lo12_nc-ldst32.s: Likewise. * gas/aarch64/reloc-dtprel_lo12-ldst64.s: Likewise. * gas/aarch64/reloc-dtprel_lo12_nc-ldst64.s: Likewise. * gas/aarch64/reloc-dtprel_lo12-ldst8.d: New expectation file. * gas/aarch64/reloc-dtprel_lo12_nc-ldst8.d: Likewise. * gas/aarch64/reloc-dtprel_lo12-ldst16.d: Likewise. * gas/aarch64/reloc-dtprel_lo12_nc-ldst16.d: Likewise. * gas/aarch64/reloc-dtprel_lo12-ldst32.d: Likewise. * gas/aarch64/reloc-dtprel_lo12_nc-ldst32.d: Likewise. * gas/aarch64/reloc-dtprel-lo12-ldst64.d: Likewise. * gas/aarch64/reloc-dtprel_lo12_nc-ldst64.d: Likewise. commit 6ffe9a1ba36f3a896ae323e35a207b6451e8f7f9 Author: Jiong Wang Date: Wed Aug 19 11:18:25 2015 +0100 [AArch64][4/6] LD support TLSLD move/add relocation types 2015-08-19 Jiong Wang bfd/ PR ld/18276 * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize new relocation types, including BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_HI12, BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0, BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC, BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1, BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1_NC, BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G2. (elfNN_aarch64_final_link_relocate): Likewise. * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise. (_bfd_aarch64_elf_resolve_relocation): Likewise. ld/testsuite/ * ld-aarch64/emit-relocs-87.s: New testcase. * ld-aarch64/emit-relocs-88.s: Likewise. * ld-aarch64/emit-relocs-88-overflow.s: Likewise. * ld-aarch64/emit-relocs-89.s: Likewise. * ld-aarch64/emit-relocs-90.s: Likewise. * ld-aarch64/emit-relocs-90-overflow.s: Likewise. * ld-aarch64/emit-relocs-523.s: Likewise. * ld-aarch64/emit-relocs-524.s: Likewise. * ld-aarch64/emit-relocs-525.s: Likewise. * ld-aarch64/emit-relocs-527.s: Likewise. * ld-aarch64/emit-relocs-526.s: Likewise. * ld-aarch64/emit-relocs-528.s: Likewise. * ld-aarch64/emit-relocs-528-overflow.s: Likewise. * ld-aarch64/emit-relocs-87.d: New expectation file. * ld-aarch64/emit-relocs-88.d: Likewise. * ld-aarch64/emit-relocs-88-overflow.d: Likewise. * ld-aarch64/emit-relocs-89.d: Likewise. * ld-aarch64/emit-relocs-90.d: Likewise. * ld-aarch64/emit-relocs-90-overflow.d: Likewise. * ld-aarch64/emit-relocs-91.d: Likewise. * ld-aarch64/emit-relocs-523.d: Likewise. * ld-aarch64/emit-relocs-524.d: Likewise. * ld-aarch64/emit-relocs-525.d: Likewise. * ld-aarch64/emit-relocs-526.d: Likewise. * ld-aarch64/emit-relocs-527.d: Likewise. * ld-aarch64/emit-relocs-528.d: Likewise. * ld-aarch64/emit-relocs-528-overflow.d: Likewise. * ld-aarch64/aarch64-elf.exp: Run new testcases. commit 49df5539f9070c01128135a7d63f44b2efc4de6a Author: Jiong Wang Date: Wed Aug 19 11:02:34 2015 +0100 [AArch64][3/6] GAS support TLSLD move/add relocation types 2015-08-19 Jiong Wang bfd/ * reloc.c (BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_HI12, BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0, BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC, BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1, BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1_NC, BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G2): New entries. * elfnn-aarch64.c (elfNN_aarch64_howto_table): Likewise. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. gas/ * config/tc-aarch64.c (reloc_table): New relocation modifiers, "dtprel_hi12", "dtprel_g0", "dtprel_g0_nc", "dtprel_g1", "dtprel_g1_nc", "dtprel_g2". (md_apply_fix): Support new relocation types. (aarch64_force_relocation): Likewise. (process_movw_reloc_info): Likewise. gas/testsuite/ * gas/aarch64/reloc-dtprel_g0.s: New testcase. * gas/aarch64/reloc-dtprel_g0-ilp32.s: Likewise. * gas/aarch64/reloc-dtprel_g0_nc.s: Likewise. * gas/aarch64/reloc-dtprel_g0_nc-ilp32.s: Likewise. * gas/aarch64/reloc-dtprel_g1.s: Likewise. * gas/aarch64/reloc-dtprel_g1-ilp32.s: Likewise. * gas/aarch64/reloc-dtprel_g1_nc.s: Likewise. * gas/aarch64/reloc-dtprel_g2.s: Likewise. * gas/aarch64/reloc-dtprel_hi12.s: Likewise. * gas/aarch64/reloc-dtprel_hi12-ilp32.s: Likewise. * gas/aarch64/reloc-dtprel_g0.d: New expectation file. * gas/aarch64/reloc-dtprel_g0-ilp32.d: Likewise. * gas/aarch64/reloc-dtprel_g0_nc.d: Likewise. * gas/aarch64/reloc-dtprel_g0_nc-ilp32.d: Likewise. * gas/aarch64/reloc-dtprel_g1.d: Likewise. * gas/aarch64/reloc-dtprel_g1-ilp32.d: Likewise. * gas/aarch64/reloc-dtprel_g1_nc.d: Likewise. * gas/aarch64/reloc-dtprel_g2.d: Likewise. * gas/aarch64/reloc-dtprel_hi12.d: Likewise. * gas/aarch64/reloc-dtprel_hi12-ilp32.d: Likewise. commit 753999c1ec8fa76bd5ed5509d1e5909d010e80ee Author: Jiong Wang Date: Wed Aug 19 10:58:13 2015 +0100 [AArch64][2/6] LD support BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC 2015-08-19 Jiong Wang bfd/ * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC. (aarch64_reloc_got_type): Likewise. (elfNN_aarch64_final_link_relocate): Likewise. (elfNN_aarch64_relocate_section): Likewise. * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise. (_bfd_aarch64_elf_resolve_relocation): Likewise. ld/testsuite/ * ld-aarch64/emit-relocs-530.s: New testcase. * ld-aarch64/emit-relocs-92.s: Likewise. * ld-aarch64/emit-relocs-530.d: New expectation file. * ld-aarch64/emit-relocs-92.d: Likewise. * ld-aarch64/aarch64-elf.exp: Run new testcases. commit 13289c10e20281adf480d9822861412a7ade721d Author: Jiong Wang Date: Wed Aug 19 10:57:34 2015 +0100 [AArch64][1/6] GAS support BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC 2015-08-19 Jiong Wang bfd/ * reloc.c (BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC): New entry. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC. gas/ * config/tc-aarch64.c (reloc_table): New relocation modifiers. (md_apply_fix): Support BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC. (aarch64_force_relocation): Likewise. gas/testsuite/ * gas/aarch64/reloc-dtprel_lo12_nc.s: New testcase. * gas/aarch64/reloc-dtprel_lo12_nc-ilp32.s: Likewise. * gas/aarch64/reloc-dtprel_lo12_nc.d: New expectation file. * gas/aarch64/reloc-dtprel_lo12_nc-ilp32.d: Likewise. commit 45face3ba147a4c5f4f7e09cf10c95986b915002 Author: Gary Benson Date: Wed Aug 19 13:53:24 2015 +0100 Prelimit number of bytes to read in "vFile:pread:" While handling "vFile:pread:" packets, gdbserver would read the number of bytes requested regardless of whether this would fit into the reply packet. gdbserver would then return a packet's worth of data and discard the remainder. When accessing large binaries GDB (via BFD) routinely makes large "vFile:pread:" requests, resulting in gdbserver allocating large unnecessary buffers and reading some portions of the file many times over. This commit causes gdbserver to limit the number of bytes to be read to a sensible maximum prior to allocating buffers and reading data. gdb/gdbserver/ChangeLog: * hostio.c (handle_pread): Do not attempt to read more data than hostio_reply_with_data can fit in a packet. commit 64d94ba01a4f56ac10bb277e66bb00d82bd97f10 Author: Alan Modra Date: Wed Aug 19 12:32:54 2015 +0930 Remove link_info.pic Adding type_pie to output_type allows us to remove link_info.pic and with some reordering of the enum, produces better code. include/ * bfdlink.h (enum output_type): Delete type_executable, add type_pde and type_pie. Reorder. (struct bfd_link_info): Delete pic field. (bfd_link_executable, bfd_link_pde, bfd_link_pie, bfd_link_pic): Adjust. ld/ * emultempl/aix.em: Don't set link_info.pic. * emultempl/pe.em: Likewise. * emultempl/pep.em: Likewise. * emultempl/sunos.em: Likewise. * lexsup.c (parse_args): Likewise. Set type_pie for -pie. * plugin.c (set_tv_header ): Simplify. commit 3cbc1e5e68341e53a03fe7e9d38fc02e0d78c418 Author: Alan Modra Date: Wed Aug 19 11:57:40 2015 +0930 Add bfd_link_pde, and simplify some tests of link_info.type include/ * bfdlink.h (bfd_link_pde): Define. bfd/ * elf-s390-common.c: Simplify expressions using bfd_linke_executable, bfd_link_pie and bfd_link_pic. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-frv.c: Likewise. * elf32-m68k.c: Likewise. * elf32-nios2.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf64-alpha.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elflink.c: Likewise. commit b45e00b3ed40589af75b8a36a67905ae265a20f8 Author: Cary Coutant Date: Mon Jul 27 15:09:08 2015 -0700 Fix symbol versioning problems in PR 18703. If a symbol is defined with ".symver foo,foo@VER", the assembler creates two symbols in the object: one unversioned, and one with the (non-default) version "VER". If foo is listed in a version script, gold would then make the first of those symbols the default version, and would ignore the second symbol as a duplicate, without making it a non-default version. While this is arguably reasonable behavior, it doesn't match Gnu ld behavior, so this patch fixes that by allowing the second definition to override the first by resetting the "default version" indication. Several test cases from the Gnu ld testsuite also exposed another related problem, where a symbol defined with ".symver foo,foo@", placed into a shared library, is not handled properly by gold. This patch also fixes that case, binding the symbol to the base version. gold/ PR gold/18703 * dynobj.cc (Versions::record_version): Handle symbol defined with base version. (Versions::symbol_section_contents): Likewise. * symtab.h (Symbol::set_is_not_default): New class method. (Symbol_table::resolve): Add is_default_version parameter. (Symbol_table::should_override): Likewise. * resolve.cc (Symbol_table::resolve): Add is_default_version parameter, and pass to should_override. Adjust all callers and explicit instantiations. (Symbol_table::should_override): Add is_default_value parameter; allow default version in a dynamic object to override existing definition from same object. * symtab.cc (Symbol_table::add_from_object): Handle case where same symbol is defined as unversioned and non-default version in the same object. * testsuite/Makefile.am (ver_test_13): New test case. * testsuite/Makefile.in: Regenerate. * testsuite/ver_test_4.cc: Add test for symbol with base version. * testsuite/ver_test_4.sh: Likewise. * testsuite/ver_test_13.c: New source file. * testsuite/ver_test_13.script: New version script. * testsuite/ver_test_13.sh: New test case. commit e49433d22dae92a56ae15a8b5742cbf1f31d5fd1 Author: GDB Administrator Date: Wed Aug 19 00:00:08 2015 +0000 Automatic date update in version.in commit 16d5f64295ccf2a8e9fe3ed350c94c38cee5a481 Author: Joel Brobecker Date: Tue Aug 11 15:28:19 2015 -0400 gdbserver/linux-aarch32-low: build failure when NT_ARM_VFP not defined On some older versions of GNU/Linux, gdbserver now fails to build due to an undefined reference to NT_ARM_VFP. Same issue on Android, where this macros is undefined until Android API level 21 (Android 5.0 "Lollipop"). This patch modifies linux-aarch32-low.c to define that macros when not already defined. gdb/gdbserver/ChangeLog: * linux-aarch32-low.c (NT_ARM_VFP): Define if not already defined. commit 4d6cceb4e40a057dbe4d9ad94b0641d5f4725c09 Author: Doug Evans Date: Tue Aug 18 14:02:03 2015 -0700 PR mi/18833 gdb.execute ("set param value", to_string=True) will crash gdb if using MI gdb/ChangeLog: * cli/cli-logging.c (pop_output_files): Don't restore redirection if MI-like. * mi/mi-out.c: #include "vec.h". (ui_filep): New type. (DEV_VEC_P (ui_filep)): New type. (struct ui_out_data) : Delete. (struct ui_out_data) : New member. (mi_ui_out_impl): Add data_destroy field. (mi_field_string, mi_field_fmt): Update. (mi_flush, mi_redirect, field_separator): Update. (mi_open, mi_close): Update. (mi_out_buffered, mi_out_rewind, mi_out_put): Update. (mi_out_data_ctor, mi_out_data_dtor): New functions. (mi_out_new): Call mi_out_data_ctor. testsuite/gdb/ChangeLog: * lib/gdb.exp (skip_python_tests_prompt): Renamed from skip_python_tests. New arg prompt_regexp. (skip_python_tests): New function. * lib/mi-support.exp (mi_skip_python_tests): New function. * gdb.python/py-mi-objfile-gdb.py: New file. * gdb.python/py-mi-objfile.c: New file. * gdb.python/py-mi-objfile.exp: New file. ----------------------------------------------------------------------- Summary of changes: bfd/ChangeLog | 90 +++++++ bfd/bfd-in2.h | 57 +++++ bfd/elf-s390-common.c | 5 +- bfd/elf32-arm.c | 2 +- bfd/elf32-bfin.c | 22 +- bfd/elf32-frv.c | 24 +- bfd/elf32-m68k.c | 2 +- bfd/elf32-nios2.c | 2 +- bfd/elf32-ppc.c | 3 +- bfd/elf32-s390.c | 2 +- bfd/elf32-sh.c | 4 +- bfd/elf64-alpha.c | 14 +- bfd/elf64-ppc.c | 2 +- bfd/elf64-s390.c | 2 +- bfd/elflink.c | 2 +- bfd/elfnn-aarch64.c | 255 ++++++++++++++++++++ bfd/elfxx-aarch64.c | 30 +++ bfd/libbfd.h | 17 ++ bfd/reloc.c | 75 ++++++- bfd/version.h | 2 +- gas/ChangeLog | 33 +++ gas/config/tc-aarch64.c | 146 +++++++++++- gas/testsuite/ChangeLog | 49 ++++ gas/testsuite/gas/aarch64/reloc-dtprel_g0-ilp32.d | 10 + gas/testsuite/gas/aarch64/reloc-dtprel_g0-ilp32.s | 5 + gas/testsuite/gas/aarch64/reloc-dtprel_g0.d | 9 + gas/testsuite/gas/aarch64/reloc-dtprel_g0.s | 5 + .../gas/aarch64/reloc-dtprel_g0_nc-ilp32.d | 10 + .../gas/aarch64/reloc-dtprel_g0_nc-ilp32.s | 5 + gas/testsuite/gas/aarch64/reloc-dtprel_g0_nc.d | 9 + gas/testsuite/gas/aarch64/reloc-dtprel_g0_nc.s | 5 + gas/testsuite/gas/aarch64/reloc-dtprel_g1-ilp32.d | 10 + gas/testsuite/gas/aarch64/reloc-dtprel_g1-ilp32.s | 5 + gas/testsuite/gas/aarch64/reloc-dtprel_g1.d | 9 + gas/testsuite/gas/aarch64/reloc-dtprel_g1.s | 5 + gas/testsuite/gas/aarch64/reloc-dtprel_g1_nc.d | 9 + gas/testsuite/gas/aarch64/reloc-dtprel_g1_nc.s | 5 + gas/testsuite/gas/aarch64/reloc-dtprel_g2.d | 9 + gas/testsuite/gas/aarch64/reloc-dtprel_g2.s | 5 + .../gas/aarch64/reloc-dtprel_hi12-ilp32.d | 10 + .../gas/aarch64/reloc-dtprel_hi12-ilp32.s | 5 + gas/testsuite/gas/aarch64/reloc-dtprel_hi12.d | 9 + gas/testsuite/gas/aarch64/reloc-dtprel_hi12.s | 5 + .../gas/aarch64/reloc-dtprel_lo12-ldst16.d | 10 + .../gas/aarch64/reloc-dtprel_lo12-ldst16.s | 6 + .../gas/aarch64/reloc-dtprel_lo12-ldst32.d | 10 + .../gas/aarch64/reloc-dtprel_lo12-ldst32.s | 6 + .../gas/aarch64/reloc-dtprel_lo12-ldst64.d | 10 + .../gas/aarch64/reloc-dtprel_lo12-ldst64.s | 6 + .../gas/aarch64/reloc-dtprel_lo12-ldst8.d | 10 + .../gas/aarch64/reloc-dtprel_lo12-ldst8.s | 6 + .../gas/aarch64/reloc-dtprel_lo12_nc-ilp32.d | 10 + .../gas/aarch64/reloc-dtprel_lo12_nc-ilp32.s | 5 + .../gas/aarch64/reloc-dtprel_lo12_nc-ldst16.d | 10 + .../gas/aarch64/reloc-dtprel_lo12_nc-ldst16.s | 5 + .../gas/aarch64/reloc-dtprel_lo12_nc-ldst32.d | 10 + .../gas/aarch64/reloc-dtprel_lo12_nc-ldst32.s | 6 + .../gas/aarch64/reloc-dtprel_lo12_nc-ldst64.d | 10 + .../gas/aarch64/reloc-dtprel_lo12_nc-ldst64.s | 6 + .../gas/aarch64/reloc-dtprel_lo12_nc-ldst8.d | 10 + .../gas/aarch64/reloc-dtprel_lo12_nc-ldst8.s | 6 + gas/testsuite/gas/aarch64/reloc-dtprel_lo12_nc.d | 9 + gas/testsuite/gas/aarch64/reloc-dtprel_lo12_nc.s | 5 + gdb/ChangeLog | 48 ++++ gdb/ada-lex.l | 2 +- gdb/build-id.c | 3 +- gdb/build-id.h | 7 +- gdb/cli/cli-cmds.c | 3 +- gdb/cli/cli-logging.c | 4 +- gdb/defs.h | 6 +- gdb/dwarf2read.c | 139 ++++++----- gdb/exec.c | 9 +- gdb/gdbserver/ChangeLog | 9 + gdb/gdbserver/hostio.c | 12 + gdb/gdbserver/linux-aarch32-low.c | 6 + gdb/infrun.c | 7 +- gdb/infrun.h | 5 + gdb/mi/mi-out.c | 107 ++++++--- gdb/nto-tdep.c | 9 +- gdb/nto-tdep.h | 3 +- gdb/remote.c | 117 +++++++-- gdb/solib-svr4.c | 6 + gdb/solib.c | 45 +++-- gdb/solist.h | 7 +- gdb/source.c | 34 ++- gdb/symfile.c | 4 +- gdb/testsuite/ChangeLog | 36 +++ gdb/testsuite/gdb.ada/attr_ref_and_charlit.exp | 42 ++++ gdb/testsuite/gdb.ada/attr_ref_and_charlit/foo.adb | 24 ++ gdb/testsuite/gdb.dwarf2/comp-unit-lang.c | 34 +++ gdb/testsuite/gdb.dwarf2/comp-unit-lang.exp | 80 ++++++ .../gdb.dwarf2/dw2-bad-mips-linkage-name.c | 41 +++ .../gdb.dwarf2/dw2-bad-mips-linkage-name.exp | 72 ++++++ gdb/testsuite/gdb.python/py-mi-objfile-gdb.py | 27 ++ gdb/testsuite/gdb.python/py-mi-objfile.c | 22 ++ gdb/testsuite/gdb.python/py-mi-objfile.exp | 57 +++++ gdb/testsuite/gdb.server/connect-stopped-target.c | 22 ++ .../gdb.server/connect-stopped-target.exp | 82 +++++++ gdb/testsuite/gdb.server/solib-list.exp | 9 - gdb/testsuite/lib/gdb.exp | 25 ++- gdb/testsuite/lib/mi-support.exp | 9 + gold/ChangeLog | 7 + gold/dynobj.cc | 12 +- gold/powerpc.cc | 6 +- gold/resolve.cc | 33 ++- gold/symtab.cc | 31 +++- gold/symtab.h | 10 +- gold/target-reloc.h | 6 +- gold/testsuite/Makefile.am | 9 + gold/testsuite/Makefile.in | 12 +- gold/testsuite/ver_test_13.c | 7 + gold/testsuite/ver_test_13.script | 4 + gold/testsuite/{ver_test_4.sh => ver_test_13.sh} | 31 ++- gold/testsuite/ver_test_4.cc | 10 + gold/testsuite/ver_test_4.sh | 5 +- include/ChangeLog | 11 + include/bfdlink.h | 16 +- include/elf/aarch64.h | 5 + ld/ChangeLog | 9 + ld/emultempl/aix.em | 1 - ld/emultempl/pe.em | 5 +- ld/emultempl/pep.em | 5 +- ld/emultempl/sunos.em | 1 - ld/lexsup.c | 4 +- ld/plugin.c | 9 +- ld/testsuite/ChangeLog | 67 +++++ ld/testsuite/ld-aarch64/aarch64-elf.exp | 28 +++ ld/testsuite/ld-aarch64/emit-relocs-523.d | 7 + ld/testsuite/ld-aarch64/emit-relocs-523.s | 11 + ld/testsuite/ld-aarch64/emit-relocs-524.d | 7 + ld/testsuite/ld-aarch64/emit-relocs-524.s | 11 + ld/testsuite/ld-aarch64/emit-relocs-525.d | 7 + ld/testsuite/ld-aarch64/emit-relocs-525.s | 11 + ld/testsuite/ld-aarch64/emit-relocs-526-overflow.d | 4 + ld/testsuite/ld-aarch64/emit-relocs-526-overflow.s | 10 + ld/testsuite/ld-aarch64/emit-relocs-526.d | 7 + ld/testsuite/ld-aarch64/emit-relocs-526.s | 10 + ld/testsuite/ld-aarch64/emit-relocs-527.d | 7 + ld/testsuite/ld-aarch64/emit-relocs-527.s | 10 + ld/testsuite/ld-aarch64/emit-relocs-528-overflow.d | 4 + ld/testsuite/ld-aarch64/emit-relocs-528-overflow.s | 11 + ld/testsuite/ld-aarch64/emit-relocs-528.d | 7 + ld/testsuite/ld-aarch64/emit-relocs-528.s | 11 + ld/testsuite/ld-aarch64/emit-relocs-530.d | 7 + ld/testsuite/ld-aarch64/emit-relocs-530.s | 10 + ld/testsuite/ld-aarch64/emit-relocs-531-overflow.d | 4 + ld/testsuite/ld-aarch64/emit-relocs-531-overflow.s | 11 + ld/testsuite/ld-aarch64/emit-relocs-531.d | 7 + ld/testsuite/ld-aarch64/emit-relocs-531.s | 10 + ld/testsuite/ld-aarch64/emit-relocs-532.d | 9 + ld/testsuite/ld-aarch64/emit-relocs-532.s | 17 ++ ld/testsuite/ld-aarch64/emit-relocs-533-overflow.d | 4 + ld/testsuite/ld-aarch64/emit-relocs-533-overflow.s | 11 + ld/testsuite/ld-aarch64/emit-relocs-533.d | 7 + ld/testsuite/ld-aarch64/emit-relocs-533.s | 10 + ld/testsuite/ld-aarch64/emit-relocs-534.d | 9 + ld/testsuite/ld-aarch64/emit-relocs-534.s | 17 ++ ld/testsuite/ld-aarch64/emit-relocs-535-overflow.d | 4 + ld/testsuite/ld-aarch64/emit-relocs-535-overflow.s | 11 + ld/testsuite/ld-aarch64/emit-relocs-535.d | 7 + ld/testsuite/ld-aarch64/emit-relocs-535.s | 10 + ld/testsuite/ld-aarch64/emit-relocs-536.d | 9 + ld/testsuite/ld-aarch64/emit-relocs-536.s | 17 ++ ld/testsuite/ld-aarch64/emit-relocs-537-overflow.d | 4 + ld/testsuite/ld-aarch64/emit-relocs-537-overflow.s | 11 + ld/testsuite/ld-aarch64/emit-relocs-537.d | 7 + ld/testsuite/ld-aarch64/emit-relocs-537.s | 12 + ld/testsuite/ld-aarch64/emit-relocs-538.d | 9 + ld/testsuite/ld-aarch64/emit-relocs-538.s | 19 ++ ld/testsuite/ld-aarch64/emit-relocs-87.d | 8 + ld/testsuite/ld-aarch64/emit-relocs-87.s | 10 + ld/testsuite/ld-aarch64/emit-relocs-88-overflow.d | 5 + ld/testsuite/ld-aarch64/emit-relocs-88-overflow.s | 10 + ld/testsuite/ld-aarch64/emit-relocs-88.d | 8 + ld/testsuite/ld-aarch64/emit-relocs-88.s | 10 + ld/testsuite/ld-aarch64/emit-relocs-89.d | 8 + ld/testsuite/ld-aarch64/emit-relocs-89.s | 10 + ld/testsuite/ld-aarch64/emit-relocs-90-overflow.d | 5 + ld/testsuite/ld-aarch64/emit-relocs-90-overflow.s | 11 + ld/testsuite/ld-aarch64/emit-relocs-90.d | 8 + ld/testsuite/ld-aarch64/emit-relocs-90.s | 11 + ld/testsuite/ld-aarch64/emit-relocs-92.d | 8 + ld/testsuite/ld-aarch64/emit-relocs-92.s | 10 + 183 files changed, 2859 insertions(+), 309 deletions(-) create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_g0-ilp32.d create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_g0-ilp32.s create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_g0.d create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_g0.s create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_g0_nc-ilp32.d create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_g0_nc-ilp32.s create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_g0_nc.d create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_g0_nc.s create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_g1-ilp32.d create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_g1-ilp32.s create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_g1.d create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_g1.s create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_g1_nc.d create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_g1_nc.s create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_g2.d create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_g2.s create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_hi12-ilp32.d create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_hi12-ilp32.s create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_hi12.d create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_hi12.s create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_lo12-ldst16.d create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_lo12-ldst16.s create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_lo12-ldst32.d create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_lo12-ldst32.s create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_lo12-ldst64.d create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_lo12-ldst64.s create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_lo12-ldst8.d create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_lo12-ldst8.s create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_lo12_nc-ilp32.d create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_lo12_nc-ilp32.s create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_lo12_nc-ldst16.d create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_lo12_nc-ldst16.s create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_lo12_nc-ldst32.d create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_lo12_nc-ldst32.s create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_lo12_nc-ldst64.d create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_lo12_nc-ldst64.s create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_lo12_nc-ldst8.d create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_lo12_nc-ldst8.s create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_lo12_nc.d create mode 100644 gas/testsuite/gas/aarch64/reloc-dtprel_lo12_nc.s create mode 100644 gdb/testsuite/gdb.ada/attr_ref_and_charlit.exp create mode 100644 gdb/testsuite/gdb.ada/attr_ref_and_charlit/foo.adb create mode 100644 gdb/testsuite/gdb.dwarf2/comp-unit-lang.c create mode 100644 gdb/testsuite/gdb.dwarf2/comp-unit-lang.exp create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-bad-mips-linkage-name.c create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-bad-mips-linkage-name.exp create mode 100644 gdb/testsuite/gdb.python/py-mi-objfile-gdb.py create mode 100644 gdb/testsuite/gdb.python/py-mi-objfile.c create mode 100644 gdb/testsuite/gdb.python/py-mi-objfile.exp create mode 100644 gdb/testsuite/gdb.server/connect-stopped-target.c create mode 100644 gdb/testsuite/gdb.server/connect-stopped-target.exp create mode 100644 gold/testsuite/ver_test_13.c create mode 100644 gold/testsuite/ver_test_13.script copy gold/testsuite/{ver_test_4.sh => ver_test_13.sh} (60%) create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-523.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-523.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-524.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-524.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-525.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-525.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-526-overflow.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-526-overflow.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-526.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-526.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-527.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-527.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-528-overflow.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-528-overflow.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-528.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-528.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-530.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-530.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-531-overflow.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-531-overflow.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-531.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-531.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-532.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-532.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-533-overflow.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-533-overflow.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-533.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-533.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-534.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-534.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-535-overflow.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-535-overflow.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-535.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-535.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-536.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-536.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-537-overflow.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-537-overflow.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-537.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-537.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-538.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-538.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-87.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-87.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-88-overflow.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-88-overflow.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-88.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-88.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-89.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-89.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-90-overflow.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-90-overflow.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-90.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-90.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-92.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-92.s First 500 lines of diff: diff --git a/bfd/ChangeLog b/bfd/ChangeLog index c0fbbe9..dcd0e88 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,93 @@ +2015-08-19 Jiong Wang + + * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize new relocation + types, including BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12, + BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC, + BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12, + BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC, + BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12, + BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC, + BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12, + BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC. + (elfNN_aarch64_final_link_relocate): Likewise. + * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise. + (_bfd_aarch64_elf_resolve_relocation): Likewise. + +2015-08-19 Jiong Wang + + * reloc.c (BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12, + BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC, + BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12, + BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC, + BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12, + BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC. + BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12, + BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC): New entries. + * elfnn-aarch64.c (elfNN_aarch64_howto_table): Likewise. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + +2015-08-19 Jiong Wang + + PR ld/18276 + * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize new relocation + types, including BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_HI12, + BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0, + BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC, + BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1, + BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1_NC, + BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G2. + (elfNN_aarch64_final_link_relocate): Likewise. + * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise. + (_bfd_aarch64_elf_resolve_relocation): Likewise. + +2015-08-19 Jiong Wang + + * reloc.c (BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_HI12, + BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0, + BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC, + BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1, + BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1_NC, + BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G2): New entries. + * elfnn-aarch64.c (elfNN_aarch64_howto_table): Likewise. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + +2015-08-19 Jiong Wang + + * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize + BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC. + (aarch64_reloc_got_type): Likewise. + (elfNN_aarch64_final_link_relocate): Likewise. + (elfNN_aarch64_relocate_section): Likewise. + * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise. + (_bfd_aarch64_elf_resolve_relocation): Likewise. + +2015-08-19 Jiong Wang + + * reloc.c (BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC): New entry. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for + BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC. + +2015-08-19 Alan Modra + + * elf-s390-common.c: Simplify expressions using + bfd_linke_executable, bfd_link_pie and bfd_link_pic. + * elf32-arm.c: Likewise. + * elf32-bfin.c: Likewise. + * elf32-frv.c: Likewise. + * elf32-m68k.c: Likewise. + * elf32-nios2.c: Likewise. + * elf32-ppc.c: Likewise. + * elf32-s390.c: Likewise. + * elf32-sh.c: Likewise. + * elf64-alpha.c: Likewise. + * elf64-ppc.c: Likewise. + * elf64-s390.c: Likewise. + * elflink.c: Likewise. + 2015-08-18 Jiong Wang * elfnn-aarch64.c (aarch64_reloc_got_type): Delete useless check. diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 3299055..6ba3641 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -5794,9 +5794,15 @@ BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21. */ /* AArch64 TLS INITIAL EXEC relocation. */ BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19, +/* bit[23:12] of byte offset to module TLS base address. */ + BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_HI12, + /* Unsigned 12 bit byte offset to module TLS base address. */ BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12, +/* No overflow check version of BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12. */ + BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC, + /* Unsigned 12 bit byte offset to global offset table entry for a symbols tls_index structure. Used in conjunction with BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21. */ @@ -5809,6 +5815,49 @@ instruction. */ /* GOT entry address for AArch64 TLS Local Dynamic, used with ADR instruction. */ BFD_RELOC_AARCH64_TLSLD_ADR_PREL21, +/* bit[11:1] of byte offset to module TLS base address, encoded in ldst +instructions. */ + BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12, + +/* Similar as BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12, but no overflow check. */ + BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC, + +/* bit[11:2] of byte offset to module TLS base address, encoded in ldst +instructions. */ + BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12, + +/* Similar as BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12, but no overflow check. */ + BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC, + +/* bit[11:3] of byte offset to module TLS base address, encoded in ldst +instructions. */ + BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12, + +/* Similar as BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12, but no overflow check. */ + BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC, + +/* bit[11:0] of byte offset to module TLS base address, encoded in ldst +instructions. */ + BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12, + +/* Similar as BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12, but no overflow check. */ + BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC, + +/* bit[15:0] of byte offset to module TLS base address. */ + BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0, + +/* No overflow check version of BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0 */ + BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC, + +/* bit[31:16] of byte offset to module TLS base address. */ + BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1, + +/* No overflow check version of BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1 */ + BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1_NC, + +/* bit[47:32] of byte offset to module TLS base address. */ + BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G2, + /* AArch64 TLS LOCAL EXEC relocation. */ BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G2, @@ -5908,6 +5957,14 @@ assembler and not (currently) written to any object files. */ address. Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL. */ BFD_RELOC_AARCH64_LDST_LO12, +/* AArch64 pseudo relocation code for TLS local dynamic mode. It's to be +used internally by the AArch64 assembler and not (currently) written to +any object files. */ + BFD_RELOC_AARCH64_TLSLD_LDST_DTPREL_LO12, + +/* Similar as BFD_RELOC_AARCH64_TLSLD_LDST_DTPREL_LO12, but no overflow check. */ + BFD_RELOC_AARCH64_TLSLD_LDST_DTPREL_LO12_NC, + /* AArch64 pseudo relocation code to be used internally by the AArch64 assembler and not (currently) written to any object files. */ BFD_RELOC_AARCH64_LD_GOT_LO12_NC, diff --git a/bfd/elf-s390-common.c b/bfd/elf-s390-common.c index 5c36ec8..6b5b17b 100644 --- a/bfd/elf-s390-common.c +++ b/bfd/elf-s390-common.c @@ -151,8 +151,7 @@ keep: point to the IPLT slot. That way the referencing shared lib will always get the PLT slot address when resolving the respective R_390_GLOB_DAT/R_390_64 relocs on that symbol. */ - if (bfd_link_executable (info) - && !bfd_link_pic (info) + if (bfd_link_pde (info) && h->def_regular && h->ref_dynamic) { @@ -187,7 +186,7 @@ keep: if (h->got.refcount <= 0 || (bfd_link_pic (info) && (h->dynindx == -1 || h->forced_local)) - || (bfd_link_executable (info) && bfd_link_pic (info)) + || bfd_link_pie (info) || htab->sgot == NULL) { /* Use .got.iplt. */ diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index bd4b576..2e7d26d 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -9881,7 +9881,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, } case R_ARM_TLS_LE32: - if (bfd_link_pic (info) && !bfd_link_pie (info)) + if (bfd_link_dll (info)) { (*_bfd_error_handler) (_("%B(%A+0x%lx): R_ARM_TLS_LE32 relocation not permitted in shared object"), diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c index 49ef360..152134e 100644 --- a/bfd/elf32-bfin.c +++ b/bfd/elf32-bfin.c @@ -2215,7 +2215,7 @@ _bfinfdpic_emit_got_relocs_plt_entries (struct bfinfdpic_relocs_info *entry, /* If we're linking an executable at a fixed address, we can omit the dynamic relocation as long as the symbol is local to this module. */ - if (bfd_link_executable (info) && !bfd_link_pic (info) + if (bfd_link_pde (info) && (entry->symndx != -1 || BFINFDPIC_SYM_LOCAL (info, entry->d.h))) { @@ -2270,7 +2270,7 @@ _bfinfdpic_emit_got_relocs_plt_entries (struct bfinfdpic_relocs_info *entry, if (entry->symndx == -1 && ! BFINFDPIC_FUNCDESC_LOCAL (info, entry->d.h) && BFINFDPIC_SYM_LOCAL (info, entry->d.h) - && !(bfd_link_executable (info) && !bfd_link_pic (info))) + && !bfd_link_pde (info)) { reloc = R_BFIN_FUNCDESC; idx = elf_section_data (entry->d.h->root.u.def.section @@ -2306,7 +2306,7 @@ _bfinfdpic_emit_got_relocs_plt_entries (struct bfinfdpic_relocs_info *entry, dynamic symbol entry for the got section, so idx will be zero, which means we can and should compute the address of the private descriptor ourselves. */ - if (bfd_link_executable (info) && !bfd_link_pic (info) + if (bfd_link_pde (info) && (entry->symndx != -1 || BFINFDPIC_FUNCDESC_LOCAL (info, entry->d.h))) { @@ -2369,7 +2369,7 @@ _bfinfdpic_emit_got_relocs_plt_entries (struct bfinfdpic_relocs_info *entry, /* If we're linking an executable at a fixed address, we can omit the dynamic relocation as long as the symbol is local to this module. */ - if (bfd_link_executable (info) && !bfd_link_pic (info) + if (bfd_link_pde (info) && (entry->symndx != -1 || BFINFDPIC_SYM_LOCAL (info, entry->d.h))) { if (sec) @@ -2417,8 +2417,7 @@ _bfinfdpic_emit_got_relocs_plt_entries (struct bfinfdpic_relocs_info *entry, /* If we've omitted the dynamic relocation, just emit the fixed addresses of the symbol and of the local GOT base offset. */ - if (bfd_link_executable (info) - && !bfd_link_pic (info) + if (bfd_link_pde (info) && sec && sec->output_section) { @@ -2834,8 +2833,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, section+offset. */ if (h && ! BFINFDPIC_FUNCDESC_LOCAL (info, h) && BFINFDPIC_SYM_LOCAL (info, h) - && !(bfd_link_executable (info) - && !bfd_link_pic (info))) + && !bfd_link_pde (info)) { dynindx = elf_section_data (h->root.u.def.section ->output_section)->dynindx; @@ -2872,7 +2870,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, dynamic symbol entry for the got section, so idx will be zero, which means we can and should compute the address of the private descriptor ourselves. */ - if (bfd_link_executable (info) && !bfd_link_pic (info) + if (bfd_link_pde (info) && (!h || BFINFDPIC_FUNCDESC_LOCAL (info, h))) { bfd_vma offset; @@ -2995,7 +2993,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, can omit the dynamic relocation as long as the symbol is defined in the current link unit (which is implied by its output section not being NULL). */ - if (bfd_link_executable (info) && !bfd_link_pic (info) + if (bfd_link_pde (info) && (!h || BFINFDPIC_SYM_LOCAL (info, h))) { if (osec) @@ -3075,7 +3073,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, /* If we've omitted the dynamic relocation, just emit the fixed addresses of the symbol and of the local GOT base offset. */ - if (bfd_link_executable (info) && !bfd_link_pic (info) + if (bfd_link_pde (info) && (!h || BFINFDPIC_SYM_LOCAL (info, h))) bfd_put_32 (output_bfd, bfinfdpic_got_section (info)->output_section->vma @@ -3655,7 +3653,7 @@ _bfinfdpic_count_relocs_fixups (struct bfinfdpic_relocs_info *entry, { bfd_vma relocs = 0, fixups = 0; - if (!bfd_link_executable (dinfo->info) || bfd_link_pie (dinfo->info)) + if (!bfd_link_pde (dinfo->info)) relocs = entry->relocs32 + entry->relocsfd + entry->relocsfdv; else { diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c index b55a7ab..fa12528 100644 --- a/bfd/elf32-frv.c +++ b/bfd/elf32-frv.c @@ -1384,7 +1384,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry, /* If we're linking an executable at a fixed address, we can omit the dynamic relocation as long as the symbol is local to this module. */ - if (bfd_link_executable (info) && !bfd_link_pic (info) + if (bfd_link_pde (info) && (entry->symndx != -1 || FRVFDPIC_SYM_LOCAL (info, entry->d.h))) { @@ -1439,7 +1439,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry, if (entry->symndx == -1 && ! FRVFDPIC_FUNCDESC_LOCAL (info, entry->d.h) && FRVFDPIC_SYM_LOCAL (info, entry->d.h) - && !(bfd_link_executable (info) && !bfd_link_pic (info))) + && !bfd_link_pde (info)) { reloc = R_FRV_FUNCDESC; idx = elf_section_data (entry->d.h->root.u.def.section @@ -1482,7 +1482,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry, dynamic symbol entry for the got section, so idx will be zero, which means we can and should compute the address of the private descriptor ourselves. */ - if (bfd_link_executable (info) && !bfd_link_pic (info) + if (bfd_link_pde (info) && (entry->symndx != -1 || FRVFDPIC_FUNCDESC_LOCAL (info, entry->d.h))) { @@ -1545,7 +1545,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry, /* If we're linking an executable at a fixed address, we can omit the dynamic relocation as long as the symbol is local to this module. */ - if (bfd_link_executable (info) && !bfd_link_pic (info) + if (bfd_link_pde (info) && (entry->symndx != -1 || FRVFDPIC_SYM_LOCAL (info, entry->d.h))) { if (sec) @@ -1593,8 +1593,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry, /* If we've omitted the dynamic relocation, just emit the fixed addresses of the symbol and of the local GOT base offset. */ - if (bfd_link_executable (info) - && !bfd_link_pic (info) + if (bfd_link_pde (info) && sec && sec->output_section) { @@ -1847,7 +1846,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry, if (bfd_link_executable (info) && ! entry->tlsoff_entry) entry->tlsoff_entry = entry->tlsdesc_entry + 4; - if (bfd_link_executable (info) && !bfd_link_pic (info) + if (bfd_link_pde (info) && ((idx == 0 && (bfd_is_abs_section (sec) || bfd_is_und_section (sec))) @@ -3523,8 +3522,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, section+offset. */ if (h && ! FRVFDPIC_FUNCDESC_LOCAL (info, h) && FRVFDPIC_SYM_LOCAL (info, h) - && !(bfd_link_executable (info) - && !bfd_link_pic (info))) + && !bfd_link_pde (info)) { dynindx = elf_section_data (h->root.u.def.section ->output_section)->dynindx; @@ -3562,7 +3560,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, dynamic symbol entry for the got section, so idx will be zero, which means we can and should compute the address of the private descriptor ourselves. */ - if (bfd_link_executable (info) && !bfd_link_pic (info) + if (bfd_link_pde (info) && (!h || FRVFDPIC_FUNCDESC_LOCAL (info, h))) { addend += frvfdpic_got_section (info)->output_section->vma; @@ -3684,7 +3682,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, can omit the dynamic relocation as long as the symbol is defined in the current link unit (which is implied by its output section not being NULL). */ - if (bfd_link_executable (info) && !bfd_link_pic (info) + if (bfd_link_pde (info) && (!h || FRVFDPIC_SYM_LOCAL (info, h))) { if (osec) @@ -3773,7 +3771,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, /* If we've omitted the dynamic relocation, just emit the fixed addresses of the symbol and of the local GOT base offset. */ - if (bfd_link_executable (info) && !bfd_link_pic (info) + if (bfd_link_pde (info) && (!h || FRVFDPIC_SYM_LOCAL (info, h))) bfd_put_32 (output_bfd, frvfdpic_got_section (info)->output_section->vma @@ -4512,7 +4510,7 @@ _frvfdpic_count_relocs_fixups (struct frvfdpic_relocs_info *entry, { bfd_vma relocs = 0, fixups = 0, tlsrets = 0; - if (!bfd_link_executable (dinfo->info) || bfd_link_pie (dinfo->info)) + if (!bfd_link_pde (dinfo->info)) { relocs = entry->relocs32 + entry->relocsfd + entry->relocsfdv + entry->relocstlsd; diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 10d2fcb..f807e03 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -3916,7 +3916,7 @@ elf_m68k_relocate_section (bfd *output_bfd, case R_68K_TLS_LE32: case R_68K_TLS_LE16: case R_68K_TLS_LE8: - if (bfd_link_pic (info) && !bfd_link_pie (info)) + if (bfd_link_dll (info)) { (*_bfd_error_handler) (_("%B(%A+0x%lx): R_68K_TLS_LE32 relocation not permitted " diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c index fd70007..6a72f71 100644 --- a/bfd/elf32-nios2.c +++ b/bfd/elf32-nios2.c @@ -4352,7 +4352,7 @@ nios2_elf32_relocate_section (bfd *output_bfd, break; case R_NIOS2_TLS_LE16: - if (bfd_link_pic (info) && !bfd_link_pie (info)) + if (bfd_link_dll (info)) { (*_bfd_error_handler) (_("%B(%A+0x%lx): R_NIOS2_TLS_LE16 relocation not " diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 8415f1e..3f708cb 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -5204,7 +5204,7 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct ppc_elf_link_hash_table *htab; int pass; - if (bfd_link_relocatable (info) || !bfd_link_executable (info)) + if (!bfd_link_executable (info)) return TRUE; htab = ppc_elf_hash_table (info); @@ -6947,7 +6947,6 @@ ppc_elf_relax_section (bfd *abfd, optimise away the call. We won't be needing a long- branch stub in that case. */ if (bfd_link_executable (link_info) - && !bfd_link_relocatable (link_info) && h == htab->tls_get_addr && irel != internal_relocs) { diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index de37ca4..96c1531 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -3116,7 +3116,7 @@ elf_s390_relocate_section (bfd *output_bfd, break; case R_390_TLS_LE32: - if (bfd_link_pic (info) && !bfd_link_pie (info)) + if (bfd_link_dll (info)) { /* Linking a shared library with non-fpic code requires a R_390_TLS_TPOFF relocation. */ diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index 012ee4e..7b8d763 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -5440,7 +5440,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, check_segment[0] = check_segment[1] = -1; - if (! bfd_link_pic (info) || bfd_link_pie (info)) + if (!bfd_link_dll (info)) { relocation = tpoff (info, relocation); addend = rel->r_addend; @@ -6542,7 +6542,7 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, break; case R_SH_TLS_LE_32: - if (bfd_link_pic (info) && !bfd_link_pie (info)) + if (bfd_link_dll (info)) { hooks/post-receive -- Repository for Project Archer.