diff mbox

[lto] don't assume pointer size

Message ID 201410152207.s9FM7wE8011989@greed.delorie.com
State New
Headers show

Commit Message

DJ Delorie Oct. 15, 2014, 10:07 p.m. UTC
In the event that pointer sizes aren't powers of two, choose a more
suitable alignment than (unsigned)(-1), which results in HUGE file
sizes.  Ok?

Comments

Richard Biener Oct. 16, 2014, 8 a.m. UTC | #1
On Thu, Oct 16, 2014 at 12:07 AM, DJ Delorie <dj@redhat.com> wrote:
>
> In the event that pointer sizes aren't powers of two, choose a more
> suitable alignment than (unsigned)(-1), which results in HUGE file
> sizes.  Ok?

Ok.

Thanks,
Richard.

> Index: gcc/lto/lto-object.c
> ===================================================================
> --- gcc/lto/lto-object.c        (revision 216287)
> +++ gcc/lto/lto-object.c        (working copy)
> @@ -335,13 +335,13 @@ lto_obj_begin_section (const char *name)
>    lo = (struct lto_simple_object *) current_out_file;
>    gcc_assert (lo != NULL
>               && lo->sobj_r == NULL
>               && lo->sobj_w != NULL
>               && lo->section == NULL);
>
> -  align = exact_log2 (POINTER_SIZE / BITS_PER_UNIT);
> +  align = ceil_log2 (POINTER_SIZE_UNITS);
>    lo->section = simple_object_write_create_section (lo->sobj_w, name, align,
>                                                     &errmsg, &err);
>    if (lo->section == NULL)
>      {
>        if (err == 0)
>         fatal_error ("%s", errmsg);
DJ Delorie Oct. 16, 2014, 9:06 p.m. UTC | #2
> > In the event that pointer sizes aren't powers of two, choose a more
> > suitable alignment than (unsigned)(-1), which results in HUGE file
> > sizes.  Ok?
> 
> Ok.

Thanks!  Committed.
diff mbox

Patch

Index: gcc/lto/lto-object.c
===================================================================
--- gcc/lto/lto-object.c	(revision 216287)
+++ gcc/lto/lto-object.c	(working copy)
@@ -335,13 +335,13 @@  lto_obj_begin_section (const char *name)
   lo = (struct lto_simple_object *) current_out_file;
   gcc_assert (lo != NULL
 	      && lo->sobj_r == NULL
 	      && lo->sobj_w != NULL
 	      && lo->section == NULL);
 
-  align = exact_log2 (POINTER_SIZE / BITS_PER_UNIT);
+  align = ceil_log2 (POINTER_SIZE_UNITS);
   lo->section = simple_object_write_create_section (lo->sobj_w, name, align,
 						    &errmsg, &err);
   if (lo->section == NULL)
     {
       if (err == 0)
 	fatal_error ("%s", errmsg);