* [patch] Replace the use of FILE_ALIGN in gc routines
@ 2001-06-08 13:22 Catherine Moore
2001-06-08 18:36 ` Alan Modra
0 siblings, 1 reply; 2+ messages in thread
From: Catherine Moore @ 2001-06-08 13:22 UTC (permalink / raw)
To: binutils; +Cc: clm
I have a port which needs to override some of the defaults from
elf_size_info. Several of the linker gc routines use the macro
FILE_ALIGN instead of the corresponding elf backend entry.
This patch corrects this shortcut. Okay to install?
Thanks,
Catherine
2001-06-08 Catherine Moore <clm@redhat.com>
* elflink.h (elf_gc_propagate_vtable_entries): Replace FILE_ALIGN
with the file_align entry from elf_backend_data.
(elf_gc_smash_unused_vtentry_relocs): Likewise.
(elf_gc_record_vtentry): Likewise.
Index: elflink.h
===================================================================
RCS file: /cvs/src/src/bfd/elflink.h,v
retrieving revision 1.93
diff -p -r1.93 elflink.h
*** elflink.h 2001/05/28 11:57:54 1.93
--- elflink.h 2001/06/08 20:10:06
*************** elf_gc_propagate_vtable_entries_used (h,
*** 6739,6751 ****
size_t n;
boolean *cu, *pu;
/* Or the parent's entries into ours. */
cu = h->vtable_entries_used;
cu[-1] = true;
pu = h->vtable_parent->vtable_entries_used;
if (pu != NULL)
{
! n = h->vtable_parent->vtable_entries_size / FILE_ALIGN;
while (--n != 0)
{
if (*pu) *cu = true;
--- 6739,6755 ----
size_t n;
boolean *cu, *pu;
+ asection *sec = h->root.u.def.section;
+ struct elf_backend_data *bed = get_elf_backend_data (sec->owner);
+ int file_align = bed->s->file_align;
+
/* Or the parent's entries into ours. */
cu = h->vtable_entries_used;
cu[-1] = true;
pu = h->vtable_parent->vtable_entries_used;
if (pu != NULL)
{
! n = h->vtable_parent->vtable_entries_size / file_align;
while (--n != 0)
{
if (*pu) *cu = true;
*************** elf_gc_smash_unused_vtentry_relocs (h, o
*** 6766,6771 ****
--- 6770,6776 ----
bfd_vma hstart, hend;
Elf_Internal_Rela *relstart, *relend, *rel;
struct elf_backend_data *bed;
+ int file_align;
/* Take care of both those symbols that do not describe vtables as
well as those that are not loaded. */
*************** elf_gc_smash_unused_vtentry_relocs (h, o
*** 6784,6789 ****
--- 6789,6796 ----
if (!relstart)
return *(boolean *)okp = false;
bed = get_elf_backend_data (sec->owner);
+ file_align = bed->s->file_align;
+
relend = relstart + sec->reloc_count * bed->s->int_rels_per_ext_rel;
for (rel = relstart; rel < relend; ++rel)
*************** elf_gc_smash_unused_vtentry_relocs (h, o
*** 6793,6799 ****
if (h->vtable_entries_used
&& (rel->r_offset - hstart) < h->vtable_entries_size)
{
! bfd_vma entry = (rel->r_offset - hstart) / FILE_ALIGN;
if (h->vtable_entries_used[entry])
continue;
}
--- 6800,6806 ----
if (h->vtable_entries_used
&& (rel->r_offset - hstart) < h->vtable_entries_size)
{
! bfd_vma entry = (rel->r_offset - hstart) / file_align;
if (h->vtable_entries_used[entry])
continue;
}
*************** elf_gc_record_vtentry (abfd, sec, h, add
*** 6927,6932 ****
--- 6934,6942 ----
struct elf_link_hash_entry *h;
bfd_vma addend;
{
+ struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ int file_align = bed->s->file_align;
+
if (addend >= h->vtable_entries_size)
{
size_t size, bytes;
*************** elf_gc_record_vtentry (abfd, sec, h, add
*** 6949,6955 ****
/* Allocate one extra entry for use as a "done" flag for the
consolidation pass. */
! bytes = (size / FILE_ALIGN + 1) * sizeof (boolean);
if (ptr)
{
--- 6959,6965 ----
/* Allocate one extra entry for use as a "done" flag for the
consolidation pass. */
! bytes = (size / file_align + 1) * sizeof (boolean);
if (ptr)
{
*************** elf_gc_record_vtentry (abfd, sec, h, add
*** 6959,6965 ****
{
size_t oldbytes;
! oldbytes = (h->vtable_entries_size/FILE_ALIGN + 1) * sizeof (boolean);
memset (((char *)ptr) + oldbytes, 0, bytes - oldbytes);
}
}
--- 6969,6975 ----
{
size_t oldbytes;
! oldbytes = (h->vtable_entries_size/file_align + 1) * sizeof (boolean);
memset (((char *)ptr) + oldbytes, 0, bytes - oldbytes);
}
}
*************** elf_gc_record_vtentry (abfd, sec, h, add
*** 6974,6980 ****
h->vtable_entries_size = size;
}
! h->vtable_entries_used[addend / FILE_ALIGN] = true;
return true;
}
--- 6984,6990 ----
h->vtable_entries_size = size;
}
! h->vtable_entries_used[addend / file_align] = true;
return true;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch] Replace the use of FILE_ALIGN in gc routines
2001-06-08 13:22 [patch] Replace the use of FILE_ALIGN in gc routines Catherine Moore
@ 2001-06-08 18:36 ` Alan Modra
0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2001-06-08 18:36 UTC (permalink / raw)
To: Catherine Moore; +Cc: binutils
On Fri, Jun 08, 2001 at 01:22:02PM -0700, Catherine Moore wrote:
>
> * elflink.h (elf_gc_propagate_vtable_entries): Replace FILE_ALIGN
> with the file_align entry from elf_backend_data.
> (elf_gc_smash_unused_vtentry_relocs): Likewise.
> (elf_gc_record_vtentry): Likewise.
Looks OK to me.
> size_t n;
> boolean *cu, *pu;
>
> + asection *sec = h->root.u.def.section;
> + struct elf_backend_data *bed = get_elf_backend_data (sec->owner);
> + int file_align = bed->s->file_align;
> +
but this hunk ought to be moved
> /* Or the parent's entries into ours. */
> cu = h->vtable_entries_used;
> cu[-1] = true;
> pu = h->vtable_parent->vtable_entries_used;
> if (pu != NULL)
> {
to here
> ! n = h->vtable_parent->vtable_entries_size / file_align;
> while (--n != 0)
> {
> if (*pu) *cu = true;
--
Alan Modra
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-06-08 18:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-08 13:22 [patch] Replace the use of FILE_ALIGN in gc routines Catherine Moore
2001-06-08 18:36 ` Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).