Rev 159 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 159 | Rev 609 | ||
---|---|---|---|
Line 94... | Line 94... | ||
94 | if (sym>symtab_section->data_offset/sizeof(Elf32_Sym)) |
94 | if (sym>symtab_section->data_offset/sizeof(Elf32_Sym)) |
95 | continue; |
95 | continue; |
96 | Elf32_Sym* esym = ((Elf32_Sym *)symtab_section->data)+sym; |
96 | Elf32_Sym* esym = ((Elf32_Sym *)symtab_section->data)+sym; |
97 | int sect=esym->st_shndx; |
97 | int sect=esym->st_shndx; |
98 | ss=findsection(me,sect); |
98 | ss=findsection(me,sect); |
99 | if (ss==0) |
99 | if (ss==0) continue; |
100 | ss=me->bss_sections; |
- | |
101 | if (rel->r_offset>s->data_size) |
100 | if (rel->r_offset>s->data_size) |
102 | continue; |
101 | continue; |
103 | if (type==R_386_PC32) |
102 | if (type==R_386_PC32) |
104 | *(int*)(rel->r_offset+s->data)=ss->sh_addr+esym->st_value-rel->r_offset-s->sh_addr-4; |
103 | *(int*)(rel->r_offset+s->data)+=ss->sh_addr+esym->st_value-rel->r_offset-s->sh_addr; |
105 | else if (type==R_386_32) |
104 | else if (type==R_386_32) |
106 | *(int*)(rel->r_offset+s->data)+=ss->sh_addr+esym->st_value; |
105 | *(int*)(rel->r_offset+s->data)+=ss->sh_addr+esym->st_value; |
107 | } |
106 | } |
108 | rel=rel_; |
107 | rel=rel_; |
109 | s=s->next; |
108 | s=s->next; |
Line 225... | Line 224... | ||
225 | //printf("%d\n",s1->nb_sections); |
224 | //printf("%d\n",s1->nb_sections); |
226 | memset(&me,0,sizeof(me)); |
225 | memset(&me,0,sizeof(me)); |
227 | me.s1=s1; |
226 | me.s1=s1; |
228 | relocate_common_syms(); |
227 | relocate_common_syms(); |
229 | assign_addresses(&me); |
228 | assign_addresses(&me); |
230 | me.header.version=1; |
- | |
231 | me.header.entry_point=tcc_find_symbol_me(&me,"start"); |
229 | me.header.entry_point=tcc_find_symbol_me(&me,"start"); |
232 | me.header.params= tcc_find_symbol_me(&me,"__argv"); // <-- |
230 | me.header.params= tcc_find_symbol_me(&me,"__argv"); // <-- |
233 | me.header.argv= tcc_find_symbol_me(&me,"__path"); // <-- |
231 | me.header.argv= tcc_find_symbol_me(&me,"__path"); // <-- |
Line 234... | Line 232... | ||
234 | 232 |