[CRIU] [PATCH 1/8] piegen: Implement tool building, v2

Laurent Dufour ldufour at linux.vnet.ibm.com
Wed May 13 01:29:50 PDT 2015


On 13/05/2015 10:07, Cyrill Gorcunov wrote:
> On Wed, May 13, 2015 at 10:37:11AM +0300, Cyrill Gorcunov wrote:
>> On Wed, May 13, 2015 at 09:22:05AM +0200, Laurent Dufour wrote:
>>>
>>> Hi Cyrill,
>>>
>>> Instead of embedding the processing C code in C code, why not creating
>>> that C file and managed it under Git, and just generate the C file
>>> containing the data to be processed which will be built and linked with
>>> the one stored in Git?
>>>
>>> I found that difficult to maintain when I tried to write the ppc64 part.
>>
>> Hi! Yeah, I thought about it, will do.
> 
> Would attached be more convenient for you? (Pushed it into ia32 branch)

I think it would be nice to share some definition between piegen/elf.c
and the processing code since the first one is building data for the
second one.

I'd rather though at something like that - file names are just proposal ;) :

- pie/parasite-reloc.c
Containing the C code used to process relocation at loading time.

- pie/parasite-reloc.h
The header file containing definition used by parasite-reloc.c and by
piegen/elf.c to create the relocation data (the struct elf_reloc_t and
the type definition).

- pie/parasite-reloc-data.c
- pie/restorer-reloc-data.c
These files are generated by piegen at build time. The name of the
generated elf_reloc_t variable would have to be different to avoid name
conflict. I think we should prefix them based on the blob's name. For
instance:
	parasite_relocs
	parasite_nr_gotpcrel
	parasite_blob

Then, in the Makefile we build pie/parasite-reloc.c,
pie/restorer-reloc-data.c and link them. At run time we call the
parasite-reloc's code passing the data corresponding to the loaded blob
(parasite or restorer).

Cheers,
Laurent.




More information about the CRIU mailing list