diff options
author | Richard Henderson <rth@redhat.com> | 2000-11-08 07:54:31 +0000 |
---|---|---|
committer | Richard Henderson <rth@redhat.com> | 2000-11-08 07:54:31 +0000 |
commit | 9a951beb03d7a4a8c1b6784bd06fdecfc1b3855d (patch) | |
tree | 5985fd6ae0227e9fa1fcd897f325dd266616e8f4 | |
parent | aebad5fe2c11207eff4d7aebee889f1477fe5adb (diff) | |
download | gdb-9a951beb03d7a4a8c1b6784bd06fdecfc1b3855d.zip gdb-9a951beb03d7a4a8c1b6784bd06fdecfc1b3855d.tar.gz gdb-9a951beb03d7a4a8c1b6784bd06fdecfc1b3855d.tar.bz2 |
* elf64-ia64.c (elf64_ia64_final_link): New local unwind_output_sec.
Set it before bfd_elf64_bfd_final_link call. Use it after the call.
* section.c (bfd_set_section_contents): Call memcpy if
section->contents set and location not equal to contents plus offset.
-rw-r--r-- | bfd/ChangeLog | 7 | ||||
-rw-r--r-- | bfd/elfxx-ia64.c | 44 | ||||
-rw-r--r-- | bfd/section.c | 5 |
3 files changed, 36 insertions, 20 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index ccf9c6a..3351193 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2000-11-07 Richard Henderson <rth@redhat.com> + + * elfxx-ia64.c (elf64_ia64_final_link): New local unwind_output_sec. + Set it before bfd_elf64_bfd_final_link call. Use it after the call. + * section.c (bfd_set_section_contents): Call memcpy if + section->contents set and location not equal to contents plus offset. + 2000-11-08 Kazu Hirata <kazu@hxi.com> * bfd.c: Fix formatting. diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index 1e319bc..d5c5f02 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -2998,6 +2998,8 @@ elfNN_ia64_final_link (abfd, info) struct bfd_link_info *info; { struct elfNN_ia64_link_hash_table *ia64_info; + asection *unwind_output_sec; + ia64_info = elfNN_ia64_hash_table (info); /* Make sure we've got ourselves a nice fat __gp value. */ @@ -3152,33 +3154,37 @@ elfNN_ia64_final_link (abfd, info) } } - /* Invoke the regular ELF backend linker to do all the work. */ - if (!bfd_elfNN_bfd_final_link (abfd, info)) - return false; - /* If we're producing a final executable, we need to sort the contents - of the .IA_64.unwind section. */ + of the .IA_64.unwind section. Force this section to be relocated + into memory rather than written immediately to the output file. */ + unwind_output_sec = NULL; if (!info->relocateable) { asection *s = bfd_get_section_by_name (abfd, ELF_STRING_ia64_unwind); if (s) { - bfd_size_type size = s->output_section->_raw_size; - char *contents = bfd_malloc (size); - - if (contents == NULL) - return false; - if (! bfd_get_section_contents (abfd, s->output_section, - contents, (file_ptr) 0, size)) + unwind_output_sec = s->output_section; + unwind_output_sec->contents + = bfd_malloc (unwind_output_sec->_raw_size); + if (unwind_output_sec->contents == NULL) return false; + } + } - elfNN_ia64_unwind_entry_compare_bfd = abfd; - qsort (contents, size / 24, 24, elfNN_ia64_unwind_entry_compare); + /* Invoke the regular ELF backend linker to do all the work. */ + if (!bfd_elfNN_bfd_final_link (abfd, info)) + return false; - if (! bfd_set_section_contents (abfd, s->output_section, - contents, (file_ptr) 0, size)) - return false; - } + if (unwind_output_sec) + { + elfNN_ia64_unwind_entry_compare_bfd = abfd; + qsort (unwind_output_sec->contents, unwind_output_sec->_raw_size / 24, + 24, elfNN_ia64_unwind_entry_compare); + + if (! bfd_set_section_contents (abfd, unwind_output_sec, + unwind_output_sec->contents, 0, + unwind_output_sec->_raw_size)) + return false; } return true; @@ -3885,8 +3891,6 @@ elfNN_ia64_finish_dynamic_sections (abfd, info) for (; dyncon < dynconend; dyncon++) { Elf_Internal_Dyn dyn; - const char *name; - asection *s; bfd_elfNN_swap_dyn_in (dynobj, dyncon, &dyn); diff --git a/bfd/section.c b/bfd/section.c index ef7a7e6..38683fc 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -1081,6 +1081,11 @@ bfd_set_section_contents (abfd, section, location, offset, count) break; } + /* Record a copy of the data in memory if desired. */ + if (section->contents + && location != section->contents + offset) + memcpy (section->contents + offset, location, count); + if (BFD_SEND (abfd, _bfd_set_section_contents, (abfd, section, location, offset, count))) { |