https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83452

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #42903|0                           |1
        is obsolete|                            |

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
Created attachment 42915
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42915&action=edit
updated patch

Note this hack isn't sustainable as with -ffat-lto-objects _any_ symbol defined
by a TU will become a global weak UNDEF.

What might "work" is to change the name of all such UNDEFs to the same gnu_lto_
one.

So, can you, with

> cat t.c
extern int d;
int a[8][10] = { [2][5] = 4 }, c;

int
main ()
{
  short b;
  int i, d;
  for (b = 4; b >= 0; b--)
    for (c = 0; c <= 6; c++)
      a[c + 1][b + 2] = a[c][b + 1] + d;
  for (i = 0; i < 8; i++)
    for (d = 0; d < 10; d++)
      if (a[i][d] != (i == 3 && d == 6) * 4)
        __builtin_abort ();
  return 0;
}

> cat t2.c
int d = 1;

> ./xgcc -B. t.c t2.c -g -flto -ffat-lto-objects

verify the attached patch?  That should end up with multiple UNDEF WEAK HIDDEN
globals of the same name (gnu_lto_v1).  Then your "stub" would work.

Reply via email to