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.
Unified · Split
| @@ -295,11 +295,11 @@ static void put_elf_reloc(Section *symtab, Section *s, unsigned long offset, · 294 unmodified lines | |||
| 295 | /* put stab debug information */ | 295 | /* put stab debug information */ |
| 296 | 296 | ||
| 297 | typedef struct { | 297 | typedef struct { |
| 298 | unsigned long n_strx; /* index into string table of name */ | 298 | unsigned int n_strx; /* index into string table of name */ |
| 299 | unsigned char n_type; /* type of symbol */ | 299 | unsigned char n_type; /* type of symbol */ |
| 300 | unsigned char n_other; /* misc info (usually empty) */ | 300 | unsigned char n_other; /* misc info (usually empty) */ |
| 301 | unsigned short n_desc; /* description field */ | 301 | unsigned short n_desc; /* description field */ |
| 302 | unsigned long n_value; /* value of symbol */ | 302 | unsigned int n_value; /* value of symbol */ |
| 303 | } Stab_Sym; | 303 | } Stab_Sym; |
| 304 | 304 | ||
| 305 | static void put_stabs(const char *str, int type, int other, int desc, | 305 | 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, · 18 unmodified lines | |||
| 324 | { | 324 | { |
| 325 | put_stabs(str, type, other, desc, value); | 325 | put_stabs(str, type, other, desc, value); |
| 326 | put_elf_reloc(symtab_section, stab_section, | 326 | put_elf_reloc(symtab_section, stab_section, |
| 327 | stab_section->data_offset - sizeof(unsigned long), | 327 | stab_section->data_offset - sizeof(unsigned int), |
| 328 | R_DATA_32, sym_index); | 328 | R_DATA_32, sym_index); |
| 329 | } | 329 | } |
| 330 | 330 | ||