[CRIU] Building PIE/PIC objects separately

Laurent Dufour ldufour at linux.vnet.ibm.com
Wed Oct 7 07:27:53 PDT 2015


On 07/10/2015 15:09, Cyrill Gorcunov wrote:
> On Wed, Oct 07, 2015 at 03:03:42PM +0200, Laurent Dufour wrote:
>> Hi,
>>
>> While investigating the build issue raised on ppc64 by the commit
>> 871da9a11147, I discover that some object are used by criu and the
>> parasite/restorer binaries.
>>
>> I think this is wrong since parasite/restore binaries are PIE or
>> PIC object and are build without the C library (thus belonging on
>> builtin services like system call, memory or bits operation).
> 
> Hi! You know the former idea was exactly the opposite ;) We
> wanted to build them once and reuse it. Could you please
> point which exactly problems you're facing?

Actually, I didn't face any issue, I had one with the memcpy symbol, but
I was able to resolve it in another way.

My concern is that we are linking together objects which are not built
the same way between crtools and parasite/restorer.

In addition building parasite/restorer objects separately, will remove
the need to pull architecture memcmp/cpy and bit operation for crtools
binaries. This way crtools will fully rely on the C library ones which
are updated and may be more efficient.

May be it's fine to live with that, but this should not impact so much
the build time to build twice the 3 files below :)

>> We may build such objects twice:
>>  1. *normally* to be linked with criu
>>  2. in PIE or PIC form to be linked with the parasite/restore object
>>
>> I tried to modify the make files to achieve that, but I didn't find a
>> clean way to do so. I tried using the keyword obj-ext-src-y as
>> documented in Documentation/Makefile.build.txt but it failed miserably.
>>
>> I have to admit that I'm not a make file expert, and I'd appreciate
>> ideas and advices here.
>>
>> My goal is to build the following object file in PIE mode for
>> parasite/restorer and in *normal* way for criu:
>> 	pie/util.c
>> 	pie/util-fd.c
>> 	pie/util-vdso.c
>>
>> Please advise..
> 
> At moment we don't have ability to build same source with different
> targets. But if really needed -- make a symlink for source code
> file, rename it and define as own file for obj-y or whatever.

I'd prefer to manage that through make rules.
I'll look at how protobuf/rpc.pb-c.c is managed since it is built twice.

Thanks,
Laurent.



More information about the CRIU mailing list