/[gcl]/gcl/o/sfaslelf.c
ViewVC logotype

Diff of /gcl/o/sfaslelf.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8.6.6 by camm, Mon Mar 8 22:02:24 2004 UTC revision 1.8.6.6.10.1 by camm, Thu Jan 13 22:42:53 2005 UTC
# Line 133  char *the_start,*start_address; Line 133  char *the_start,*start_address;
133    
134    
135  /* align for power of two n */  /* align for power of two n */
136  static void *  /* static void * */
137  round_up(address,n)  /* round_up(unsigned long address,unsigned long n) { */
138       unsigned int address,n;  /* { */
139  {  /*  return  (void *)((address + n -1) & ~(n-1)) ; */
140   return  (void *)((address + n -1) & ~(n-1)) ;  /* } */
141  }  #define ROUND_UP(_addr,_ps) ((void *)(((unsigned long)_addr + (unsigned long)_ps -1) & ~((unsigned long)_ps-1)))
 #define ROUND_UP(a,b) round_up(a,b)  
142    
143  int use_mmap;  int use_mmap;
144    
# Line 309  fasload(faslfile) Line 308  fasload(faslfile)
308       }       }
309    
310     {     {
311       int j=0;       int j;
312       for (j=1 ; j <  file_h->e_shnum ; j++)  
313         {       for (j=1 ; j <  file_h->e_shnum ; j++) {
314    
315           shp = &SECTION_H(j);           shp = &SECTION_H(j);
316           if ((shp->sh_type == SHT_RELA || shp->sh_type == SHT_REL) &&           if ((shp->sh_type == SHT_RELA || shp->sh_type == SHT_REL) &&
317               shp->sh_info<file_h->e_shnum &&               shp->sh_info<file_h->e_shnum &&
318               (SECTION_H(shp->sh_info).sh_flags & SHF_ALLOC))               (SECTION_H(shp->sh_info).sh_flags & SHF_ALLOC)
319             {               && (SECTION_H(shp->sh_info).sh_type == SHT_PROGBITS
320               int index_to_relocate = shp->sh_info;                  || SECTION_H(shp->sh_info).sh_type == SHT_NOBITS)) {
321    
322               int k;
323               char *rel = (char *) base +   shp->sh_offset;
324    
325               if (symtab_index != shp->sh_link)               if (symtab_index != shp->sh_link)
326                 FEerror("unexpected symbol table used",0);                 FEerror("unexpected symbol table used",0);
327               the_start = start_address + section[index_to_relocate].start;             the_start = start_address + section[shp->sh_info].start;
            }  
 /*       else if (shp->sh_type == SHT_REL */  
 /*           && (SECTION_H(shp->sh_info).sh_flags & SHF_ALLOC)) */  
 /*         { */  
 /*           int index_to_relocate = shp->sh_info; */  
 /*           if (symtab_index != shp->sh_link) */  
 /*             FEerror("unexpected symbol table used"); */  
 /*           the_start = start_address + section[index_to_relocate].start; */  
 /*         } */  
328                    
          else if ( (shp->sh_type == SHT_REL) || (shp->sh_type == SHT_RELA) )  
            {  if (/* get_section_number(".rel.stab") == j || */  
                   /* Newer gcc uses these section name -- CMM 20040224*/  
                   !strncmp(section_names+SECTION_H(j).sh_name,".rel.debug",10) ||  
                   /* old in for backward compatibility */  
                   !strcmp(section_names+SECTION_H(j).sh_name,".rel.stab"))  
                  continue;  
              FEerror("unknown rel type",0);  
            }  
          else  
            continue;  
          {  
            int k=0;  
            char *rel = (char *) base +   shp->sh_offset;  
329             for (k= 0; k< shp->sh_size ; k+= shp->sh_entsize)             for (k= 0; k< shp->sh_size ; k+= shp->sh_entsize)
330               relocate(symbol_table,(Elf32_Rela *)(rel + k),shp->sh_type);               relocate(symbol_table,(Elf32_Rela *)(rel + k),shp->sh_type);
331    
332           }           }
333    
334         }         }
335    
336     }     }
337    
338  #ifdef STAND  #ifdef STAND
# Line 692  relocate_symbols(sym,nsyms,nscns,init_ad Line 676  relocate_symbols(sym,nsyms,nscns,init_ad
676                    default:                    default:
677                      printf("[unknown rel secn %d type=%d]",                      printf("[unknown rel secn %d type=%d]",
678                             sym->st_shndx,                             sym->st_shndx,
679                             SECTION_H(sym->st_shndx).sh_type);                             (int)SECTION_H(sym->st_shndx).sh_type);
680                    }                    }
681                }                }
682              else              else
# Line 708  relocate_symbols(sym,nsyms,nscns,init_ad Line 692  relocate_symbols(sym,nsyms,nscns,init_ad
692                if (sym->st_shndx == text_index &&                if (sym->st_shndx == text_index &&
693                    bcmp("init_",string_table + sym->st_name,4) == 0)                    bcmp("init_",string_table + sym->st_name,4) == 0)
694                  {                  {
695                    *init_address_ptr = sym->st_value;                    *init_address_ptr = sym->st_value+section[sym->st_shndx].start;
696    
697                    }                    }
698              else                      else        

Legend:
Removed from v.1.8.6.6  
changed lines
  Added in v.1.8.6.6.10.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26