[Bug lto/81968] [8 regression] early lto debug objects make Solaris ld SEGV

rguenther at suse dot de gcc-bugzilla@gcc.gnu.org
Tue Jan 9 14:09:00 GMT 2018


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

--- Comment #53 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 9 Jan 2018, ro at CeBiTec dot Uni-Bielefeld.DE wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81968
> 
> --- Comment #47 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> ---
> > --- Comment #45 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot
> > Uni-Bielefeld.DE> ---
> [...]
> >> that should have been used as the reloc section for the new section 2.
> >> I see sh_info is still 9, it should be 2.  That's eventually
> >> missing handling in the section removal patch.
> >
> > I'll try to figure this out.
> 
> However, testing the patch on Linux produced weird results: during a
> regular make check run, many LTO tests FAIL like this:
> 
> *** Error in
> `/var/scratch/gcc/regression/trunk/4.10.10-gcc-gas-gld/build/gcc/testsuite/g++5/../../lto-wrapper':
> free(): invalid next size (normal): 0x000000000197a900 ***
> ======= Backtrace: =========
> /lib64/libc.so.6(+0x791fb)[0x7fe8b712c1fb]
> /lib64/libc.so.6(+0x8288a)[0x7fe8b713588a]
> /lib64/libc.so.6(cfree+0x4c)[0x7fe8b71392bc]
> /var/scratch/gcc/regression/trunk/4.10.10-gcc-gas-gld/build/gcc/testsuite/g++5/../../lto-wrapper[0x472b2e]
> /var/scratch/gcc/regression/trunk/4.10.10-gcc-gas-gld/build/gcc/testsuite/g++5/../../lto-wrapper[0x472c76]
> /var/scratch/gcc/regression/trunk/4.10.10-gcc-gas-gld/build/gcc/testsuite/g++5/../../lto-wrapper[0x40668d]
> /var/scratch/gcc/regression/trunk/4.10.10-gcc-gas-gld/build/gcc/testsuite/g++5/../../lto-wrapper[0x407245]
> /var/scratch/gcc/regression/trunk/4.10.10-gcc-gas-gld/build/gcc/testsuite/g++5/../../lto-wrapper[0x404ab6]
> /lib64/libc.so.6(__libc_start_main+0xf1)[0x7fe8b70d3401]
> /var/scratch/gcc/regression/trunk/4.10.10-gcc-gas-gld/build/gcc/testsuite/g++5/../../lto-wrapper[0x404bea]

I belive this is your new code in handle_lto_debug_sections which doesn't
NUL terminate the .rela in newname but then strcats on it.  
s/XNEWVEC/XCNEWVEC/ fixes that for me.

not yet fixed in the updated patch.  Btw, the following has been helful
a few times to me...

Index: lto-plugin.c
===================================================================
--- lto-plugin.c        (revision 256378)
+++ lto-plugin.c        (working copy)
@@ -551,7 +551,7 @@ exec_lto_wrapper (char *argv[])
   char *at_args;
   FILE *args;
   FILE *wrapper_output;
-  char *new_argv[3];
+  char *new_argv[4];
   struct pex_obj *pex;
   const char *errmsg;

@@ -583,9 +583,10 @@ exec_lto_wrapper (char *argv[])
        }
     }

-  new_argv[0] = argv[0];
-  new_argv[1] = at_args;
-  new_argv[2] = NULL;
+  new_argv[0] = "/usr/bin/valgrind";//argv[0];
+  new_argv[1] = argv[0];//at_args;
+  new_argv[2] = at_args;//NULL;
+  new_argv[3] = NULL;

   if (debug)
     {
@@ -595,7 +596,7 @@ exec_lto_wrapper (char *argv[])
     }


-  pex = pex_init (PEX_USE_PIPES, "lto-wrapper", NULL);
+  pex = pex_init (PEX_USE_PIPES, "valgrind"/*"lto-wrapper"*/, NULL);
   check (pex != NULL, LDPL_FATAL, "could not pex_init lto-wrapper");

   errmsg = pex_run (pex, 0, new_argv[0], new_argv, NULL, NULL, &t);


More information about the Gcc-bugs mailing list