* ELF header data types / elfstructs.h, Elf64_Half, Elf64_Quarter
@ 2011-11-16 17:20 Volker Eckert
2011-11-16 17:42 ` Andrew Cooper
2011-11-16 18:22 ` Keir Fraser
0 siblings, 2 replies; 6+ messages in thread
From: Volker Eckert @ 2011-11-16 17:20 UTC (permalink / raw)
To: xen-devel
hi,
according to two ELF standard documents, namely
http://downloads.openwatcom.org/ftp/devel/docs/elf-64-gen.pdf
and
http://ftp.parisc-linux.org/docs/arch/elf-64-hp.pdf
Elf64_Half should be uint16_t and not uint32_t as it is currently
defined in elfstructs.h
i guess this is, because Elf.._Half is supposed to mean 'half a word'
(whatever that was at that time) and not 'half of 64 bits' like the name
could suggest.
in that context i'd suggest replacing occurences of Elf64_Quarter with
Elf64_Half and removing its definition - but as it is not defined in the
standard it is more of a cosmetic issue.
please find a patch against xen-unstable below - i hope this is
acceptable(?). as i'm not subscribed to the list please CC me in
replies, thanks!
volker
p. s.: i think there is a check for Python.h missing in some configure.in
diff --git a/tools/libxc/xc_dom_elfloader.c b/tools/libxc/xc_dom_elfloader.c
index 906e3a2..4d7b8e0 100644
--- a/tools/libxc/xc_dom_elfloader.c
+++ b/tools/libxc/xc_dom_elfloader.c
@@ -237,7 +237,7 @@ static int xc_dom_load_elf_symtab(struct
xc_dom_image *dom,
/* Name is NULL. */
if ( elf_64bit(&syms) )
- *(Elf64_Half*)(&shdr->e64.sh_name) = 0;
+ *(Elf64_Word*)(&shdr->e64.sh_name) = 0;
else
*(Elf32_Word*)(&shdr->e32.sh_name) = 0;
}
diff --git a/xen/include/xen/elfstructs.h b/xen/include/xen/elfstructs.h
index 62f9399..1c46cd4 100644
--- a/xen/include/xen/elfstructs.h
+++ b/xen/include/xen/elfstructs.h
@@ -44,7 +44,7 @@ typedef uint32_t Elf64_Word;
typedef int64_t Elf64_Sxword;
typedef uint64_t Elf64_Xword;
-typedef uint32_t Elf64_Half;
+typedef uint16_t Elf64_Half;
typedef uint16_t Elf64_Quarter;
/*
@@ -129,11 +129,11 @@ typedef struct {
unsigned char e_ident[EI_NIDENT]; /* Id bytes */
Elf64_Quarter e_type; /* file type */
Elf64_Quarter e_machine; /* machine type */
- Elf64_Half e_version; /* version number */
+ Elf64_Word e_version; /* version number */
Elf64_Addr e_entry; /* entry point */
Elf64_Off e_phoff; /* Program hdr offset */
Elf64_Off e_shoff; /* Section hdr offset */
- Elf64_Half e_flags; /* Processor flags */
+ Elf64_Word e_flags; /* Processor flags */
Elf64_Quarter e_ehsize; /* sizeof ehdr */
Elf64_Quarter e_phentsize; /* Program header entry
size */
Elf64_Quarter e_phnum; /* Number of program
headers */
@@ -202,14 +202,14 @@ typedef struct {
} Elf32_Shdr;
typedef struct {
- Elf64_Half sh_name; /* section name */
- Elf64_Half sh_type; /* section type */
+ Elf64_Word sh_name; /* section name */
+ Elf64_Word sh_type; /* section type */
Elf64_Xword sh_flags; /* section flags */
Elf64_Addr sh_addr; /* virtual address */
Elf64_Off sh_offset; /* file offset */
Elf64_Xword sh_size; /* section size */
- Elf64_Half sh_link; /* link to another */
- Elf64_Half sh_info; /* misc info */
+ Elf64_Word sh_link; /* link to another */
+ Elf64_Word sh_info; /* misc info */
Elf64_Xword sh_addralign; /* memory alignment */
Elf64_Xword sh_entsize; /* table entry size */
} Elf64_Shdr;
@@ -284,7 +284,7 @@ typedef struct elf32_sym {
} Elf32_Sym;
typedef struct {
- Elf64_Half st_name; /* Symbol name index in str table */
+ Elf64_Word st_name; /* Symbol name index in str table */
Elf_Byte st_info; /* type / binding attrs */
Elf_Byte st_other; /* unused */
Elf64_Quarter st_shndx; /* section index of symbol */
@@ -368,8 +368,8 @@ typedef struct {
} Elf32_Phdr;
typedef struct {
- Elf64_Half p_type; /* entry type */
- Elf64_Half p_flags; /* flags */
+ Elf64_Word p_type; /* entry type */
+ Elf64_Word p_flags; /* flags */
Elf64_Off p_offset; /* offset */
Elf64_Addr p_vaddr; /* virtual address */
Elf64_Addr p_paddr; /* physical address */
@@ -458,9 +458,9 @@ typedef struct {
} Elf32_Note;
typedef struct {
- Elf64_Half namesz;
- Elf64_Half descsz;
- Elf64_Half type;
+ Elf64_Word namesz;
+ Elf64_Word descsz;
+ Elf64_Word type;
} Elf64_Note;
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: ELF header data types / elfstructs.h, Elf64_Half, Elf64_Quarter
2011-11-16 17:20 ELF header data types / elfstructs.h, Elf64_Half, Elf64_Quarter Volker Eckert
@ 2011-11-16 17:42 ` Andrew Cooper
2011-11-16 17:44 ` Andrew Cooper
2011-11-16 18:22 ` Keir Fraser
1 sibling, 1 reply; 6+ messages in thread
From: Andrew Cooper @ 2011-11-16 17:42 UTC (permalink / raw)
To: Volker Eckert; +Cc: xen-devel@lists.xensource.com
On 16/11/11 17:20, Volker Eckert wrote:
> hi,
>
> according to two ELF standard documents, namely
> http://downloads.openwatcom.org/ftp/devel/docs/elf-64-gen.pdf
> and
> http://ftp.parisc-linux.org/docs/arch/elf-64-hp.pdf
>
> Elf64_Half should be uint16_t and not uint32_t as it is currently
> defined in elfstructs.h
This agrees with /usr/include/linux/elf.h so it is probably a good idea
to fix.
> i guess this is, because Elf.._Half is supposed to mean 'half a word'
> (whatever that was at that time) and not 'half of 64 bits' like the name
> could suggest.
>
> in that context i'd suggest replacing occurences of Elf64_Quarter with
> Elf64_Half and removing its definition - but as it is not defined in the
> standard it is more of a cosmetic issue.
>
> please find a patch against xen-unstable below - i hope this is
> acceptable(?). as i'm not subscribed to the list please CC me in
> replies, thanks!
Please read http://wiki.xen.org/wiki/SubmittingXenPatches
Specifically, you need to make a declaration of origin.
It is a good idea to attach your patch as a file as quite a few mail
clients mangle whitespace of the email text. Also, being on the
xen-devel mailing list is a Very Good Idea.
> volker
>
>
> p. s.: i think there is a check for Python.h missing in some configure.in
>
>
>
>
>
>
> diff --git a/tools/libxc/xc_dom_elfloader.c b/tools/libxc/xc_dom_elfloader.c
> index 906e3a2..4d7b8e0 100644
> --- a/tools/libxc/xc_dom_elfloader.c
> +++ b/tools/libxc/xc_dom_elfloader.c
> @@ -237,7 +237,7 @@ static int xc_dom_load_elf_symtab(struct
> xc_dom_image *dom,
>
> /* Name is NULL. */
> if ( elf_64bit(&syms) )
> - *(Elf64_Half*)(&shdr->e64.sh_name) = 0;
> + *(Elf64_Word*)(&shdr->e64.sh_name) = 0;
> else
> *(Elf32_Word*)(&shdr->e32.sh_name) = 0;
> }
> diff --git a/xen/include/xen/elfstructs.h b/xen/include/xen/elfstructs.h
> index 62f9399..1c46cd4 100644
> --- a/xen/include/xen/elfstructs.h
> +++ b/xen/include/xen/elfstructs.h
> @@ -44,7 +44,7 @@ typedef uint32_t Elf64_Word;
> typedef int64_t Elf64_Sxword;
> typedef uint64_t Elf64_Xword;
>
> -typedef uint32_t Elf64_Half;
> +typedef uint16_t Elf64_Half;
> typedef uint16_t Elf64_Quarter;
>
> /*
> @@ -129,11 +129,11 @@ typedef struct {
> unsigned char e_ident[EI_NIDENT]; /* Id bytes */
> Elf64_Quarter e_type; /* file type */
> Elf64_Quarter e_machine; /* machine type */
> - Elf64_Half e_version; /* version number */
> + Elf64_Word e_version; /* version number */
> Elf64_Addr e_entry; /* entry point */
> Elf64_Off e_phoff; /* Program hdr offset */
> Elf64_Off e_shoff; /* Section hdr offset */
> - Elf64_Half e_flags; /* Processor flags */
> + Elf64_Word e_flags; /* Processor flags */
> Elf64_Quarter e_ehsize; /* sizeof ehdr */
> Elf64_Quarter e_phentsize; /* Program header entry
> size */
> Elf64_Quarter e_phnum; /* Number of program
> headers */
> @@ -202,14 +202,14 @@ typedef struct {
> } Elf32_Shdr;
>
> typedef struct {
> - Elf64_Half sh_name; /* section name */
> - Elf64_Half sh_type; /* section type */
> + Elf64_Word sh_name; /* section name */
> + Elf64_Word sh_type; /* section type */
> Elf64_Xword sh_flags; /* section flags */
> Elf64_Addr sh_addr; /* virtual address */
> Elf64_Off sh_offset; /* file offset */
> Elf64_Xword sh_size; /* section size */
> - Elf64_Half sh_link; /* link to another */
> - Elf64_Half sh_info; /* misc info */
> + Elf64_Word sh_link; /* link to another */
> + Elf64_Word sh_info; /* misc info */
> Elf64_Xword sh_addralign; /* memory alignment */
> Elf64_Xword sh_entsize; /* table entry size */
> } Elf64_Shdr;
> @@ -284,7 +284,7 @@ typedef struct elf32_sym {
> } Elf32_Sym;
>
> typedef struct {
> - Elf64_Half st_name; /* Symbol name index in str table */
> + Elf64_Word st_name; /* Symbol name index in str table */
> Elf_Byte st_info; /* type / binding attrs */
> Elf_Byte st_other; /* unused */
> Elf64_Quarter st_shndx; /* section index of symbol */
> @@ -368,8 +368,8 @@ typedef struct {
> } Elf32_Phdr;
>
> typedef struct {
> - Elf64_Half p_type; /* entry type */
> - Elf64_Half p_flags; /* flags */
> + Elf64_Word p_type; /* entry type */
> + Elf64_Word p_flags; /* flags */
> Elf64_Off p_offset; /* offset */
> Elf64_Addr p_vaddr; /* virtual address */
> Elf64_Addr p_paddr; /* physical address */
> @@ -458,9 +458,9 @@ typedef struct {
> } Elf32_Note;
>
> typedef struct {
> - Elf64_Half namesz;
> - Elf64_Half descsz;
> - Elf64_Half type;
> + Elf64_Word namesz;
> + Elf64_Word descsz;
> + Elf64_Word type;
> } Elf64_Note;
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
--
Andrew Cooper - Dom0 Kernel Engineer, Citrix XenServer
T: +44 (0)1223 225 900, http://www.citrix.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ELF header data types / elfstructs.h, Elf64_Half, Elf64_Quarter
2011-11-16 17:42 ` Andrew Cooper
@ 2011-11-16 17:44 ` Andrew Cooper
2011-11-16 18:12 ` Volker Eckert
0 siblings, 1 reply; 6+ messages in thread
From: Andrew Cooper @ 2011-11-16 17:44 UTC (permalink / raw)
To: Volker Eckert; +Cc: xen-devel@lists.xensource.com
On 16/11/11 17:42, Andrew Cooper wrote:
> On 16/11/11 17:20, Volker Eckert wrote:
>> hi,
>>
>> according to two ELF standard documents, namely
>> http://downloads.openwatcom.org/ftp/devel/docs/elf-64-gen.pdf
>> and
>> http://ftp.parisc-linux.org/docs/arch/elf-64-hp.pdf
>>
>> Elf64_Half should be uint16_t and not uint32_t as it is currently
>> defined in elfstructs.h
> This agrees with /usr/include/linux/elf.h so it is probably a good idea
> to fix.
>
>> i guess this is, because Elf.._Half is supposed to mean 'half a word'
>> (whatever that was at that time) and not 'half of 64 bits' like the name
>> could suggest.
>>
>> in that context i'd suggest replacing occurences of Elf64_Quarter with
>> Elf64_Half and removing its definition - but as it is not defined in the
>> standard it is more of a cosmetic issue.
>>
>> please find a patch against xen-unstable below - i hope this is
>> acceptable(?). as i'm not subscribed to the list please CC me in
>> replies, thanks!
> Please read http://wiki.xen.org/wiki/SubmittingXenPatches
>
> Specifically, you need to make a declaration of origin.
>
> It is a good idea to attach your patch as a file as quite a few mail
> clients mangle whitespace of the email text. Also, being on the
> xen-devel mailing list is a Very Good Idea.
P.S. Please match the whitespace conventions of the file you are working
in, which you have not done in your submitted patch.
~Andrew
>> volker
>>
>>
>> p. s.: i think there is a check for Python.h missing in some configure.in
>>
>>
>>
>>
>>
>>
>> diff --git a/tools/libxc/xc_dom_elfloader.c b/tools/libxc/xc_dom_elfloader.c
>> index 906e3a2..4d7b8e0 100644
>> --- a/tools/libxc/xc_dom_elfloader.c
>> +++ b/tools/libxc/xc_dom_elfloader.c
>> @@ -237,7 +237,7 @@ static int xc_dom_load_elf_symtab(struct
>> xc_dom_image *dom,
>>
>> /* Name is NULL. */
>> if ( elf_64bit(&syms) )
>> - *(Elf64_Half*)(&shdr->e64.sh_name) = 0;
>> + *(Elf64_Word*)(&shdr->e64.sh_name) = 0;
>> else
>> *(Elf32_Word*)(&shdr->e32.sh_name) = 0;
>> }
>> diff --git a/xen/include/xen/elfstructs.h b/xen/include/xen/elfstructs.h
>> index 62f9399..1c46cd4 100644
>> --- a/xen/include/xen/elfstructs.h
>> +++ b/xen/include/xen/elfstructs.h
>> @@ -44,7 +44,7 @@ typedef uint32_t Elf64_Word;
>> typedef int64_t Elf64_Sxword;
>> typedef uint64_t Elf64_Xword;
>>
>> -typedef uint32_t Elf64_Half;
>> +typedef uint16_t Elf64_Half;
>> typedef uint16_t Elf64_Quarter;
>>
>> /*
>> @@ -129,11 +129,11 @@ typedef struct {
>> unsigned char e_ident[EI_NIDENT]; /* Id bytes */
>> Elf64_Quarter e_type; /* file type */
>> Elf64_Quarter e_machine; /* machine type */
>> - Elf64_Half e_version; /* version number */
>> + Elf64_Word e_version; /* version number */
>> Elf64_Addr e_entry; /* entry point */
>> Elf64_Off e_phoff; /* Program hdr offset */
>> Elf64_Off e_shoff; /* Section hdr offset */
>> - Elf64_Half e_flags; /* Processor flags */
>> + Elf64_Word e_flags; /* Processor flags */
>> Elf64_Quarter e_ehsize; /* sizeof ehdr */
>> Elf64_Quarter e_phentsize; /* Program header entry
>> size */
>> Elf64_Quarter e_phnum; /* Number of program
>> headers */
>> @@ -202,14 +202,14 @@ typedef struct {
>> } Elf32_Shdr;
>>
>> typedef struct {
>> - Elf64_Half sh_name; /* section name */
>> - Elf64_Half sh_type; /* section type */
>> + Elf64_Word sh_name; /* section name */
>> + Elf64_Word sh_type; /* section type */
>> Elf64_Xword sh_flags; /* section flags */
>> Elf64_Addr sh_addr; /* virtual address */
>> Elf64_Off sh_offset; /* file offset */
>> Elf64_Xword sh_size; /* section size */
>> - Elf64_Half sh_link; /* link to another */
>> - Elf64_Half sh_info; /* misc info */
>> + Elf64_Word sh_link; /* link to another */
>> + Elf64_Word sh_info; /* misc info */
>> Elf64_Xword sh_addralign; /* memory alignment */
>> Elf64_Xword sh_entsize; /* table entry size */
>> } Elf64_Shdr;
>> @@ -284,7 +284,7 @@ typedef struct elf32_sym {
>> } Elf32_Sym;
>>
>> typedef struct {
>> - Elf64_Half st_name; /* Symbol name index in str table */
>> + Elf64_Word st_name; /* Symbol name index in str table */
>> Elf_Byte st_info; /* type / binding attrs */
>> Elf_Byte st_other; /* unused */
>> Elf64_Quarter st_shndx; /* section index of symbol */
>> @@ -368,8 +368,8 @@ typedef struct {
>> } Elf32_Phdr;
>>
>> typedef struct {
>> - Elf64_Half p_type; /* entry type */
>> - Elf64_Half p_flags; /* flags */
>> + Elf64_Word p_type; /* entry type */
>> + Elf64_Word p_flags; /* flags */
>> Elf64_Off p_offset; /* offset */
>> Elf64_Addr p_vaddr; /* virtual address */
>> Elf64_Addr p_paddr; /* physical address */
>> @@ -458,9 +458,9 @@ typedef struct {
>> } Elf32_Note;
>>
>> typedef struct {
>> - Elf64_Half namesz;
>> - Elf64_Half descsz;
>> - Elf64_Half type;
>> + Elf64_Word namesz;
>> + Elf64_Word descsz;
>> + Elf64_Word type;
>> } Elf64_Note;
>>
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xensource.com
>> http://lists.xensource.com/xen-devel
--
Andrew Cooper - Dom0 Kernel Engineer, Citrix XenServer
T: +44 (0)1223 225 900, http://www.citrix.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ELF header data types / elfstructs.h, Elf64_Half, Elf64_Quarter
2011-11-16 17:44 ` Andrew Cooper
@ 2011-11-16 18:12 ` Volker Eckert
2011-11-16 18:26 ` Keir Fraser
0 siblings, 1 reply; 6+ messages in thread
From: Volker Eckert @ 2011-11-16 18:12 UTC (permalink / raw)
To: xen-devel@lists.xensource.com
[-- Attachment #1: Type: text/plain, Size: 985 bytes --]
Andrew, thank you for the prompt reply.
>> Please read http://wiki.xen.org/wiki/SubmittingXenPatches
>>
>> Specifically, you need to make a declaration of origin.
please find the patch attached in a separate file, with a declaration of
origin. i don't have hg installed, so it is still created using git. the
wiki page doesn't say anything about hg being the exclusive way for
patch submissions so i hope that is acceptable.
>> It is a good idea to attach your patch as a file as quite a few mail
>> clients mangle whitespace of the email text.
done, sorry about that.
> P.S. Please match the whitespace conventions of the file you are working
> in, which you have not done in your submitted patch.
i guess they got mangled by the mailer(?)
as i only replaced parts of words i didn't change any whitespace - it
was and still is 4 spaces per indentation inside xc_dom_elfloader.c and
tabs for the rest of the files, which i just checked. unless i am
missing something...
[-- Attachment #2: elf64_half.patch --]
[-- Type: text/x-patch, Size: 3242 bytes --]
Elf64_Half is a uint16_t according to the ELF standard
Signed-off-by: Volker Eckert <volker.eckert@citrix.com>
diff --git a/tools/libxc/xc_dom_elfloader.c b/tools/libxc/xc_dom_elfloader.c
index 906e3a2..4d7b8e0 100644
--- a/tools/libxc/xc_dom_elfloader.c
+++ b/tools/libxc/xc_dom_elfloader.c
@@ -237,7 +237,7 @@ static int xc_dom_load_elf_symtab(struct xc_dom_image *dom,
/* Name is NULL. */
if ( elf_64bit(&syms) )
- *(Elf64_Half*)(&shdr->e64.sh_name) = 0;
+ *(Elf64_Word*)(&shdr->e64.sh_name) = 0;
else
*(Elf32_Word*)(&shdr->e32.sh_name) = 0;
}
diff --git a/xen/include/xen/elfstructs.h b/xen/include/xen/elfstructs.h
index 62f9399..1c46cd4 100644
--- a/xen/include/xen/elfstructs.h
+++ b/xen/include/xen/elfstructs.h
@@ -44,7 +44,7 @@ typedef uint32_t Elf64_Word;
typedef int64_t Elf64_Sxword;
typedef uint64_t Elf64_Xword;
-typedef uint32_t Elf64_Half;
+typedef uint16_t Elf64_Half;
typedef uint16_t Elf64_Quarter;
/*
@@ -129,11 +129,11 @@ typedef struct {
unsigned char e_ident[EI_NIDENT]; /* Id bytes */
Elf64_Quarter e_type; /* file type */
Elf64_Quarter e_machine; /* machine type */
- Elf64_Half e_version; /* version number */
+ Elf64_Word e_version; /* version number */
Elf64_Addr e_entry; /* entry point */
Elf64_Off e_phoff; /* Program hdr offset */
Elf64_Off e_shoff; /* Section hdr offset */
- Elf64_Half e_flags; /* Processor flags */
+ Elf64_Word e_flags; /* Processor flags */
Elf64_Quarter e_ehsize; /* sizeof ehdr */
Elf64_Quarter e_phentsize; /* Program header entry size */
Elf64_Quarter e_phnum; /* Number of program headers */
@@ -202,14 +202,14 @@ typedef struct {
} Elf32_Shdr;
typedef struct {
- Elf64_Half sh_name; /* section name */
- Elf64_Half sh_type; /* section type */
+ Elf64_Word sh_name; /* section name */
+ Elf64_Word sh_type; /* section type */
Elf64_Xword sh_flags; /* section flags */
Elf64_Addr sh_addr; /* virtual address */
Elf64_Off sh_offset; /* file offset */
Elf64_Xword sh_size; /* section size */
- Elf64_Half sh_link; /* link to another */
- Elf64_Half sh_info; /* misc info */
+ Elf64_Word sh_link; /* link to another */
+ Elf64_Word sh_info; /* misc info */
Elf64_Xword sh_addralign; /* memory alignment */
Elf64_Xword sh_entsize; /* table entry size */
} Elf64_Shdr;
@@ -284,7 +284,7 @@ typedef struct elf32_sym {
} Elf32_Sym;
typedef struct {
- Elf64_Half st_name; /* Symbol name index in str table */
+ Elf64_Word st_name; /* Symbol name index in str table */
Elf_Byte st_info; /* type / binding attrs */
Elf_Byte st_other; /* unused */
Elf64_Quarter st_shndx; /* section index of symbol */
@@ -368,8 +368,8 @@ typedef struct {
} Elf32_Phdr;
typedef struct {
- Elf64_Half p_type; /* entry type */
- Elf64_Half p_flags; /* flags */
+ Elf64_Word p_type; /* entry type */
+ Elf64_Word p_flags; /* flags */
Elf64_Off p_offset; /* offset */
Elf64_Addr p_vaddr; /* virtual address */
Elf64_Addr p_paddr; /* physical address */
@@ -458,9 +458,9 @@ typedef struct {
} Elf32_Note;
typedef struct {
- Elf64_Half namesz;
- Elf64_Half descsz;
- Elf64_Half type;
+ Elf64_Word namesz;
+ Elf64_Word descsz;
+ Elf64_Word type;
} Elf64_Note;
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: ELF header data types / elfstructs.h, Elf64_Half, Elf64_Quarter
2011-11-16 17:20 ELF header data types / elfstructs.h, Elf64_Half, Elf64_Quarter Volker Eckert
2011-11-16 17:42 ` Andrew Cooper
@ 2011-11-16 18:22 ` Keir Fraser
1 sibling, 0 replies; 6+ messages in thread
From: Keir Fraser @ 2011-11-16 18:22 UTC (permalink / raw)
To: Volker Eckert, xen-devel
On 16/11/2011 17:20, "Volker Eckert" <volker.eckert@citrix.com> wrote:
> hi,
>
> according to two ELF standard documents, namely
> http://downloads.openwatcom.org/ftp/devel/docs/elf-64-gen.pdf
> and
> http://ftp.parisc-linux.org/docs/arch/elf-64-hp.pdf
>
> Elf64_Half should be uint16_t and not uint32_t as it is currently
> defined in elfstructs.h
>
> i guess this is, because Elf.._Half is supposed to mean 'half a word'
> (whatever that was at that time) and not 'half of 64 bits' like the name
> could suggest.
>
> in that context i'd suggest replacing occurences of Elf64_Quarter with
> Elf64_Half and removing its definition - but as it is not defined in the
> standard it is more of a cosmetic issue.
>
> please find a patch against xen-unstable below - i hope this is
> acceptable(?). as i'm not subscribed to the list please CC me in
> replies, thanks!
Yes, but in fact it could go further because Elf64_Quarter is not needed,
nor defined in the spec.
I have gone through the spec and done the further fixups.
The complete patch is now in xen-unstable as c/s 24154.
Thanks!
Keir
> volker
>
>
> p. s.: i think there is a check for Python.h missing in some configure.in
>
>
>
>
>
>
> diff --git a/tools/libxc/xc_dom_elfloader.c b/tools/libxc/xc_dom_elfloader.c
> index 906e3a2..4d7b8e0 100644
> --- a/tools/libxc/xc_dom_elfloader.c
> +++ b/tools/libxc/xc_dom_elfloader.c
> @@ -237,7 +237,7 @@ static int xc_dom_load_elf_symtab(struct
> xc_dom_image *dom,
>
> /* Name is NULL. */
> if ( elf_64bit(&syms) )
> - *(Elf64_Half*)(&shdr->e64.sh_name) = 0;
> + *(Elf64_Word*)(&shdr->e64.sh_name) = 0;
> else
> *(Elf32_Word*)(&shdr->e32.sh_name) = 0;
> }
> diff --git a/xen/include/xen/elfstructs.h b/xen/include/xen/elfstructs.h
> index 62f9399..1c46cd4 100644
> --- a/xen/include/xen/elfstructs.h
> +++ b/xen/include/xen/elfstructs.h
> @@ -44,7 +44,7 @@ typedef uint32_t Elf64_Word;
> typedef int64_t Elf64_Sxword;
> typedef uint64_t Elf64_Xword;
>
> -typedef uint32_t Elf64_Half;
> +typedef uint16_t Elf64_Half;
> typedef uint16_t Elf64_Quarter;
>
> /*
> @@ -129,11 +129,11 @@ typedef struct {
> unsigned char e_ident[EI_NIDENT]; /* Id bytes */
> Elf64_Quarter e_type; /* file type */
> Elf64_Quarter e_machine; /* machine type */
> - Elf64_Half e_version; /* version number */
> + Elf64_Word e_version; /* version number */
> Elf64_Addr e_entry; /* entry point */
> Elf64_Off e_phoff; /* Program hdr offset */
> Elf64_Off e_shoff; /* Section hdr offset */
> - Elf64_Half e_flags; /* Processor flags */
> + Elf64_Word e_flags; /* Processor flags */
> Elf64_Quarter e_ehsize; /* sizeof ehdr */
> Elf64_Quarter e_phentsize; /* Program header entry
> size */
> Elf64_Quarter e_phnum; /* Number of program
> headers */
> @@ -202,14 +202,14 @@ typedef struct {
> } Elf32_Shdr;
>
> typedef struct {
> - Elf64_Half sh_name; /* section name */
> - Elf64_Half sh_type; /* section type */
> + Elf64_Word sh_name; /* section name */
> + Elf64_Word sh_type; /* section type */
> Elf64_Xword sh_flags; /* section flags */
> Elf64_Addr sh_addr; /* virtual address */
> Elf64_Off sh_offset; /* file offset */
> Elf64_Xword sh_size; /* section size */
> - Elf64_Half sh_link; /* link to another */
> - Elf64_Half sh_info; /* misc info */
> + Elf64_Word sh_link; /* link to another */
> + Elf64_Word sh_info; /* misc info */
> Elf64_Xword sh_addralign; /* memory alignment */
> Elf64_Xword sh_entsize; /* table entry size */
> } Elf64_Shdr;
> @@ -284,7 +284,7 @@ typedef struct elf32_sym {
> } Elf32_Sym;
>
> typedef struct {
> - Elf64_Half st_name; /* Symbol name index in str table */
> + Elf64_Word st_name; /* Symbol name index in str table */
> Elf_Byte st_info; /* type / binding attrs */
> Elf_Byte st_other; /* unused */
> Elf64_Quarter st_shndx; /* section index of symbol */
> @@ -368,8 +368,8 @@ typedef struct {
> } Elf32_Phdr;
>
> typedef struct {
> - Elf64_Half p_type; /* entry type */
> - Elf64_Half p_flags; /* flags */
> + Elf64_Word p_type; /* entry type */
> + Elf64_Word p_flags; /* flags */
> Elf64_Off p_offset; /* offset */
> Elf64_Addr p_vaddr; /* virtual address */
> Elf64_Addr p_paddr; /* physical address */
> @@ -458,9 +458,9 @@ typedef struct {
> } Elf32_Note;
>
> typedef struct {
> - Elf64_Half namesz;
> - Elf64_Half descsz;
> - Elf64_Half type;
> + Elf64_Word namesz;
> + Elf64_Word descsz;
> + Elf64_Word type;
> } Elf64_Note;
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ELF header data types / elfstructs.h, Elf64_Half, Elf64_Quarter
2011-11-16 18:12 ` Volker Eckert
@ 2011-11-16 18:26 ` Keir Fraser
0 siblings, 0 replies; 6+ messages in thread
From: Keir Fraser @ 2011-11-16 18:26 UTC (permalink / raw)
To: Volker Eckert, xen-devel@lists.xensource.com
On 16/11/2011 18:12, "Volker Eckert" <volker.eckert@citrix.com> wrote:
> Andrew, thank you for the prompt reply.
>
>>> Please read http://wiki.xen.org/wiki/SubmittingXenPatches
>>>
>>> Specifically, you need to make a declaration of origin.
>
> please find the patch attached in a separate file, with a declaration of
> origin. i don't have hg installed, so it is still created using git. the
> wiki page doesn't say anything about hg being the exclusive way for
> patch submissions so i hope that is acceptable.
>
>
>>> It is a good idea to attach your patch as a file as quite a few mail
>>> clients mangle whitespace of the email text.
>
> done, sorry about that.
>
>
>> P.S. Please match the whitespace conventions of the file you are working
>> in, which you have not done in your submitted patch.
>
> i guess they got mangled by the mailer(?)
Yes.
-- Keir
> as i only replaced parts of words i didn't change any whitespace - it
> was and still is 4 spaces per indentation inside xc_dom_elfloader.c and
> tabs for the rest of the files, which i just checked. unless i am
> missing something...
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-11-16 18:26 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-16 17:20 ELF header data types / elfstructs.h, Elf64_Half, Elf64_Quarter Volker Eckert
2011-11-16 17:42 ` Andrew Cooper
2011-11-16 17:44 ` Andrew Cooper
2011-11-16 18:12 ` Volker Eckert
2011-11-16 18:26 ` Keir Fraser
2011-11-16 18:22 ` Keir Fraser
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).