From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24229 invoked by alias); 11 Nov 2008 18:33:12 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 23916 invoked by uid 9782); 11 Nov 2008 18:33:07 -0000 Date: Tue, 11 Nov 2008 18:33:00 -0000 Message-ID: <20081111183307.23886.qmail@sourceware.org> From: sergio@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer-sergio-catch-syscall: Merge commit 'gdb/master' into catch-syscall X-Git-Refname: refs/heads/archer-sergio-catch-syscall X-Git-Reftype: branch X-Git-Oldrev: 0556ccec219d1ee71dd00fc437752571e6c2ddb3 X-Git-Newrev: 95b1172ca749910802eb3953ec518be218ac49e9 X-SW-Source: 2008-q4/txt/msg00092.txt.bz2 List-Id: The branch, archer-sergio-catch-syscall has been updated via 95b1172ca749910802eb3953ec518be218ac49e9 (commit) via 1d82da27ebbab15fe196e4842a9777b20fb34cd8 (commit) via 470a797af9ea10307ee82dcc17fe9e15bef92fa6 (commit) via bd7b05d7c05dc9ad6063f1113b84a8a22189f468 (commit) via 0837a3180f4be8a06b4a230e084e675b1f769788 (commit) via 539c9e528476b11d53e0c7e543a5a713a1721e96 (commit) via da7fd212a824daf426dd08d07d97630a2a03764e (commit) via 5fc1efeb3cf158f711ea78785b377942fa7efc92 (commit) via fc954e97743419bc15e69461fed5fc4b7d7061e3 (commit) via 83cf5b6e62f3c84dca7534bc7078e3ed7ab81986 (commit) via 2301d0cb9d31763ca28460c9fecc308120149c0a (commit) via fbdc18c6fdc2c2242759db89754880e8e1c2dc3a (commit) via b32a10dff8f05d23a236fb9e6218cdcaa4882d43 (commit) via 67259e81f777345c0a57fa1a658cbe76a38074cc (commit) via 9a61fea6bb6688fd79be98a3d0a762920c6f82f8 (commit) via 1a17e40731a1c5cb5bd1f38188c8ee5d7358144a (commit) via 6cef41d170a541a1a0ecd3b4a3fd6604b17441ab (commit) via 8c15bd9c35810bd13f3cf76778921c2720381b82 (commit) via 6d937320fa6b4c6bab9fecddad029d1154f3ce57 (commit) via a3786d5b56b9e490fcb222534600de3290b32573 (commit) via 3ed2b5519dd59243afc2e0247fb1bf2fadccf782 (commit) via 34d9a4be735089aff39c0815af785394dc822afa (commit) via a662a231e16ecb97b865e0d13a9f2932abdc0a1e (commit) via 502caf701374df2ef550841611071c343740031e (commit) via b4e87467e67a27ad839b4c4a9755804dd8c5003a (commit) via 48ceb8d63c54946f3f4d8d3758103c1f7eb5e614 (commit) via 6bb8939b7104369c8831d1bbd4a78ee986a9ee93 (commit) via 1b4ed564885ab95429ffdfc1d07c849ae6f0347d (commit) via a1b562fc7b79b7352825cad336b424c3193c4583 (commit) via d297acb5d793f7b228a638296cbdf28df13ba27b (commit) via 4e87deb1b2bbb9446d99c446ebe092ca9d343ded (commit) via 842a1248c74850a500ab465479dfd1c7b4571b6a (commit) via 910d63a50e403ea202f85b8b94d2e65980b1f86a (commit) via b9dca975b7d7ea2dfb6298e1cd965119eddd5291 (commit) via b30d4db9c6c02926e2d7c1277a20ea4157947dca (commit) via 3ac2a75a00cb17265fe90f06a0a42a97b3d041ee (commit) via 583e12aaa9c8dc9101a638732d6674ddf56bc9bd (commit) via d1d203e291e074141bd005494ff3914847ab9633 (commit) via 8097dfdc83d8f6571913bb1defc63399f94a976e (commit) via 227a0cb2d3e6cd768f4a64f39ead8dd36561af4d (commit) via c8021417b9c425dd1450654df84273497dfbb301 (commit) from 0556ccec219d1ee71dd00fc437752571e6c2ddb3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 95b1172ca749910802eb3953ec518be218ac49e9 Merge: 1d82da27ebbab15fe196e4842a9777b20fb34cd8 470a797af9ea10307ee82dcc17fe9e15bef92fa6 Author: Sergio Durigan Junior Date: Tue Nov 11 10:30:05 2008 -0800 Merge commit 'gdb/master' into catch-syscall commit 1d82da27ebbab15fe196e4842a9777b20fb34cd8 Author: Sergio Durigan Junior Date: Tue Nov 11 10:29:57 2008 -0800 Separate functions in linux-tdep.c. Also started to fixing things for the new version of the patch. commit 470a797af9ea10307ee82dcc17fe9e15bef92fa6 Author: Alan Modra Date: Tue Nov 11 04:26:13 2008 +0000 * elf.c (assign_file_positions_for_non_load_sections): Consolidate PT_GNU_RELRO handling. commit bd7b05d7c05dc9ad6063f1113b84a8a22189f468 Author: Doug Evans Date: Tue Nov 11 01:23:34 2008 +0000 * lib/gdb.exp (GDBFLAGS): Move -nx ... (INTERNAL_GDBFLAGS): ... to here. Move -nw to here as well. (default_gdb_version): Add $INTERNAL_GDBFLAGS to gdb invocations. (default_gdb_start,default_gdb_exit): Ditto. * lib/mi-support.exp (default_mi_gdb_start): Ditto. (mi_uncatched_gdb_exit): Add $INTERNAL_GDBFLAGS to log message. * gdb.base/corefile.exp: Add $INTERNAL_GDBFLAGS to gdb invocations. * gdb.base/dbx.exp (dbx_gdb_start): Ditto. * gdb.base/args.exp (GDBFLAGS): Don't overwrite, append. * gdb.base/remotetimeout.exp (GDBFLAGS): Ditto. commit 0837a3180f4be8a06b4a230e084e675b1f769788 Author: gdbadmin Date: Tue Nov 11 00:00:03 2008 +0000 *** empty log message *** commit 539c9e528476b11d53e0c7e543a5a713a1721e96 Author: Alan Modra Date: Mon Nov 10 23:59:04 2008 +0000 daily update commit da7fd212a824daf426dd08d07d97630a2a03764e Author: Alan Modra Date: Mon Nov 10 23:39:19 2008 +0000 PR 7012 * dwarf2.c (find_line): Don't keep stale pointers into realloc'd memory. Return on errors. Fix memory leak. (_bfd_dwarf2_cleanup_debug_info): Free dwarf_str_buffer. commit 5fc1efeb3cf158f711ea78785b377942fa7efc92 Author: Andreas Schwab Date: Mon Nov 10 22:47:58 2008 +0000 PR 7011 * elf.c (assign_file_positions_for_non_load_sections): Handle PT_GNU_RELRO specially. commit fc954e97743419bc15e69461fed5fc4b7d7061e3 Author: Tom Tromey Date: Mon Nov 10 20:53:43 2008 +0000 * gdbtypes.c (copy_type_recursive): Clear new fields. commit 83cf5b6e62f3c84dca7534bc7078e3ed7ab81986 Author: Tom Tromey Date: Mon Nov 10 20:38:24 2008 +0000 * cli/cli-cmds.c (source_script): Clean up full_pathname. Run cleanups on early return. commit 2301d0cb9d31763ca28460c9fecc308120149c0a Merge: 0556ccec219d1ee71dd00fc437752571e6c2ddb3 fbdc18c6fdc2c2242759db89754880e8e1c2dc3a Author: Sergio Durigan Junior Date: Mon Nov 10 07:43:32 2008 -0800 Merge branch 'master' into catch-syscall ----------------------------------------------------------------------- Summary of changes: bfd/ChangeLog | 89 ++++++ bfd/bfdio.c | 25 ++- bfd/config.bfd | 2 +- bfd/config.in | 3 + bfd/configure | 3 +- bfd/configure.in | 2 +- bfd/dwarf2.c | 69 +++--- bfd/elf.c | 145 +++++------ bfd/mach-o-target.c | 10 +- bfd/mach-o.c | 444 +++++++++++++++++++++++------- bfd/mach-o.h | 94 +++++-- bfd/version.h | 2 +- gdb/ChangeLog | 120 ++++++++- gdb/Makefile.in | 30 ++- gdb/aix-thread.c | 12 +- gdb/breakpoint.c | 14 +- gdb/bsd-uthread.c | 5 +- gdb/cli/cli-cmds.c | 6 +- gdb/coffread.c | 2 +- gdb/completer.c | 4 +- gdb/configure | 7 +- gdb/configure.ac | 8 +- gdb/corefile.c | 2 +- gdb/corelow.c | 6 +- gdb/dec-thread.c | 4 +- gdb/defs.h | 12 + gdb/eval.c | 2 + gdb/fork-child.c | 6 +- gdb/gdbarch.c | 59 +++-- gdb/gdbarch.h | 16 +- gdb/gdbarch.sh | 8 +- gdb/gdbthread.h | 7 - gdb/gdbtypes.c | 1 + gdb/gnu-nat.c | 9 +- gdb/go32-nat.c | 11 +- gdb/hpux-thread.c | 17 +- gdb/i386-dicos-tdep.c | 4 + gdb/i386-linux-tdep.c | 8 +- gdb/inf-loop.c | 11 +- gdb/inf-ptrace.c | 44 ++-- gdb/inf-ttrace.c | 10 +- gdb/infcmd.c | 5 +- gdb/inferior.c | 1 + gdb/inferior.h | 11 +- gdb/infrun.c | 13 +- gdb/linux-nat.c | 22 +- gdb/linux-nat.h | 7 + gdb/linux-thread-db.c | 10 +- gdb/monitor.c | 8 +- gdb/nto-procfs.c | 10 +- gdb/ppc-linux-tdep.c | 76 +----- gdb/procfs.c | 19 +- gdb/remote-m32r-sdi.c | 7 +- gdb/remote-mips.c | 4 +- gdb/remote-sim.c | 4 +- gdb/remote.c | 60 ++-- gdb/rs6000-nat.c | 9 +- gdb/sol-thread.c | 22 +- gdb/target.c | 114 ++++++-- gdb/target.h | 25 +- gdb/testsuite/ChangeLog | 13 + gdb/testsuite/gdb.base/args.exp | 11 +- gdb/testsuite/gdb.base/corefile.exp | 13 +- gdb/testsuite/gdb.base/dbx.exp | 6 +- gdb/testsuite/gdb.base/remotetimeout.exp | 2 +- gdb/testsuite/lib/gdb.exp | 28 ++- gdb/testsuite/lib/mi-support.exp | 10 +- gdb/thread.c | 19 +- gdb/utils.c | 53 ++++ gdb/version.in | 2 +- gdb/win32-nat.c | 10 +- include/opcode/ChangeLog | 4 + include/opcode/mips.h | 3 +- opcodes/ChangeLog | 12 + opcodes/avr-dis.c | 10 +- opcodes/mips-dis.c | 1 + opcodes/mips-opc.c | 9 +- 77 files changed, 1335 insertions(+), 631 deletions(-) First 500 lines of diff: diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 9a70d7d..c539cf7 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,92 @@ +2008-11-11 Alan Modra + + * elf.c (assign_file_positions_for_non_load_sections): Consolidate + PT_GNU_RELRO handling. + +2008-11-11 Alan Modra + + PR 7012 + * dwarf2.c (find_line): Don't keep stale pointers into realloc'd + memory. Return on errors. Fix memory leak. + (_bfd_dwarf2_cleanup_debug_info): Free dwarf_str_buffer. + +2008-11-10 Andreas Schwab + + PR 7011 + * elf.c (assign_file_positions_for_non_load_sections): Handle + PT_GNU_RELRO specially. + +2008-11-06 Joel Sherrill + + * config.bfd: Add m32c-*-rtems* and m32r-*-rtems*. + +2008-11-06 Tom Tromey + + * configure, config.in: Rebuild. + * configure.in: Check for fileno. + * bfdio.c (close_on_exec): New function. + (real_fopen): Use it. + (FD_CLOEXEC): New define. + +2008-11-06 Tristan Gingold + + * mach-o.h (BFD_MACH_O_NO_SECT): Add; reorders the macros. + (BFD_MACH_O_SYM_NTYPE, BFD_MACH_O_SYM_NSECT, + BFD_MACH_O_SYM_NDESC): New macros. + (bfd_mach_o_i386_thread_flavour): Define according to the latest + definition from system header. + (bfd_mach_o_load_command_type): Add BFD_MACH_O_LC_RPATH, + BFD_MACH_O_LC_CODE_SIGNATURE. + (BFD_MACH_O_SECTION_TYPE_MASK, BFD_MACH_O_SECTION_ATTRIBUTES_MASK, + BFD_MACH_O_SECTION_ATTRIBUTES_SYS, BFD_MACH_O_SECTION_ATTRIBUTES_USR, + BFD_MACH_O_S_ATTR_LOC_RELOC, BFD_MACH_O_S_ATTR_EXT_RELOC, + BFD_MACH_O_S_ATTR_SOME_INSTRUCTIONS, BFD_MACH_O_S_ATTR_DEBUG, + BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS): Add. + (bfd_mach_o_segment_command): Add room for a nul terminator in + segname field. + (BFD_MACH_O_PROT_READ, BFD_MACH_O_PROT_WRITE, + BFD_MACH_O_PROT_EXECUTE): Add. + (INDIRECT_SYMBOL_LOCAL): Renames to BFD_MACH_O_INDIRECT_SYMBOL_LOCAL. + (INDIRECT_SYMBOL_ABS): Renames to BFD_MACH_O_INDIRECT_SYMBOL_ABS. + (bfd_mach_o_uuid_command): Add the structure. + (bfd_mach_o_load_command): Add uuid field. + (bfd_get_mach_o_data): New macro. + * mach-o.c (bfd_mach_o_bfd_print_private_bfd_data): New function which + replaces the macro. + (SECTION_TYPE, SECTION_ATTRIBUTES, SECTION_ATTRIBUTES_USR, + S_ATTR_PURE_INSTRUCTIONS, SECTION_ATTRIBUTES_SYS, + S_ATTR_SOME_INSTRUCTIONS, S_ATTR_EXT_RELOC, S_ATTR_LOC_RELOC): Renamed + and moved to mach-o.h. + (N_STAB, N_TYPE, N_EXT, N_UNDF, N_ABS, N_TEXT, N_DATA, N_BSS, + N_SECT, N_INDR): Removed as they duplicated macros in mach-o.h. + (bfd_mach_o_print_symbol): Print much more details. + (bfd_mach_o_make_bfd_section): Add prot argument, use canonical + dwarf name for dwarf sections. Precisely set section flags. + (bfd_mach_o_scan_read_section_32): Add prot argument. + (bfd_mach_o_scan_read_section_64): Ditto. + (bfd_mach_o_scan_read_section): Ditto. + (bfd_mach_o_scan_read_symtab_symbol): Set section for debugging + stabs, set BSF_GLOBAL and LOCAL flags correctly. Fix section + for N_SECT symbols. + (bfd_mach_o_i386_flavour_string): Reindent and adjust for new + names. + (bfd_mach_o_scan_read_symtab): Set HAS_SYMS flags on bfd if there + are symbols. + (bfd_mach_o_scan_read_uuid): New function. + (bfd_mach_o_scan_read_segment): Add a trailing nul. Segments + flags are now simply HAS_CONTENTS. Pass protection to + bfd_mach_o_scan_read_section. + (bfd_mach_o_scan_read_command): Decode UUID command. + (bfd_mach_o_flatten_sections): Add comments. Fix flavour names. + (bfd_mach_o_scan): Set flags according to file type. + (mach_o_fat_archentry): Remove abfd field. + (bfd_mach_o_archive_p): Remove initialization of abfd field. + (bfd_mach_o_openr_next_archived_file): Find previous archive + by position and not by bfd (as former bfds may have been freed). + Give architecture name to archived file. + * mach-o-target.c (TARGET_NAME): Use generic archive for non fat + targets. + 2008-10-30 Jay Krell * cache.c (cache_bread): Cast void * pointer before performing diff --git a/bfd/bfdio.c b/bfd/bfdio.c index d8aa1de..cb06453 100644 --- a/bfd/bfdio.c +++ b/bfd/bfdio.c @@ -38,6 +38,10 @@ #define S_IXOTH 0001 /* Execute by others. */ #endif +#ifndef FD_CLOEXEC +#define FD_CLOEXEC 1 +#endif + file_ptr real_ftell (FILE *file) { @@ -62,13 +66,30 @@ real_fseek (FILE *file, file_ptr offset, int whence) #endif } +/* Mark FILE as close-on-exec. Return FILE. FILE may be NULL, in + which case nothing is done. */ +static FILE * +close_on_exec (FILE *file) +{ +#if defined (HAVE_FILENO) && defined (F_GETFD) + if (file) + { + int fd = fileno (file); + int old = fcntl (fd, F_GETFD, 0); + if (old >= 0) + fcntl (fd, F_SETFD, old | FD_CLOEXEC); + } +#endif + return file; +} + FILE * real_fopen (const char *filename, const char *modes) { #if defined (HAVE_FOPEN64) - return fopen64 (filename, modes); + return close_on_exec (fopen64 (filename, modes)); #else - return fopen (filename, modes); + return close_on_exec (fopen (filename, modes)); #endif } diff --git a/bfd/config.bfd b/bfd/config.bfd index 9309502..1bc971d 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -721,7 +721,7 @@ case "${targ}" in targ_defvec=bfd_elf32_iq2000_vec ;; - m32c-*-elf) + m32c-*-elf | m32c-*-rtems*) targ_defvec=bfd_elf32_m32c_vec ;; diff --git a/bfd/config.in b/bfd/config.in index f15e4ff..d1797ae 100644 --- a/bfd/config.in +++ b/bfd/config.in @@ -78,6 +78,9 @@ /* Define to 1 if you have the `fdopen' function. */ #undef HAVE_FDOPEN +/* Define to 1 if you have the `fileno' function. */ +#undef HAVE_FILENO + /* Define to 1 if you have the `fopen64' function. */ #undef HAVE_FOPEN64 diff --git a/bfd/configure b/bfd/configure index 84ba0f6..5cd7e77 100755 --- a/bfd/configure +++ b/bfd/configure @@ -17553,7 +17553,8 @@ fi -for ac_func in fcntl getpagesize setitimer sysconf fdopen getuid getgid + +for ac_func in fcntl getpagesize setitimer sysconf fdopen getuid getgid fileno do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 diff --git a/bfd/configure.in b/bfd/configure.in index 72cefbc..bcc4615 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -179,7 +179,7 @@ GCC_HEADER_STDINT(bfd_stdint.h) AC_HEADER_TIME AC_HEADER_DIRENT ACX_HEADER_STRING -AC_CHECK_FUNCS(fcntl getpagesize setitimer sysconf fdopen getuid getgid) +AC_CHECK_FUNCS(fcntl getpagesize setitimer sysconf fdopen getuid getgid fileno) AC_CHECK_FUNCS(strtoull) AC_CHECK_DECLS(basename) diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index a4918ac..b53a5d4 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -2989,8 +2989,6 @@ find_line (bfd *abfd, symbols, 0, &stash->info_ptr_memory, &total_size)) goto done; - stash->info_ptr = stash->info_ptr_memory; - stash->info_ptr_end = stash->info_ptr + total_size; } else { @@ -3008,63 +3006,64 @@ find_line (bfd *abfd, if (stash->info_ptr_memory == NULL) goto done; - stash->info_ptr = stash->info_ptr_memory; - stash->info_ptr_end = stash->info_ptr; - + total_size = 0; for (msec = find_debug_info (debug_bfd, NULL); msec; msec = find_debug_info (debug_bfd, msec)) { bfd_size_type size; - bfd_size_type start; size = msec->size; if (size == 0) continue; - start = stash->info_ptr_end - stash->info_ptr; - - if ((bfd_simple_get_relocated_section_contents - (debug_bfd, msec, stash->info_ptr + start, symbols)) - == NULL) - continue; + if (!(bfd_simple_get_relocated_section_contents + (debug_bfd, msec, stash->info_ptr_memory + total_size, + symbols))) + goto done; - stash->info_ptr_end = stash->info_ptr + start + size; + total_size += size; } - - BFD_ASSERT (stash->info_ptr_end == stash->info_ptr + total_size); } else { /* Case 3: multiple sections, some or all compressed. */ - stash->info_ptr_memory = bfd_malloc (1); - stash->info_ptr = stash->info_ptr_memory; - stash->info_ptr_end = stash->info_ptr; + stash->info_ptr_memory = NULL; + total_size = 0; for (msec = find_debug_info (debug_bfd, NULL); msec; msec = find_debug_info (debug_bfd, msec)) { bfd_size_type size = msec->size; - bfd_byte* buffer - = (bfd_simple_get_relocated_section_contents - (debug_bfd, msec, NULL, symbols)); - if (! buffer) + bfd_byte* buffer; + + if (size == 0) continue; + + buffer = (bfd_simple_get_relocated_section_contents + (debug_bfd, msec, NULL, symbols)); + if (! buffer) + goto done; + if (strcmp (msec->name, DWARF2_COMPRESSED_DEBUG_INFO) == 0) { if (! bfd_uncompress_section_contents (&buffer, &size)) - continue; + { + free (buffer); + goto done; + } } - stash->info_ptr = bfd_realloc (stash->info_ptr, - stash->info_ptr_end - - stash->info_ptr + size); - memcpy (stash->info_ptr_end, buffer, size); + stash->info_ptr_memory = bfd_realloc (stash->info_ptr_memory, + total_size + size); + memcpy (stash->info_ptr_memory + total_size, buffer, size); free (buffer); - stash->info_ptr_end += size; + total_size += size; } } } + stash->info_ptr = stash->info_ptr_memory; + stash->info_ptr_end = stash->info_ptr + total_size; stash->sec = find_debug_info (debug_bfd, NULL); stash->sec_info_ptr = stash->info_ptr; stash->syms = symbols; @@ -3364,8 +3363,14 @@ _bfd_dwarf2_cleanup_debug_info (bfd *abfd) } } - free (stash->dwarf_abbrev_buffer); - free (stash->dwarf_line_buffer); - free (stash->dwarf_ranges_buffer); - free (stash->info_ptr_memory); + if (stash->dwarf_abbrev_buffer) + free (stash->dwarf_abbrev_buffer); + if (stash->dwarf_line_buffer) + free (stash->dwarf_line_buffer); + if (stash->dwarf_str_buffer) + free (stash->dwarf_str_buffer); + if (stash->dwarf_ranges_buffer) + free (stash->dwarf_ranges_buffer); + if (stash->info_ptr_memory) + free (stash->info_ptr_memory); } diff --git a/bfd/elf.c b/bfd/elf.c index ea44f72..054fd2a 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -4631,7 +4631,61 @@ assign_file_positions_for_non_load_sections (bfd *abfd, m != NULL; m = m->next, p++) { - if (m->count != 0) + if (p->p_type == PT_GNU_RELRO) + { + const Elf_Internal_Phdr *lp; + + BFD_ASSERT (!m->includes_filehdr && !m->includes_phdrs); + + if (link_info != NULL) + { + /* During linking the range of the RELRO segment is passed + in link_info. */ + for (lp = phdrs; lp < phdrs + count; ++lp) + { + if (lp->p_type == PT_LOAD + && lp->p_vaddr >= link_info->relro_start + && lp->p_vaddr < link_info->relro_end + && lp->p_vaddr + lp->p_filesz >= link_info->relro_end) + break; + } + } + else + { + /* Otherwise we are copying an executable or shared + library, but we need to use the same linker logic. */ + for (lp = phdrs; lp < phdrs + count; ++lp) + { + if (lp->p_type == PT_LOAD + && lp->p_paddr == p->p_paddr) + break; + } + } + + if (lp < phdrs + count) + { + p->p_vaddr = lp->p_vaddr; + p->p_paddr = lp->p_paddr; + p->p_offset = lp->p_offset; + if (link_info != NULL) + p->p_filesz = link_info->relro_end - lp->p_vaddr; + else if (m->p_size_valid) + p->p_filesz = m->p_size; + else + abort (); + p->p_memsz = p->p_filesz; + p->p_align = 1; + p->p_flags = (lp->p_flags & ~PF_W); + } + else if (link_info != NULL) + { + memset (p, 0, sizeof *p); + p->p_type = PT_NULL; + } + else + abort (); + } + else if (m->count != 0) { if (p->p_type != PT_LOAD && (p->p_type != PT_NOTE @@ -4647,87 +4701,20 @@ assign_file_positions_for_non_load_sections (bfd *abfd, p->p_filesz = sect->filepos - m->sections[0]->filepos; if (hdr->sh_type != SHT_NOBITS) p->p_filesz += hdr->sh_size; - - if (p->p_type == PT_GNU_RELRO) - { - /* When we get here, we are copying executable - or shared library. But we need to use the same - linker logic. */ - Elf_Internal_Phdr *lp; - - for (lp = phdrs; lp < phdrs + count; ++lp) - { - if (lp->p_type == PT_LOAD - && lp->p_paddr == p->p_paddr) - break; - } - - if (lp < phdrs + count) - { - /* We should use p_size if it is valid since it - may contain the first few bytes of the next - SEC_ALLOC section. */ - if (m->p_size_valid) - p->p_filesz = m->p_size; - else - abort (); - p->p_vaddr = lp->p_vaddr; - p->p_offset = lp->p_offset; - p->p_memsz = p->p_filesz; - p->p_align = 1; - } - else - abort (); - } - else - p->p_offset = m->sections[0]->filepos; + p->p_offset = m->sections[0]->filepos; } } - else + else if (m->includes_filehdr) { - if (m->includes_filehdr) - { - p->p_vaddr = filehdr_vaddr; - if (! m->p_paddr_valid) - p->p_paddr = filehdr_paddr; - } - else if (m->includes_phdrs) - { - p->p_vaddr = phdrs_vaddr; - if (! m->p_paddr_valid) - p->p_paddr = phdrs_paddr; - } - else if (p->p_type == PT_GNU_RELRO) - { - Elf_Internal_Phdr *lp; - - for (lp = phdrs; lp < phdrs + count; ++lp) - { - if (lp->p_type == PT_LOAD - && lp->p_vaddr <= link_info->relro_end - && lp->p_vaddr >= link_info->relro_start - && (lp->p_vaddr + lp->p_filesz - >= link_info->relro_end)) - break; - } - - if (lp < phdrs + count - && link_info->relro_end > lp->p_vaddr) - { - p->p_vaddr = lp->p_vaddr; - p->p_paddr = lp->p_paddr; - p->p_offset = lp->p_offset; - p->p_filesz = link_info->relro_end - lp->p_vaddr; - p->p_memsz = p->p_filesz; - p->p_align = 1; - p->p_flags = (lp->p_flags & ~PF_W); - } - else - { - memset (p, 0, sizeof *p); - p->p_type = PT_NULL; - } - } + p->p_vaddr = filehdr_vaddr; + if (! m->p_paddr_valid) + p->p_paddr = filehdr_paddr; + } + else if (m->includes_phdrs) + { + p->p_vaddr = phdrs_vaddr; + if (! m->p_paddr_valid) + p->p_paddr = phdrs_paddr; } } diff --git a/bfd/mach-o-target.c b/bfd/mach-o-target.c index fd4d1e1..a435e6e 100644 --- a/bfd/mach-o-target.c +++ b/bfd/mach-o-target.c @@ -84,27 +84,31 @@ const bfd_target TARGET_NAME = #else _bfd_dummy_target, bfd_mach_o_object_p, - _bfd_dummy_target, + bfd_generic_archive_p, bfd_mach_o_core_p #endif hooks/post-receive -- Repository for Project Archer.