On Tue, Jan 18, 2022 at 07:08:00PM +0100, Adrian Reber wrote:
> On Tue, Jan 18, 2022 at 05:56:45PM +0100, Jakub Jelinek wrote:
> > On Tue, Jan 18, 2022 at 05:40:31PM +0100, Adrian Reber wrote:
> > > > If there are bugs on the compiler side, please let me know
immediately,
> > > > so that those bugs can be fixed before the mass rebuild next week.
> > >
> > > Not sure if it is a bug, CRIU no longer works with GCC 12.
> > >
> > > CRIU creates something called 'parasite code' which is injected
into
> > > running processes for checkpointing and that part is built with
> > > '-nostdlib'. Starting with GCC 12 we see 'strlen()' being
pulled into
> > > the parasite code which it wasn't with GCC 11.
> >
> > strlen is a standard C function, so I don't see any bug in that being used
> > unless you do a freestanding compilation (-nostdlib isn't that).
> > If you mail me preprocessed source of handle-elf-host.c + gcc
> > command line used to compile it, I can have a look what exactly changed.
>
> Thanks for mentioning freestanding compilations. That seems to have been
> the problem.
>
> On aarch64 I actually got a slightly different error message:
>
> ld: criu/pie/restorer.o: in function `lsm_set_label':
> /drone/src/criu/pie/restorer.c:174: undefined reference to `strlen'
>
> Line 174 is: "for (len = 0; label[len]; len++)"
>
> Although there is no direct use of strlen(), it seems GCC 12 uses
> strlen() for that line which did not happen with GCC 11. Using
> '-ffreestanding' makes the compilation work with GCC 12 and CI still
> looks happy. Thanks.
https://gcc.gnu.org/r12-4283-g6f966f06146be76
Note, gcc has been doing something similar for years for memcpy and memset.
-fno-tree-loop-distribute-patterns
will work too.