bootstrappable: Outline enums, structs, unions.

This commit is contained in:
Jan Nieuwenhuizen 2017-07-23 21:09:00 +02:00
parent 101060edb3
commit b28cc512db
3 changed files with 72 additions and 49 deletions

80
elf.h
View File

@ -655,24 +655,28 @@ typedef struct
/* Dynamic section entry. */
union Elf32_Dyn_un
{
Elf32_Word d_val; /* Integer value */
Elf32_Addr d_ptr; /* Address value */
};
typedef struct
{
Elf32_Sword d_tag; /* Dynamic entry type */
union
{
Elf32_Word d_val; /* Integer value */
Elf32_Addr d_ptr; /* Address value */
} d_un;
union Elf32_Dyn_un d_un;
} Elf32_Dyn;
union Elf64_Dyn_un
{
Elf64_Xword d_val; /* Integer value */
Elf64_Addr d_ptr; /* Address value */
};
typedef struct
{
Elf64_Sxword d_tag; /* Dynamic entry type */
union
{
Elf64_Xword d_val; /* Integer value */
Elf64_Addr d_ptr; /* Address value */
} d_un;
union Elf64_Dyn_un d_un;
} Elf64_Dyn;
/* Legal values for d_tag (dynamic entry type). */
@ -954,28 +958,32 @@ typedef struct
types are an arrangement between the exec server and the program
interpreter, so we don't fully specify them here. */
union Elf32_auxv_t_a_un
{
uint32_t a_val; /* Integer value */
/* We use to have pointer elements added here. We cannot do that,
though, since it does not work when using 32-bit definitions
on 64-bit platforms and vice versa. */
};
typedef struct
{
uint32_t a_type; /* Entry type */
union
{
uint32_t a_val; /* Integer value */
/* We use to have pointer elements added here. We cannot do that,
though, since it does not work when using 32-bit definitions
on 64-bit platforms and vice versa. */
} a_un;
union Elf32_auxv_t_a_un a_un;
} Elf32_auxv_t;
union Elf64_auxv_t_a_un
{
uint64_t a_val; /* Integer value */
/* We use to have pointer elements added here. We cannot do that,
though, since it does not work when using 32-bit definitions
on 64-bit platforms and vice versa. */
};
typedef struct
{
uint64_t a_type; /* Entry type */
union
{
uint64_t a_val; /* Integer value */
/* We use to have pointer elements added here. We cannot do that,
though, since it does not work when using 32-bit definitions
on 64-bit platforms and vice versa. */
} a_un;
union Elf64_auxv_t_a_un a_un;
} Elf64_auxv_t;
/* Legal values for a_type (entry type). */
@ -1486,18 +1494,22 @@ typedef struct
/* Entries found in sections of type SHT_MIPS_GPTAB. */
struct Elf32_gptab_header
{
Elf32_Word gt_current_g_value; /* -G value used for compilation */
Elf32_Word gt_unused; /* Not used */
};
struct Elf32_gptab_entry
{
Elf32_Word gt_g_value; /* If this value were used for -G */
Elf32_Word gt_bytes; /* This many bytes would be used */
};
typedef union
{
struct
{
Elf32_Word gt_current_g_value; /* -G value used for compilation */
Elf32_Word gt_unused; /* Not used */
} gt_header; /* First entry in section */
struct
{
Elf32_Word gt_g_value; /* If this value were used for -G */
Elf32_Word gt_bytes; /* This many bytes would be used */
} gt_entry; /* Subsequent entries in section */
struct Elf32_gptab_header gt_header;
struct Elf32_gptab_entry gt_entry;
} Elf32_gptab;
/* Entry found in sections of type SHT_MIPS_REGINFO. */

25
tcc.h
View File

@ -400,6 +400,12 @@ typedef struct CType {
struct Sym *ref;
} CType;
struct CValue_str {
int size;
const void *data;
};
/* constant value */
typedef union CValue {
#if HAVE_FLOAT
@ -412,10 +418,7 @@ typedef union CValue {
int f;
#endif
uint64_t i;
struct {
int size;
const void *data;
} str;
struct CValue_str str;
int tab[LDOUBLE_SIZE/4];
} CValue;
@ -659,6 +662,13 @@ struct sym_attr {
#endif
};
enum TCCState_pflag {
LINE_MACRO_OUTPUT_FORMAT_GCC,
LINE_MACRO_OUTPUT_FORMAT_NONE,
LINE_MACRO_OUTPUT_FORMAT_STD,
LINE_MACRO_OUTPUT_FORMAT_P10 = 11
};
struct TCCState {
int verbose; /* if true, display some information during compilation */
@ -752,12 +762,7 @@ struct TCCState {
/* output file for preprocessing (-E) */
FILE *ppfp;
enum {
LINE_MACRO_OUTPUT_FORMAT_GCC,
LINE_MACRO_OUTPUT_FORMAT_NONE,
LINE_MACRO_OUTPUT_FORMAT_STD,
LINE_MACRO_OUTPUT_FORMAT_P10 = 11
} Pflag; /* -P switch */
enum TCCState_pflag Pflag;
char dflag; /* -dX value */
/* for -MD/-MF: collected dependencies for this compilation */

View File

@ -60,13 +60,19 @@ ST_DATA const char *funcname;
ST_DATA CType char_pointer_type, func_old_type, int_type, size_type;
struct case_t {
int64_t v1;
int64_t v2;
int sym;
};
ST_DATA struct switch_t {
struct case_t {
int64_t v1, v2;
int sym;
} **p; int n; /* list of case ranges */
struct case_t **p;
int n; /* list of case ranges */
int def_sym; /* default symbol */
} *cur_switch; /* current switch */
};
struct switch_t *cur_switch;
/* ------------------------------------------------------------------------- */