aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinichiro Hamaji <shinichiro.hamaji _at_ gmail.com>2009-04-04 03:09:35 +0900
committergrischka <grischka>2009-04-18 15:07:09 +0200
commit754b0beb7d446031cd08777dbd2fbcdeca675e34 (patch)
treebc709242cc08ef9f6441f70001313d30617e5146
parente6db5f5fb670598cc6dc9750537c1df39fa4e527 (diff)
downloadtinycc-754b0beb7d446031cd08777dbd2fbcdeca675e34.tar.gz
tinycc-754b0beb7d446031cd08777dbd2fbcdeca675e34.tar.bz2
x86-64 bug fix: Fix stab generation for x86-64.
The size of a stab entry is 12 bytes even in 64bit environments. We must use int instead of long to keep the size of stab entries.
-rw-r--r--tccelf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tccelf.c b/tccelf.c
index 926a9ff..12ec736 100644
--- a/tccelf.c
+++ b/tccelf.c
@@ -295,11 +295,11 @@ static void put_elf_reloc(Section *symtab, Section *s, unsigned long offset,
/* put stab debug information */
typedef struct {
- unsigned long n_strx; /* index into string table of name */
+ unsigned int n_strx; /* index into string table of name */
unsigned char n_type; /* type of symbol */
unsigned char n_other; /* misc info (usually empty) */
unsigned short n_desc; /* description field */
- unsigned long n_value; /* value of symbol */
+ unsigned int n_value; /* value of symbol */
} Stab_Sym;
static void put_stabs(const char *str, int type, int other, int desc,
@@ -324,7 +324,7 @@ static void put_stabs_r(const char *str, int type, int other, int desc,
{
put_stabs(str, type, other, desc, value);
put_elf_reloc(symtab_section, stab_section,
- stab_section->data_offset - sizeof(unsigned long),
+ stab_section->data_offset - sizeof(unsigned int),
R_DATA_32, sym_index);
}