[Libguestfs] Note regarding bin2s.pl

Richard W.M. Jones rjones at redhat.com
Tue Jan 12 10:05:00 UTC 2016


On Tue, Jan 12, 2016 at 07:57:03AM +0100, Hilko Bengen wrote:
> Helge,
> 
> I have applied all the architecture-specific bits but not the bin2s
> script yet. TBH, so far I don't see what is wrong about export and use
> of the "_binary_init_size" constant.

[https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=809185]

I see it as a reasonable simplification - it allows us to get rid of
that conditional code for HP-UX in bin2s.pl.

However looking at the patch, I don't like the casts in:

-  size_t n = (size_t) &_binary_init_size;
+  size_t n = ((size_t) &_binary_init_end) - ((size_t) &_binary_init_start);

Since those are pointers, it seems better to simply subtract them.
(Though it would be better if we'd declared the type of
_binary_init_start/_end as uint8_t instead of char.)

If we must cast them then the correct integer to use is 'intptr_t', an
int type that's guaranteed by C99 to be long enough to store a
pointer.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list