This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Enable -fuse-linker-plugin by default when possible, take 2


> On Mon, 29 Nov 2010, Jan Hubicka wrote:
> 
> > Hi,
> > here is updated patch with the test -f ../lto-plugin/Makefile trick and extra
> > dependency on cc1plugin.
> > There are still the failures:
> > ./gcc/testsuite/g++/g++.sum:FAIL: g++.dg/torture/stackalign/eh-alloca-1.C  -O2 -flto -flto-partition=none  (test for excess errors)
> > ./gcc/testsuite/g++/g++.sum:FAIL: g++.dg/torture/stackalign/eh-alloca-1.C  -O2 -flto  (test for excess errors)
> > ./gcc/testsuite/g++/g++.sum:FAIL: g++.dg/torture/stackalign/eh-global-1.C  -O2 -flto -flto-partition=none  (test for excess errors)
> > ./gcc/testsuite/g++/g++.sum:FAIL: g++.dg/torture/stackalign/eh-global-1.C  -O2 -flto  (test for excess errors)
> > ./gcc/testsuite/g++/g++.sum:FAIL: g++.dg/torture/stackalign/eh-inline-1.C  -O2 -flto -flto-partition=none  (test for excess errors)
> > ./gcc/testsuite/g++/g++.sum:FAIL: g++.dg/torture/stackalign/eh-inline-1.C  -O2 -flto  (test for excess errors)
> > ./gcc/testsuite/g++/g++.sum:FAIL: g++.dg/torture/stackalign/eh-inline-2.C  -O2 -flto -flto-partition=none  (test for excess errors)
> > ./gcc/testsuite/g++/g++.sum:FAIL: g++.dg/torture/stackalign/eh-inline-2.C  -O2 -flto  (test for excess errors)
> > ./gcc/testsuite/g++/g++.sum:FAIL: g++.dg/torture/stackalign/eh-vararg-1.C  -O2 -flto -flto-partition=none  (test for excess errors)
> > ./gcc/testsuite/g++/g++.sum:FAIL: g++.dg/torture/stackalign/eh-vararg-1.C  -O2 -flto  (test for excess errors)
> > ./gcc/testsuite/g++/g++.sum:FAIL: g++.dg/torture/stackalign/eh-vararg-2.C  -O2 -flto -flto-partition=none  (test for excess errors)
> > ./gcc/testsuite/g++/g++.sum:FAIL: g++.dg/torture/stackalign/eh-vararg-2.C  -O2 -flto  (test for excess errors)
> > ./gcc/testsuite/gcc5/gcc.sum:FAIL: gcc.c-torture/execute/builtins/memops-asm.c execution,  -O2 -flto 
> > ./gcc/testsuite/gcc5/gcc.sum:FAIL: gcc.c-torture/execute/builtins/snprintf-chk.c execution,  -O2 -flto 
> > ./gcc/testsuite/gcc5/gcc.sum:FAIL: gcc.c-torture/execute/builtins/sprintf-chk.c execution,  -O2 -flto 
> > ./gcc/testsuite/gcc5/gcc.sum:FAIL: gcc.c-torture/execute/builtins/strncpy-chk.c execution,  -O2 -flto 
> > ./gcc/testsuite/gcc5/gcc.sum:FAIL: gcc.c-torture/execute/builtins/vsnprintf-chk.c execution,  -O2 -flto 
> > ./gcc/testsuite/gcc2/gcc.sum:FAIL: gcc.c-torture/execute/bcp-1.c execution,  -O2 -flto 
> > ./gcc/testsuite/gcc2/gcc.sum:FAIL: gcc.c-torture/execute/eeprof-1.c execution,  -O2 -flto 
> > 
> > (stackalign is new, these are undefined local symbols, similar to the known libstdc++ LTO issues.
> 
> Btw, all libstdc++ LTO issues are fixed now (but I didn't try with
> the linker plugin yet).

I will look into these next.
I looked into memops-asm and friends and they are unfrontunately hard to fix.
memops-asm defines:

#define ASMNAME(cname)  ASMNAME2 (__USER_LABEL_PREFIX__, cname)
#define ASMNAME2(prefix, cname) STRING (prefix) cname
#define STRING(x)    #x

typedef __SIZE_TYPE__ size_t;
extern void abort (void);
extern void *memcpy (void *, const void *, size_t)
  __asm (ASMNAME ("my_memcpy"));

in one module that produce:

memcpy/4(-1) @0x7fe23e9769a0 (asm: *my_memcpy)
  called by: main_test/0 (1.00 per call)
  calls:
  References:
  Refering this function:

while memops-asm-lib defines:

void *
my_memcpy (void *d, const void *s, size_t n)

that produce
my_memcpy/0(0) @0x7f4b61c8e160 (asm: my_memcpy) analyzed 10 time, 16 benefit 11 size, 8 benefit reachable body finalized inlinable
  called by: memcpy/4 (1.00 per call)
  calls:
  References:
  Refering this function:

Now lto-symtab and lto_symtab code knows nothing about the fact that
DECL_ASEMBLER_NAME *my_memcpy is identical to DECL_ASSEMLBER_NAME my_memcpy
(because in elf __USER_LABEL_PREFIX__ is NULL) and consequently they are not
merged.  As a result we see no uses of my_memcpy and optimize it away and mess
up.

We really need lto-symtab and code producing symtab to operate on final symbol
names instead of our funny concept of DECL_ASSEMBLER_NAME, but I do not see how
to reach this as the whole target machinery don't seem to be fitting this
purpose well :(

Honza


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]