From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32332 invoked by alias); 15 Mar 2009 14:37:39 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 32190 invoked by uid 9674); 15 Mar 2009 14:37:36 -0000 Date: Sun, 15 Mar 2009 14:37:00 -0000 Message-ID: <20090315143736.32175.qmail@sourceware.org> From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer: Merge commit 'origin/archer-jankratochvil-type-refcount' into archer X-Git-Refname: refs/heads/archer X-Git-Reftype: branch X-Git-Oldrev: f7395c26d5216c414498cbca9be5cc1b699ae635 X-Git-Newrev: e693789fcf8112062744f2ce94ad204c0fed4bfe X-SW-Source: 2009-q1/txt/msg00330.txt.bz2 List-Id: The branch, archer has been updated via e693789fcf8112062744f2ce94ad204c0fed4bfe (commit) via 5cedbf2b8ef56739c2c9cee7b6c28144fe6fc94a (commit) via 8d67a974fccc4064d1341aeb51421b1bebf88fdf (commit) via f8c087d78fba2119fbca2cbdd7ebe7b5bef5e13b (commit) via c5b3769a48bcda01b8b20860cb4929ea067755c2 (commit) via 5a70a9240d5fb15ce57adb499caa4e46f1ea6e5d (commit) via 1cc83f114d652f8bd338b3508de5e9a6374809ae (commit) via a0c065d83c2f5640226dac5f3c0e9fcd1fea2a72 (commit) via 6802dbca9a40e83795a45c7522ddf78ff0e7b325 (commit) via 8e953a57887ee5d20be67e0c83c0c9de378ed397 (commit) via 8b9369a02e1db5691cc4c20efe0b03d2ecf839e5 (commit) via 53efdee1dbb7d3a206eccf7b4990348f73f4d555 (commit) via d8f1dba1d787988c88490dd986cd3744d3f04f72 (commit) via 00d8fe4be428570128fd3d3cf0709be51360c3d3 (commit) via abb5856b6342884318de5bf2e7541c94b1075fc7 (commit) via fce6254b4e6e24e6d2ea62167b6c10ff804ab561 (commit) via 0670c2918c269a3a4d6a8305908ac575bdddc71c (commit) via 3504ff5761600a919037d086afa494c81b732ecc (commit) via cb5bd6c598173b62b15bb37fe4776c64889f9b47 (commit) via 828ce62c8e2516f858c4fb92fd35877fa3b7ede0 (commit) via 3b1ae69818be9a470eb6e95c9856cc3392466bfe (commit) via 71224307bde0cb21bc3af6ca9ae39a185f8a816a (commit) via 6e68813bf321f963f77848af9d0bcc7f04dc1d87 (commit) via 407fab21772b11da176e67f8feb7153e0b18cf95 (commit) via d98eb9e289a591a82c08f226de1fa2a257bac603 (commit) via 2185460c34c7662b48e58cf58d8993ce0ec89773 (commit) via 34d2f40593b075375fd50292c7ca9e549b502bcb (commit) via 11b5532796e0e522baf0588943faad5eaa72e4dc (commit) via be829f1879ac3c32d0b7f7ef408282dc5001cf11 (commit) via 6cf921c12d2b7ecc2322accb2c606cbd7456eb16 (commit) via 3d4128f37bb7e6ab7be1f8cd278c387a2c4cedac (commit) via 79cd916b74e5645a8051b17119368f8b455ec450 (commit) via c19205a282d4acf4f98de51f3a9dd45746258824 (commit) via b6baa86aedd02ccc76eec7512de30fa631376f2b (commit) via 48080f8b8c6bf65f13ce51e69e8e4f1ff3279cc0 (commit) via b149ab952a09f3b31f2f9451020b145e230ac258 (commit) via d2a7ebd93f2a72dbc0d150fea57c028c9afede15 (commit) via 084662c8c30b46798cbd6f6f72715b721f6f453f (commit) via c7c22f6962e854cff5e36fcb28380456d3f5d838 (commit) via 8ff2d8e707b490a3221de434f6d3df604a904fbc (commit) via b8600f7ad24559d7038d9c4b77dd519d23f9be06 (commit) via 992629921aa36c6bf82174ef22c2a120955ecf5c (commit) via c8a81f6e8c87a17930caea048986cd815653b734 (commit) via ab6145c706bdaee3615c93409108ba74d3ba3376 (commit) via 7684a5dbf99ce138626a84f34c71e332e29b37ed (commit) via 365e0b6e20055eaad0ed22826d747a65b9a9787b (commit) via d3483556827162c6881993825366b3200713da2b (commit) via d54922f960da0062b1ab35096b7d5301f66f784d (commit) via 6955a4981a80e100e4f12b9fe44758d45f527626 (commit) via d85b4c3530d36893e40157f20989f619bf680bb9 (commit) via 40305a68cefa0975a1065654f52702b78e0f830f (commit) via 2fa50e60ad07d593c494e3940ea36bfcb6f54a37 (commit) via a12585fffd92c8336f69b93eb34b1e0f7afea9c4 (commit) via 572abd81388d29a66a41e42fa2584a0bcb6cbd2a (commit) via 9bcbaf4d3d1f08a128e5838205d28f7e9dc0382d (commit) via af404eace2d422e9ce55bbe59a5f8d803476703b (commit) via 322fc1378e70a9f5eb4ff1b980386dbc087d942b (commit) via 5473a6dd08b18061f817f784b197f44c949d2cf5 (commit) via f77a1d8078de2b302571c21dd8b20457475f4e4f (commit) from f7395c26d5216c414498cbca9be5cc1b699ae635 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit e693789fcf8112062744f2ce94ad204c0fed4bfe Merge: 5cedbf2b8ef56739c2c9cee7b6c28144fe6fc94a 8d67a974fccc4064d1341aeb51421b1bebf88fdf Author: Jan Kratochvil Date: Sun Mar 15 15:36:32 2009 +0100 Merge commit 'origin/archer-jankratochvil-type-refcount' into archer commit 5cedbf2b8ef56739c2c9cee7b6c28144fe6fc94a Merge: f7395c26d5216c414498cbca9be5cc1b699ae635 f8c087d78fba2119fbca2cbdd7ebe7b5bef5e13b Author: Jan Kratochvil Date: Sun Mar 15 15:36:18 2009 +0100 Merge commit 'origin/archer-jankratochvil-misc' into archer Conflicts: gdb/mi/mi-main.c ----------------------------------------------------------------------- Summary of changes: bfd/ChangeLog | 226 +++ bfd/bfd-in.h | 2 +- bfd/bfd-in2.h | 2 +- bfd/coff-rs6000.c | 84 +- bfd/coff64-rs6000.c | 78 +- bfd/coffcode.h | 7 +- bfd/coffgen.c | 1 + bfd/config.bfd | 4 +- bfd/configure | 2 +- bfd/configure.in | 4 +- bfd/elf-bfd.h | 7 +- bfd/elf.c | 18 +- bfd/elf32-arm.c | 14 +- bfd/elf32-spu.c | 6 +- bfd/elflink.c | 21 +- bfd/libcoff-in.h | 6 +- bfd/libcoff.h | 6 +- bfd/version.h | 2 +- bfd/xcofflink.c | 1967 +++++++++++++++----------- gdb/ChangeLog | 121 ++ gdb/ada-lang.c | 120 ++- gdb/ada-lang.h | 2 - gdb/ada-tasks.c | 34 +- gdb/darwin-nat.c | 12 +- gdb/defs.h | 2 +- gdb/doc/ChangeLog | 13 +- gdb/doc/gdb.texinfo | 75 + gdb/exceptions.c | 32 +- gdb/exceptions.h | 15 +- gdb/gdbserver/ChangeLog | 9 + gdb/gdbserver/Makefile.in | 5 +- gdb/gdbserver/hostio-errno.c | 6 +- gdb/gdbserver/hostio.c | 6 +- gdb/gdbserver/server.c | 7 + gdb/gdbserver/xtensa-xtregs.c | 2 +- gdb/mi/mi-interp.c | 1 + gdb/mi/mi-main.c | 38 +- gdb/mi/mi-main.h | 2 + gdb/remote.c | 66 +- gdb/source.c | 2 +- gdb/stack.c | 95 +-- gdb/symtab.c | 9 +- gdb/testsuite/ChangeLog | 46 +- gdb/testsuite/gdb.ada/mod_from_name.exp | 47 + gdb/testsuite/gdb.ada/mod_from_name/foo.adb | 36 + gdb/testsuite/gdb.ada/ptype_arith_binop.exp | 36 + gdb/testsuite/gdb.ada/tick_last_segv.exp | 49 + gdb/testsuite/gdb.ada/tick_last_segv/foo.adb | 19 + gdb/testsuite/gdb.base/multi-forks.exp | 121 +- gdb/testsuite/gdb.base/return-nodebug.exp | 15 +- gdb/testsuite/gdb.mi/mi-cli.exp | 38 +- gdb/version.in | 2 +- include/ChangeLog | 15 + include/coff/ChangeLog | 25 + include/coff/internal.h | 17 +- include/coff/pe.h | 11 + include/coff/xcoff.h | 25 +- 57 files changed, 2433 insertions(+), 1200 deletions(-) create mode 100644 gdb/testsuite/gdb.ada/mod_from_name.exp create mode 100644 gdb/testsuite/gdb.ada/mod_from_name/foo.adb create mode 100644 gdb/testsuite/gdb.ada/ptype_arith_binop.exp create mode 100644 gdb/testsuite/gdb.ada/tick_last_segv.exp create mode 100644 gdb/testsuite/gdb.ada/tick_last_segv/foo.adb First 500 lines of diff: diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 9841e5d..33174a3 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,229 @@ +2009-03-15 Alan Modra + + * elf32-spu.c (build_stub): Correct icache set_id. + (spu_elf_relocate_section): Likewise. + +2009-03-14 Richard Sandiford + + * xcofflink.c (xcoff_link_check_archive_element): Only free the + symbol table if it was created by the current call. + +2009-03-14 Richard Sandiford + + * xcofflink.c (xcoff_build_ldsyms): Give imported descriptors + class XMC_DS rather than XMC_UA. + +2009-03-14 Richard Sandiford + + * bfd-in.h (bfd_xcoff_size_dynamic_sections): Replace the + bfd_boolean export_defineds parameter with an unsigned int + auto_export_flags parameter. + * bfd-in2.h: Regenerate. + * xcofflink.c (xcoff_archive_contains_shared_object_p): New function, + split out from xcoff_build_ldsyms. + (xcoff_covered_by_expall_p): New function. + (xcoff_auto_export_p): New function, split out from xcoff_build_ldsyms + but with extra code to handle -bexpfull and -bexpall. + (xcoff_mark_auto_exports): New function. + (xcoff_build_ldsyms): Use xcoff_auto_export_p to decide whether + a function should be automatically exported. + (bfd_xcoff_size_dynamic_sections): Replace the export_defineds + parameter with an auto_export_flags parameter. Update ldinfo + accordingly. Use xcoff_mark_auto_exports to mark all automatically- + exported symbols. + +2009-03-14 Richard Sandiford + + * xcofflink.c (xcoff_mark_symbol_by_name): New function. + (bfd_xcoff_size_dynamic_sections): Use it to mark the entry, + init and fini functions. Do garbage collection for objects + without an entry point too. + +2009-03-14 Richard Sandiford + + * coffcode.h (coff_pointerize_aux_hook): Update CSECT_SYM_P to + check whether a symbol has csect information. + (coff_print_aux): Likewise. + * coff-rs6000.c (_bfd_xcoff_swap_aux_in): Handle auxillary csect + information for C_AIX_WEAKEXT too. + (_bfd_xcoff_swap_aux_out): Likewise. + (xcoff_reloc_type_br): Handle defweak symbols too. + * coff64-rs6000.c (_bfd_xcoff64_swap_aux_in): Handle auxillary csect + information for C_AIX_WEAKEXT too. + (_bfd_xcoff64_swap_aux_out): Likewise. + (xcoff64_reloc_type_br): Handle defweak symbols too. + * coffgen.c (coff_print_symbol): Handle auxillary function + information for C_AIX_WEAKEXT too. + * xcofflink.c (_bfd_xcoff_canonicalize_dynamic_symtab): Set BSF_WEAK + instead of BSF_GLOBAL if the L_WEAK flag is set. + (xcoff_dynamic_definition_p): New function. + (xcoff_link_add_dynamic_symbols): Use it to decide whether ldsym + defines h. Don't change h if ldsym isn't the definition. Otherwise, + always take the symbol class from the ldsym. Use weak bfd symbol + types for weak ldsyms. + (xcoff_link_add_symbols): Use CSECT_SYM_P and EXTERN_SYM_P. + Fix the check for whether a definition is from a shared object. + Allow redefinitions of weak symbols. + (xcoff_link_check_ar_symbols): Use EXTERN_SYM_P. + (xcoff_keep_symbol_p): Likewise. + (bfd_xcoff_size_dynamic_sections): Use CSECT_SYM_P. + (xcoff_link_input_bfd): Use CSECT_SYM_P and EXTERN_SYM_P. + Add .loader entries for C_AIX_WEAKEXT as well as C_EXT symbols, + but mark them as L_WEAK. + (xcoff_write_global_symbol): Treat weak symbols as C_AIX_WEAKEXT + instead of C_EXT if C_AIX_WEAKEXT == C_WEAKEXT. + +2009-03-14 Richard Sandiford + + * xcofflink.c (xcoff_mark): When walking the relocations, + only mark the target symbol or the target section, not both. + (xcoff_final_definition_p): New function. + (xcoff_keep_symbol_p): Use it to check whether an external XCOFF + symbol is a valid definition of the associated output symbol. + Use XCOFF_ALLOCATED to stop the same hash table entry having + two output symbols. + (bfd_xcoff_size_dynamic_sections): Set XCOFF_ALLOCATED when + keeping a symbol. + (xcoff_link_input_bfd): Use xcoff_final_definition_p. + +2009-03-14 Richard Sandiford + + * xcofflink.c (bfd_xcoff_import_symbol): Treat imported absolute + symbols as XMC_XO. + +2009-03-14 Richard Sandiford + + * libcoff-in.h (xcoff_tdata): Add a lineno_counts field. + * libcoff.h: Regenerate. + * xcofflink.c (xcoff_link_add_symbols): Record per-symbol + line-number counts in the bfd's lineno_counts field. + Don't keep per-csect line-number counts. + (xcoff_sweep): Don't update per-csect line-number counts. + (bfd_xcoff_size_dynamic_sections): Count the number of line-number + entries in each output section. + (xcoff_link_input_bfd): Get the number of line numbers from + the bfd's lineno_counts field, rather than recalculating it + from scratch. Fix the range check when updating C_BINCL and + C_EINCL symbols. + (_bfd_xcoff_bfd_final_link): Don't count the output line numbers + here. Don't expect csects to have line-number counts. + +2009-03-14 Richard Sandiford + + * libcoff-in.h (xcoff_tdata): Change debug_indices to a signed long. + * libcoff.h: Regenerate. + * xcofflink.c (xcoff_keep_symbol_p): New function, using the + "skip" logic from xcoff_link_input_bfd. + (bfd_xcoff_size_dynamic_sections): Explicitly skip dynamic + objects in a dynamic link, rather than checking whether csectpp + is null. Always allocate debug_index for other objects, + and always go through the loop. Update the type of debug_index + after the change above. Read the auxillary csect information + and use xcoff_keep_symbol_p to decide whether a symbol should + be kept. Set its debug_index to -2 if not. + (xcoff_link_input_bfd): Update the type of debug_index after + the change above and always expect it to be nonnull. Use it to + test whether a symbol should be stripped, rather than making the + decision here. Postpone all symbol creation to the second pass. + +2009-03-14 Richard Sandiford + + * xcofflink.c: (xcoff_mark_symbol): Mark the TOC section when + creating a descriptor. + (xcoff_sweep): Don't mark toc_section unless it's needed. + (bfd_xcoff_size_dynamic_sections): Skip the toc_section + when marking every bfd. + (xcoff_link_input_bfd): Skip all TOC anchors. + (xcoff_toc_section_p, xcoff_find_tc0): New functions. + (_bfd_xcoff_bfd_final_link): Don't set the output bfd's TOC anchor + to -1; call xcoff_find_tc0 instead. + +2009-03-14 Richard Sandiford + + * libcoff-in.h (xcoff_section_tdata): Update commentary. + * libcoff.h: Regenerate. + * xcofflink.c (xcoff_link_add_symbols): Set the csect of XTY_ER + symbols to bfd_und_section_ptr or bfd_abs_section_ptr, rather than + the previous symbol's csect. Treat last_symndx as an inclusive value + and simplify its handling. + (xcoff_mark): Treat last_symndx as an inclusive value. Only mark + symbols with the right csect. Don't mark rsec when processing + relocations against undefined or absolute sections. + (bfd_xcoff_size_dynamic_sections): Don't check the SEC_MARK flag + of bfd_und_section_ptr. + (xcoff_link_input_bfd): Likewise. + +2009-03-14 Richard Sandiford + + * coff-rs6000.c (xcoff_ppc_relocate_section): Report relocations + against undefined symbols if the symbol's XCOFF_WAS_UNDEFINED + flag is set. Assert that all undefined symbols are either + imported or defined by a dynamic object. + * coff64-rs6000.c (xcoff64_ppc_relocate_section): Likewise. + * xcofflink.c (xcoff_link_add_symbols): Extend function-symbol + handling to all relocations. Only set XCOFF_CALLED for function + symbols. + (xcoff_find_function): New function, split out from... + (bfd_xcoff_export_symbol) ...here. + (xcoff_set_import_path): New function, split out from... + (bfd_xcoff_import_symbol): ...here. Remove assertion for old + meaning of XCOFF_CALLED. + (xcoff_mark_symbol): If we mark an undefined and unimported + symbol, find some way of defining it. If the symbol is a function + descriptor, fill in its definition automatically. If the symbol + is a function, mark its descriptor and allocate room for global + linkage code. Otherwise mark the symbol as implicitly imported. + Move the code for creating function descriptors from... + (xcoff_build_ldsyms): ...here. Use XCOFF_WAS_UNDEFINED to + check for symbols that were implicitly defined. + (xcoff_mark): Don't count any dynamic relocations against + function symbols. + (bfd_xcoff_size_dynamic_sections): Save the rtld parameter + in the xcoff link info. + (xcoff_link_input_bfd): Remove handling of undefined and + unexported symbols. + +2009-03-14 Richard Sandiford + + * coff-rs6000.c (xcoff_reloc_type_br): Make the branch absolute + if the target is absolute. Fix comment typo. + (xcoff_ppc_relocate_section): Remove FIXME. + * coff64-rs6000.c (xcoff64_reloc_type_br): Make the branch absolute + if the target is absolute. + +2009-03-14 Richard Sandiford + + * xcofflink.c (xcoff_mark, xcoff_link_input_bfd): Don't copy + R_POS and R_NEG relocations against absolute symbols to the + .loader section. + +2009-03-14 Richard Sandiford + + * coff64-rs6000.c (xcoff64_write_object_contents): Set the cputype + to 2 for bfd_mach_ppc_620. + +2009-03-14 Richard Sandiford + + * config.bfd: Treat AIX 6+ in the same way as AIX 5. + * configure.in: Likewise. + * configure: Regenerate. + +2009-03-13 H.J. Lu + + PR binutils/9945 + * elf.c (assign_section_numbers): Generate symbol table if there + is any relocation in output. + (_bfd_elf_compute_section_file_positions): Likewise. + +2009-03-13 Nick Clifton + + PR 9934 + * elf-bfd.h (NUM_SHDR_ENTRIES): Cope with an empty section. + * elflink.c (elf_link_read_relocs_from_section): Use + NUM_SHDR_ENTRIES. Gracefully handle the case where there are + relocs but no symbol table. + * elf32-arm.c (elf32_arm_check_relocs): Likewise. + 2009-03-12 H.J. Lu PR ld/9938 diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 6b49013..5a3e13f 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -779,7 +779,7 @@ extern bfd_boolean bfd_xcoff_record_link_assignment extern bfd_boolean bfd_xcoff_size_dynamic_sections (bfd *, struct bfd_link_info *, const char *, const char *, unsigned long, unsigned long, unsigned long, bfd_boolean, - int, bfd_boolean, bfd_boolean, struct bfd_section **, bfd_boolean); + int, bfd_boolean, unsigned int, struct bfd_section **, bfd_boolean); extern bfd_boolean bfd_xcoff_link_generate_rtinit (bfd *, const char *, const char *, bfd_boolean); diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 7e3defd..a173f56 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -786,7 +786,7 @@ extern bfd_boolean bfd_xcoff_record_link_assignment extern bfd_boolean bfd_xcoff_size_dynamic_sections (bfd *, struct bfd_link_info *, const char *, const char *, unsigned long, unsigned long, unsigned long, bfd_boolean, - int, bfd_boolean, bfd_boolean, struct bfd_section **, bfd_boolean); + int, bfd_boolean, unsigned int, struct bfd_section **, bfd_boolean); extern bfd_boolean bfd_xcoff_link_generate_rtinit (bfd *, const char *, const char *, bfd_boolean); diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index 1db66e7..3343530 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -422,6 +422,7 @@ _bfd_xcoff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1) /* RS/6000 "csect" auxents */ case C_EXT: + case C_AIX_WEAKEXT: case C_HIDEXT: if (indx + 1 == numaux) { @@ -531,6 +532,7 @@ _bfd_xcoff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp) /* RS/6000 "csect" auxents */ case C_EXT: + case C_AIX_WEAKEXT: case C_HIDEXT: if (indx + 1 == numaux) { @@ -2947,11 +2949,13 @@ xcoff_reloc_type_br (input_bfd, input_section, output_bfd, rel, sym, howto, bfd_byte *contents; { struct xcoff_link_hash_entry *h; + bfd_vma section_offset; if (0 > rel->r_symndx) return FALSE; h = obj_xcoff_sym_hashes (input_bfd)[rel->r_symndx]; + section_offset = rel->r_vaddr - input_section->vma; /* If we see an R_BR or R_RBR reloc which is jumping to global linkage code, and it is followed by an appropriate cror nop @@ -2961,13 +2965,14 @@ xcoff_reloc_type_br (input_bfd, input_section, output_bfd, rel, sym, howto, going to global linkage code, we can replace the load with a cror. */ if (NULL != h - && bfd_link_hash_defined == h->root.type - && rel->r_vaddr - input_section->vma + 8 <= input_section->size) + && (bfd_link_hash_defined == h->root.type + || bfd_link_hash_defweak == h->root.type) + && section_offset + 8 <= input_section->size) { bfd_byte *pnext; unsigned long next; - pnext = contents + (rel->r_vaddr - input_section->vma) + 4; + pnext = contents + section_offset + 4; next = bfd_get_32 (input_bfd, pnext); /* The _ptrgl function is magic. It is used by the AIX @@ -2977,12 +2982,12 @@ xcoff_reloc_type_br (input_bfd, input_section, output_bfd, rel, sym, howto, if (next == 0x4def7b82 /* cror 15,15,15 */ || next == 0x4ffffb82 /* cror 31,31,31 */ || next == 0x60000000) /* ori r0,r0,0 */ - bfd_put_32 (input_bfd, 0x80410014, pnext); /* lwz r1,20(r1) */ + bfd_put_32 (input_bfd, 0x80410014, pnext); /* lwz r2,20(r1) */ } else { - if (next == 0x80410014) /* lwz r1,20(r1) */ + if (next == 0x80410014) /* lwz r2,20(r1) */ bfd_put_32 (input_bfd, 0x60000000, pnext); /* ori r0,r0,0 */ } } @@ -2998,16 +3003,42 @@ xcoff_reloc_type_br (input_bfd, input_section, output_bfd, rel, sym, howto, howto->complain_on_overflow = complain_overflow_dont; } - howto->pc_relative = TRUE; + /* The original PC-relative relocation is biased by -r_vaddr, so adding + the value below will give the absolute target address. */ + *relocation = val + addend + rel->r_vaddr; + howto->src_mask &= ~3; howto->dst_mask = howto->src_mask; - /* A PC relative reloc includes the section address. */ - addend += input_section->vma; - - *relocation = val + addend; - *relocation -= (input_section->output_section->vma - + input_section->output_offset); + if (h != NULL + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && bfd_is_abs_section (h->root.u.def.section) + && section_offset + 4 <= input_section->size) + { + bfd_byte *ptr; + bfd_vma insn; + + /* Turn the relative branch into an absolute one by setting the + AA bit. */ + ptr = contents + section_offset; + insn = bfd_get_32 (input_bfd, ptr); + insn |= 2; + bfd_put_32 (input_bfd, insn, ptr); + + /* Make the howto absolute too. */ + howto->pc_relative = FALSE; + howto->complain_on_overflow = complain_overflow_bitfield; + } + else + { + /* Use a PC-relative howto and subtract the instruction's address + from the target address we calculated above. */ + howto->pc_relative = TRUE; + *relocation -= (input_section->output_section->vma + + input_section->output_offset + + section_offset); + } return TRUE; } @@ -3323,9 +3354,7 @@ xcoff_complain_overflow_unsigned_func (input_bfd, val, relocation, howto) R_RBR: A relative branch which may be modified to become an - absolute branch. FIXME: We don't implement this, - although we should for symbols of storage mapping class - XMC_XO. + absolute branch. R_RL: The PowerPC AIX ABI describes this as a load which may be @@ -3422,6 +3451,17 @@ xcoff_ppc_relocate_section (output_bfd, info, input_bfd, } else { + if (info->unresolved_syms_in_objects != RM_IGNORE + && (h->flags & XCOFF_WAS_UNDEFINED) != 0) + { + if (! ((*info->callbacks->undefined_symbol) + (info, h->root.root.string, + input_bfd, input_section, + rel->r_vaddr - input_section->vma, + (info->unresolved_syms_in_objects + == RM_GENERATE_ERROR)))) + return FALSE; + } if (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) { @@ -3437,17 +3477,11 @@ xcoff_ppc_relocate_section (output_bfd, info, input_bfd, + sec->output_offset); } - else if ((0 == (h->flags & (XCOFF_DEF_DYNAMIC | XCOFF_IMPORT))) - && ! info->relocatable) + else { - if (! ((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, input_section, - rel->r_vaddr - input_section->vma, TRUE))) - return FALSE; - - /* Don't try to process the reloc. It can't help, and - it may generate another error. */ - continue; + BFD_ASSERT (info->relocatable + || (h->flags & XCOFF_DEF_DYNAMIC) != 0 + || (h->flags & XCOFF_IMPORT) != 0); } } } diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c index 776b6a2..1a0ff59 100644 --- a/bfd/coff64-rs6000.c +++ b/bfd/coff64-rs6000.c @@ -381,6 +381,7 @@ _bfd_xcoff64_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1) /* RS/6000 "csect" auxents */ case C_EXT: + case C_AIX_WEAKEXT: case C_HIDEXT: if (indx + 1 == numaux) { @@ -473,6 +474,7 @@ _bfd_xcoff64_swap_aux_out (abfd, inp, type, class, indx, numaux, extp) /* RS/6000 "csect" auxents */ case C_EXT: + case C_AIX_WEAKEXT: case C_HIDEXT: if (indx + 1 == numaux) { @@ -1048,6 +1050,8 @@ xcoff64_write_object_contents (abfd) case bfd_arch_powerpc: if (bfd_get_mach (abfd) == bfd_mach_ppc) internal_a.o_cputype = 3; + else if (bfd_get_mach (abfd) == bfd_mach_ppc_620) + internal_a.o_cputype = 2; else internal_a.o_cputype = 1; break; @@ -1115,11 +1119,13 @@ xcoff64_reloc_type_br (input_bfd, input_section, output_bfd, rel, sym, howto, bfd_byte *contents; { struct xcoff_link_hash_entry *h; + bfd_vma section_offset; if (0 > rel->r_symndx) return FALSE; h = obj_xcoff_sym_hashes (input_bfd)[rel->r_symndx]; + section_offset = rel->r_vaddr - input_section->vma; /* If we see an R_BR or R_RBR reloc which is jumping to global linkage code, and it is followed by an appropriate cror nop @@ -1129,13 +1135,14 @@ xcoff64_reloc_type_br (input_bfd, input_section, output_bfd, rel, sym, howto, going to global linkage code, we can replace the load with a cror. */ if (NULL != h - && bfd_link_hash_defined == h->root.type - && rel->r_vaddr - input_section->vma + 8 <= input_section->size) + && (bfd_link_hash_defined == h->root.type + || bfd_link_hash_defweak == h->root.type) + && section_offset + 8 <= input_section->size) { bfd_byte *pnext; unsigned long next; - pnext = contents + (rel->r_vaddr - input_section->vma) + 4; + pnext = contents + section_offset + 4; next = bfd_get_32 (input_bfd, pnext); /* The _ptrgl function is magic. It is used by the AIX compiler to call @@ -1164,16 +1171,42 @@ xcoff64_reloc_type_br (input_bfd, input_section, output_bfd, rel, sym, howto, howto->complain_on_overflow = complain_overflow_dont; } - howto->pc_relative = TRUE; + /* The original PC-relative relocation is biased by -r_vaddr, so adding + the value below will give the absolute target address. */ + *relocation = val + addend + rel->r_vaddr; + howto->src_mask &= ~3; howto->dst_mask = howto->src_mask; hooks/post-receive -- Repository for Project Archer.