This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: hppa unwind entries
Hi John,
Actually that patch will not work - it does not apply cleanly on top of your
patch. Here is the corrected version.
Cheers
Nick
Index: bfd/elf-bfd.h
===================================================================
RCS file: /cvs/src/src/bfd/elf-bfd.h,v
retrieving revision 1.254
diff -c -3 -p -r1.254 elf-bfd.h
*** bfd/elf-bfd.h 15 Dec 2007 09:42:02 -0000 1.254
--- bfd/elf-bfd.h 29 Dec 2007 15:48:59 -0000
*************** extern bfd_boolean _bfd_elf_map_sections
*** 2076,2081 ****
--- 2076,2084 ----
extern bfd_boolean _bfd_elf_is_function_type (unsigned int);
+ extern Elf_Internal_Phdr * _bfd_elf_find_segment_containing_section
+ (bfd * abfd, asection * section);
+
/* Exported interface for writing elf corefile notes. */
extern char *elfcore_write_note
(bfd *, char *, int *, const char *, int, const void *, int);
Index: bfd/elf-hppa.h
===================================================================
RCS file: /cvs/src/src/bfd/elf-hppa.h,v
retrieving revision 1.86
diff -c -3 -p -r1.86 elf-hppa.h
*** bfd/elf-hppa.h 28 Dec 2007 23:43:45 -0000 1.86
--- bfd/elf-hppa.h 29 Dec 2007 15:48:59 -0000
*************** elf_hppa_fake_sections (bfd *abfd, Elf_I
*** 1088,1122 ****
return TRUE;
}
- /* Find the segment number in which OSEC, and output section, is
- located. */
-
- static unsigned
- elf_hppa_osec_to_segment (bfd *output_bfd, asection *osec)
- {
- struct elf_segment_map *m;
- Elf_Internal_Phdr *p;
-
- /* Find the segment that contains the output_section. */
- for (m = elf_tdata (output_bfd)->segment_map,
- p = elf_tdata (output_bfd)->phdr;
- m != NULL;
- m = m->next, p++)
- {
- int i;
-
- for (i = m->count - 1; i >= 0; i--)
- if (m->sections[i] == osec)
- break;
-
- if (i >= 0)
- break;
- }
-
- BFD_ASSERT (m);
- return p - elf_tdata (output_bfd)->phdr;
- }
-
static void
elf_hppa_final_write_processing (bfd *abfd,
bfd_boolean linker ATTRIBUTE_UNUSED)
--- 1088,1093 ----
*************** elf_hppa_record_segment_addrs (bfd *abfd
*** 1337,1344 ****
if ((section->flags & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD))
{
! unsigned seg = elf_hppa_osec_to_segment (abfd, section->output_section);
! bfd_vma value = elf_tdata (abfd)->phdr[seg].p_vaddr;
if (section->flags & SEC_READONLY)
{
--- 1308,1320 ----
if ((section->flags & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD))
{
! bfd_vma value;
! Elf_Internal_Phdr *p;
!
! p = _bfd_elf_find_segment_containing_section (abfd, section->output_section);
! if (p == NULL)
! return;
! value = p->p_vaddr;
if (section->flags & SEC_READONLY)
{
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.428
diff -c -3 -p -r1.428 elf.c
*** bfd/elf.c 24 Dec 2007 16:58:23 -0000 1.428
--- bfd/elf.c 29 Dec 2007 15:49:02 -0000
*************** get_program_header_size (bfd *abfd, stru
*** 3426,3431 ****
--- 3426,3454 ----
return segs * bed->s->sizeof_phdr;
}
+ /* Find the segment that contains the output_section of section. */
+
+ Elf_Internal_Phdr *
+ _bfd_elf_find_segment_containing_section (bfd * abfd, asection * section)
+ {
+ struct elf_segment_map *m;
+ Elf_Internal_Phdr *p;
+
+ for (m = elf_tdata (abfd)->segment_map,
+ p = elf_tdata (abfd)->phdr;
+ m != NULL;
+ m = m->next, p++)
+ {
+ int i;
+
+ for (i = m->count - 1; i >= 0; i--)
+ if (m->sections[i] == section)
+ return p;
+ }
+
+ return NULL;
+ }
+
/* Create a mapping from a set of sections to a program segment. */
static struct elf_segment_map *
Index: bfd/elf32-bfin.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-bfin.c,v
retrieving revision 1.25
diff -c -3 -p -r1.25 elf32-bfin.c
*** bfd/elf32-bfin.c 28 Sep 2007 08:43:45 -0000 1.25
--- bfd/elf32-bfin.c 29 Dec 2007 15:49:03 -0000
*************** _bfinfdpic_add_rofixup (bfd *output_bfd,
*** 1497,1522 ****
static unsigned
_bfinfdpic_osec_to_segment (bfd *output_bfd, asection *osec)
{
! struct elf_segment_map *m;
! Elf_Internal_Phdr *p;
!
! /* Find the segment that contains the output_section. */
! for (m = elf_tdata (output_bfd)->segment_map,
! p = elf_tdata (output_bfd)->phdr;
! m != NULL;
! m = m->next, p++)
! {
! int i;
!
! for (i = m->count - 1; i >= 0; i--)
! if (m->sections[i] == osec)
! break;
!
! if (i >= 0)
! break;
! }
! return p - elf_tdata (output_bfd)->phdr;
}
inline static bfd_boolean
--- 1497,1505 ----
static unsigned
_bfinfdpic_osec_to_segment (bfd *output_bfd, asection *osec)
{
! Elf_Internal_Phdr *p = _bfd_elf_find_segment_containing_section (output_bfd, osec);
! return (p != NULL) ? p - elf_tdata (output_bfd)->phdr : -1;
}
inline static bfd_boolean
Index: bfd/elf32-frv.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-frv.c,v
retrieving revision 1.58
diff -c -3 -p -r1.58 elf32-frv.c
*** bfd/elf32-frv.c 28 Sep 2007 08:43:45 -0000 1.58
--- bfd/elf32-frv.c 29 Dec 2007 15:49:05 -0000
*************** _frvfdpic_add_rofixup (bfd *output_bfd,
*** 1341,1366 ****
static unsigned
_frvfdpic_osec_to_segment (bfd *output_bfd, asection *osec)
{
! struct elf_segment_map *m;
! Elf_Internal_Phdr *p;
!
! /* Find the segment that contains the output_section. */
! for (m = elf_tdata (output_bfd)->segment_map,
! p = elf_tdata (output_bfd)->phdr;
! m != NULL;
! m = m->next, p++)
! {
! int i;
!
! for (i = m->count - 1; i >= 0; i--)
! if (m->sections[i] == osec)
! break;
!
! if (i >= 0)
! break;
! }
! return p - elf_tdata (output_bfd)->phdr;
}
inline static bfd_boolean
--- 1341,1349 ----
static unsigned
_frvfdpic_osec_to_segment (bfd *output_bfd, asection *osec)
{
! Elf_Internal_Phdr *p = _bfd_elf_find_segment_containing_section (output_bfd, osec);
! return (p != NULL) ? p - elf_tdata (output_bfd)->phdr : -1;
}
inline static bfd_boolean
Index: bfd/elf32-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-hppa.c,v
retrieving revision 1.159
diff -c -3 -p -r1.159 elf32-hppa.c
*** bfd/elf32-hppa.c 28 Dec 2007 23:43:45 -0000 1.159
--- bfd/elf32-hppa.c 29 Dec 2007 15:49:06 -0000
*************** elf32_hppa_final_link (bfd *abfd, struct
*** 3256,3264 ****
/* Record the lowest address for the data and text segments. */
static void
! hppa_record_segment_addr (bfd *abfd,
! asection *section,
! void *data)
{
struct elf32_hppa_link_hash_table *htab;
--- 3256,3262 ----
/* Record the lowest address for the data and text segments. */
static void
! hppa_record_segment_addr (bfd *abfd, asection *section, void *data)
{
struct elf32_hppa_link_hash_table *htab;
*************** hppa_record_segment_addr (bfd *abfd,
*** 3266,3273 ****
if ((section->flags & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD))
{
! unsigned seg = elf_hppa_osec_to_segment (abfd, section->output_section);
! bfd_vma value = elf_tdata (abfd)->phdr[seg].p_vaddr;
if ((section->flags & SEC_READONLY) != 0)
{
--- 3264,3277 ----
if ((section->flags & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD))
{
! bfd_vma value;
! Elf_Internal_Phdr *p;
!
! p = _bfd_elf_find_segment_containing_section (abfd, section->output_section);
!
! if (p == NULL)
! return;
! value = p->p_vaddr;
if ((section->flags & SEC_READONLY) != 0)
{
Index: bfd/elfxx-ia64.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-ia64.c,v
retrieving revision 1.204
diff -c -3 -p -r1.204 elfxx-ia64.c
*** bfd/elfxx-ia64.c 24 Dec 2007 16:55:39 -0000 1.204
--- bfd/elfxx-ia64.c 29 Dec 2007 15:49:07 -0000
*************** elfNN_ia64_relocate_section (bfd *output
*** 4894,4917 ****
case R_IA64_SEGREL64MSB:
case R_IA64_SEGREL64LSB:
{
- struct elf_segment_map *m;
- Elf_Internal_Phdr *p;
-
/* Find the segment that contains the output_section. */
! for (m = elf_tdata (output_bfd)->segment_map,
! p = elf_tdata (output_bfd)->phdr;
! m != NULL;
! m = m->next, p++)
! {
! int i;
! for (i = m->count - 1; i >= 0; i--)
! if (m->sections[i] == input_section->output_section)
! break;
! if (i >= 0)
! break;
! }
! if (m == NULL)
{
r = bfd_reloc_notsupported;
}
--- 4894,4904 ----
case R_IA64_SEGREL64MSB:
case R_IA64_SEGREL64LSB:
{
/* Find the segment that contains the output_section. */
! Elf_Internal_Phdr *p = _bfd_elf_find_segment_containing_section
! (input_bfd, input_section->output_section);
! if (p == NULL)
{
r = bfd_reloc_notsupported;
}