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

Re: [Xen-devel] [PATCH v3 1/9] xen: add a generic way to include binary files as variables



On 21.01.2020 09:43, Juergen Gross wrote:
> --- /dev/null
> +++ b/xen/tools/binfile
> @@ -0,0 +1,29 @@
> +#!/bin/sh
> +# usage: binfile [-i] <target-src.S> <binary-file> <varname>
> +# -i     add to .init.rodata (default: .rodata) section
> +
> +[ "$1" = "-i" ] && {
> +    shift
> +    section=".init"
> +}
> +
> +target=$1
> +binsource=$2
> +varname=$3
> +
> +cat <<EOF >$target
> +#include <asm/asm_defns.h>
> +
> +        .section $section.rodata, "a", %progbits
> +
> +        .global $varname
> +$varname:
> +        .incbin "$binsource"
> +.Lend:
> +
> +        .type $varname, %object
> +        .size $varname, . - $varname

I'd prefer if you used .Lend here as well.

I wonder whether, right from the beginning, there wouldn't better
be a way to also request better than byte alignment for such a
blob.

> --- a/xen/xsm/flask/Makefile
> +++ b/xen/xsm/flask/Makefile
> @@ -30,6 +30,9 @@ $(AV_H_FILES): $(AV_H_DEPEND)
>  obj-bin-$(CONFIG_XSM_FLASK_POLICY) += flask-policy.o
>  flask-policy.o: policy.bin
>  
> +flask-policy.S: $(XEN_ROOT)/xen/tools/binfile
> +     $(XEN_ROOT)/xen/tools/binfile -i $@ policy.bin xsm_flask_init_policy

Doesn't objcopy provide a means to convert a binary blob into
an ELF object containing the binary data from the input file?
If so, why involve the assembler and an intermediate file here?

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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