* elf-hppa.h (elf_hppa_osec_to_segment): New function.
(elf_hppa_record_segment_addrs): Use elf_hppa_osec_to_segment. Remove ATTRIBUTE_UNUSED from abfd argument. * elf32-hppa.c (hppa_record_segment_addr): Likewise.
This commit is contained in:
parent
7833b9b3df
commit
7ae8e4e805
|
@ -1,3 +1,10 @@
|
||||||
|
2007-12-28 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
|
||||||
|
|
||||||
|
* elf-hppa.h (elf_hppa_osec_to_segment): New function.
|
||||||
|
(elf_hppa_record_segment_addrs): Use elf_hppa_osec_to_segment.
|
||||||
|
Remove ATTRIBUTE_UNUSED from abfd argument.
|
||||||
|
* elf32-hppa.c (hppa_record_segment_addr): Likewise.
|
||||||
|
|
||||||
2007-12-28 Nick Hudson <nick.hudson@dsl.pipex.com>
|
2007-12-28 Nick Hudson <nick.hudson@dsl.pipex.com>
|
||||||
|
|
||||||
* elf32-hppa.c (hppa_record_segment_addr): Locate the segment
|
* elf32-hppa.c (hppa_record_segment_addr): Locate the segment
|
||||||
|
|
|
@ -1088,6 +1088,35 @@ elf_hppa_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec)
|
||||||
return TRUE;
|
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
|
static void
|
||||||
elf_hppa_final_write_processing (bfd *abfd,
|
elf_hppa_final_write_processing (bfd *abfd,
|
||||||
bfd_boolean linker ATTRIBUTE_UNUSED)
|
bfd_boolean linker ATTRIBUTE_UNUSED)
|
||||||
|
@ -1300,25 +1329,28 @@ elf_hppa_is_dynamic_loader_symbol (const char *name)
|
||||||
|
|
||||||
/* Record the lowest address for the data and text segments. */
|
/* Record the lowest address for the data and text segments. */
|
||||||
static void
|
static void
|
||||||
elf_hppa_record_segment_addrs (bfd *abfd ATTRIBUTE_UNUSED,
|
elf_hppa_record_segment_addrs (bfd *abfd,
|
||||||
asection *section,
|
asection *section,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
struct elf64_hppa_link_hash_table *hppa_info;
|
struct elf64_hppa_link_hash_table *hppa_info = data;
|
||||||
bfd_vma value;
|
|
||||||
|
|
||||||
hppa_info = data;
|
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;
|
||||||
|
|
||||||
value = section->vma - section->filepos;
|
if (section->flags & SEC_READONLY)
|
||||||
|
{
|
||||||
if (((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
|
if (value < hppa_info->text_segment_base)
|
||||||
== (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
|
hppa_info->text_segment_base = value;
|
||||||
&& value < hppa_info->text_segment_base)
|
}
|
||||||
hppa_info->text_segment_base = value;
|
else
|
||||||
else if (((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
|
{
|
||||||
== (SEC_ALLOC | SEC_LOAD))
|
if (value < hppa_info->data_segment_base)
|
||||||
&& value < hppa_info->data_segment_base)
|
hppa_info->data_segment_base = value;
|
||||||
hppa_info->data_segment_base = value;
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called after we have seen all the input files/sections, but before
|
/* Called after we have seen all the input files/sections, but before
|
||||||
|
|
|
@ -3256,7 +3256,7 @@ elf32_hppa_final_link (bfd *abfd, struct bfd_link_info *info)
|
||||||
/* Record the lowest address for the data and text segments. */
|
/* Record the lowest address for the data and text segments. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
hppa_record_segment_addr (bfd *abfd ATTRIBUTE_UNUSED,
|
hppa_record_segment_addr (bfd *abfd,
|
||||||
asection *section,
|
asection *section,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
|
@ -3266,30 +3266,9 @@ hppa_record_segment_addr (bfd *abfd ATTRIBUTE_UNUSED,
|
||||||
|
|
||||||
if ((section->flags & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD))
|
if ((section->flags & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD))
|
||||||
{
|
{
|
||||||
bfd_vma value;
|
unsigned seg = elf_hppa_osec_to_segment (abfd, section->output_section);
|
||||||
struct elf_segment_map *m;
|
bfd_vma value = elf_tdata (abfd)->phdr[seg].p_vaddr;
|
||||||
Elf_Internal_Phdr *p;
|
|
||||||
|
|
||||||
/* Find the segment that contains the output_section for this section. */
|
|
||||||
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->output_section)
|
|
||||||
break;
|
|
||||||
if (i >= 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
value = p->p_vaddr;
|
|
||||||
|
|
||||||
if ((section->flags & SEC_READONLY) != 0)
|
if ((section->flags & SEC_READONLY) != 0)
|
||||||
{
|
{
|
||||||
if (value < htab->text_segment_base)
|
if (value < htab->text_segment_base)
|
||||||
|
|
Loading…
Reference in New Issue