[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v5 09/28] xsplice: Add helper elf routines

>>> Konrad Rzeszutek Wilk <konrad@xxxxxxxxxx> 04/06/16 3:40 AM >>>
>> > +struct xsplice_elf_sym {
>> > +    Elf_Sym *sym;
>> const?
>.. this is much harder. I end up computing the values for
>these symbols and have to write to this this structure a couple of times
>(at worst).

So I've intentionally added question marks to many of these comments, as
there certainly may be reasons to better not make some of the items const.
It just generally seemed in many cases that what gets pointed to has no
reason to get altered after initial setup.

>> > +    Elf_Ehdr *hdr;                 /* ELF file. */
>> > +    struct xsplice_elf_sec *sec;   /* Array of sections, allocated by us. 
>> > */
>> > +    struct xsplice_elf_sym *sym;   /* Array of symbols , allocated by us. 
>> > */
>> > +    unsigned int nsym;
>> > +    struct xsplice_elf_sec *symtab;/* Pointer to .symtab section - aka to 
>> > sec[x]. */
>> > +    struct xsplice_elf_sec *strtab;/* Pointer to .strtab section - aka to 
>> > sec[y]. */
>> Many times - const?
>I have made the symtab and strtab const, but the 'sec' and 'sym'
>I can't easily. There are many instances where I poke in the
>section (like for ELF relocations) and have to modify this.

When processing relocations shouldn't need to modify symbols, and you
also shouldn't need to modify section metadata - only section contents
itself should be altered.

>I can do some casting but it gets a bit .. messy.

One thing should be very clear: No casts should be added which cast away


Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.