From 754b0beb7d446031cd08777dbd2fbcdeca675e34 Mon Sep 17 00:00:00 2001
From: Shinichiro Hamaji <shinichiro.hamaji _at_ gmail.com>
Date: Sat, 4 Apr 2009 03:09:35 +0900
Subject: [PATCH] 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.
---
 tccelf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tccelf.c b/tccelf.c
index 926a9ff4..12ec736b 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);
 }