From: Jeremy Fitzhardinge <jeremy@goop.org>
To: "Eric W. Biederman" <ebiederm@xmission.com>,
"H. Peter Anvin" <hpa@zytor.com>
Cc: lkml <linux-kernel@vger.kernel.org>,
Vivek Goyal <vgoyal@in.ibm.com>,
v12n <virtualization@lists.linux-foundation.org>
Subject: [PATCH RFC 3/7] allow linux/elf.h to be included in assembler
Date: Wed, 06 Jun 2007 15:58:40 -0700 [thread overview]
Message-ID: <20070606230922.257728963@goop.org> (raw)
In-Reply-To: 20070606225837.654272428@goop.org
[-- Attachment #1: asm-elf_h.patch --]
[-- Type: text/plain, Size: 3726 bytes --]
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
---
include/linux/elf.h | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
===================================================================
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -1,9 +1,10 @@
#ifndef _LINUX_ELF_H
#define _LINUX_ELF_H
+#include <linux/elf-em.h>
+#ifndef __ASSEMBLY__
#include <linux/types.h>
#include <linux/auxvec.h>
-#include <linux/elf-em.h>
#include <asm/elf.h>
struct file;
@@ -31,6 +32,7 @@ typedef __u32 Elf64_Word;
typedef __u32 Elf64_Word;
typedef __u64 Elf64_Xword;
typedef __s64 Elf64_Sxword;
+#endif /* __ASSEMBLY__ */
/* These constants are for the segment types stored in the image headers */
#define PT_NULL 0
@@ -123,6 +125,7 @@ typedef __s64 Elf64_Sxword;
#define ELF64_ST_BIND(x) ELF_ST_BIND(x)
#define ELF64_ST_TYPE(x) ELF_ST_TYPE(x)
+#ifndef __ASSEMBLY__
typedef struct dynamic{
Elf32_Sword d_tag;
union{
@@ -138,6 +141,7 @@ typedef struct {
Elf64_Addr d_ptr;
} d_un;
} Elf64_Dyn;
+#endif /* __ASSEMBLY__ */
/* The following are used with relocations */
#define ELF32_R_SYM(x) ((x) >> 8)
@@ -146,6 +150,7 @@ typedef struct {
#define ELF64_R_SYM(i) ((i) >> 32)
#define ELF64_R_TYPE(i) ((i) & 0xffffffff)
+#ifndef __ASSEMBLY__
typedef struct elf32_rel {
Elf32_Addr r_offset;
Elf32_Word r_info;
@@ -185,11 +190,12 @@ typedef struct elf64_sym {
Elf64_Addr st_value; /* Value of the symbol */
Elf64_Xword st_size; /* Associated symbol size */
} Elf64_Sym;
-
+#endif /* __ASSEMBLY__ */
#define EI_NIDENT 16
-typedef struct elf32_hdr{
+#ifndef __ASSEMBLY__
+typedef struct elf32_hdr {
unsigned char e_ident[EI_NIDENT];
Elf32_Half e_type;
Elf32_Half e_machine;
@@ -222,6 +228,7 @@ typedef struct elf64_hdr {
Elf64_Half e_shnum;
Elf64_Half e_shstrndx;
} Elf64_Ehdr;
+#endif /* __ASSEMBLY__ */
/* These constants define the permissions on sections in the program
header, p_flags. */
@@ -229,7 +236,8 @@ typedef struct elf64_hdr {
#define PF_W 0x2
#define PF_X 0x1
-typedef struct elf32_phdr{
+#ifndef __ASSEMBLY__
+typedef struct elf32_phdr {
Elf32_Word p_type;
Elf32_Off p_offset;
Elf32_Addr p_vaddr;
@@ -250,6 +258,7 @@ typedef struct elf64_phdr {
Elf64_Xword p_memsz; /* Segment size in memory */
Elf64_Xword p_align; /* Segment alignment, file & memory */
} Elf64_Phdr;
+#endif /* __ASSEMBLY__ */
/* sh_type */
#define SHT_NULL 0
@@ -284,7 +293,8 @@ typedef struct elf64_phdr {
#define SHN_ABS 0xfff1
#define SHN_COMMON 0xfff2
#define SHN_HIRESERVE 0xffff
-
+
+#ifndef __ASSEMBLY__
typedef struct {
Elf32_Word sh_name;
Elf32_Word sh_type;
@@ -310,6 +320,7 @@ typedef struct elf64_shdr {
Elf64_Xword sh_addralign; /* Section alignment */
Elf64_Xword sh_entsize; /* Entry size if section holds table */
} Elf64_Shdr;
+#endif /* __ASSEMBLY__ */
#define EI_MAG0 0 /* e_ident[] indexes */
#define EI_MAG1 1
@@ -343,6 +354,7 @@ typedef struct elf64_shdr {
#define ELFOSABI_NONE 0
#define ELFOSABI_LINUX 3
+#define ELFOSABI_STANDALONE 255
#ifndef ELF_OSABI
#define ELF_OSABI ELFOSABI_NONE
@@ -357,6 +369,7 @@ typedef struct elf64_shdr {
#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */
+#ifndef __ASSEMBLY__
/* Note header in a PT_NOTE section */
typedef struct elf32_note {
Elf32_Word n_namesz; /* Name size */
@@ -396,5 +409,6 @@ static inline void arch_write_notes(stru
#define ELF_CORE_EXTRA_NOTES_SIZE arch_notes_size()
#define ELF_CORE_WRITE_EXTRA_NOTES arch_write_notes(file)
#endif /* ARCH_HAVE_EXTRA_ELF_NOTES */
+#endif /* __ASSEMBLY__ */
#endif /* _LINUX_ELF_H */
--
next prev parent reply other threads:[~2007-06-06 22:58 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-06 22:58 [PATCH RFC 0/7] proposed updates to boot protocol and paravirt booting Jeremy Fitzhardinge
2007-06-06 22:58 ` [PATCH RFC 1/7] update boot spec to 2.07 Jeremy Fitzhardinge
2007-06-06 22:58 ` [PATCH RFC 2/7] add WEAK() for creating weak asm labels Jeremy Fitzhardinge
2007-06-06 22:58 ` Jeremy Fitzhardinge [this message]
2007-06-06 22:58 ` [PATCH RFC 4/7] define ELF notes for adding to a boot image Jeremy Fitzhardinge
2007-06-06 22:58 ` [PATCH RFC 5/7] i386: clean up bzImage generation Jeremy Fitzhardinge
2007-06-06 22:58 ` [PATCH RFC 6/7] i386: make the bzImage payload an ELF file Jeremy Fitzhardinge
2007-06-06 23:41 ` H. Peter Anvin
2007-06-06 23:56 ` Jeremy Fitzhardinge
[not found] ` <466749C8.2010700@goop.org>
2007-06-07 0:08 ` H. Peter Anvin
[not found] ` <46674C96.7090104@zytor.com>
2007-06-07 0:20 ` Jeremy Fitzhardinge
[not found] ` <46674F68.6030100@goop.org>
2007-06-07 0:42 ` H. Peter Anvin
[not found] ` <4667547B.8080502@zytor.com>
2007-06-07 1:01 ` Jeremy Fitzhardinge
2007-06-08 3:49 ` Vivek Goyal
[not found] ` <20070608034958.GA10728@in.ibm.com>
2007-06-08 4:01 ` H. Peter Anvin
2007-06-07 1:47 ` Rob Landley
[not found] ` <200706062147.21225.rob@landley.net>
2007-06-07 1:54 ` H. Peter Anvin
2007-06-07 16:08 ` Rob Landley
[not found] ` <200706071208.04777.rob@landley.net>
2007-06-07 16:14 ` H. Peter Anvin
2007-06-06 22:58 ` [PATCH RFC 7/7] i386: paravirt boot sequence Jeremy Fitzhardinge
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070606230922.257728963@goop.org \
--to=jeremy@goop.org \
--cc=ebiederm@xmission.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=vgoyal@in.ibm.com \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).