/[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.14 by camm, Mon Mar 8 22:02:52 2004 UTC revision 1.15 by camm, Mon Aug 23 23:09:23 2004 UTC
# Line 132  char *the_start,*start_address; Line 132  char *the_start,*start_address;
132    
133    
134  /* align for power of two n */  /* align for power of two n */
135  static void *  /* static void * */
136  round_up(address,n)  /* round_up(unsigned long address,unsigned long n) { */
137       unsigned int address,n;  /* { */
138  {  /*  return  (void *)((address + n -1) & ~(n-1)) ; */
139   return  (void *)((address + n -1) & ~(n-1)) ;  /* } */
140  }  #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)  
141    
142  int use_mmap;  int use_mmap;
143    
# Line 308  fasload(faslfile) Line 307  fasload(faslfile)
307       }       }
308    
309     {     {
310       int j=0;       int j;
311       for (j=1 ; j <  file_h->e_shnum ; j++)  
312         {       for (j=1 ; j <  file_h->e_shnum ; j++) {
313    
314           shp = &SECTION_H(j);           shp = &SECTION_H(j);
315           if ((shp->sh_type == SHT_RELA || shp->sh_type == SHT_REL) &&           if ((shp->sh_type == SHT_RELA || shp->sh_type == SHT_REL) &&
316               shp->sh_info<file_h->e_shnum &&               shp->sh_info<file_h->e_shnum &&
317               (SECTION_H(shp->sh_info).sh_flags & SHF_ALLOC))               (SECTION_H(shp->sh_info).sh_flags & SHF_ALLOC)
318             {               && (SECTION_H(shp->sh_info).sh_type == SHT_PROGBITS
319               int index_to_relocate = shp->sh_info;                  || SECTION_H(shp->sh_info).sh_type == SHT_NOBITS)) {
320               if (symtab_index != shp->sh_link)  
321                 FEerror("unexpected symbol table used",0);             int k;
              the_start = start_address + section[index_to_relocate].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; */  
 /*         } */  
           
          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;  
322             char *rel = (char *) base +   shp->sh_offset;             char *rel = (char *) base +   shp->sh_offset;
323    
324               if (symtab_index != shp->sh_link)
325                 FEerror("unexpected symbol table used",0);
326               the_start = start_address + section[shp->sh_info].start;
327    
328             for (k= 0; k< shp->sh_size ; k+= shp->sh_entsize)             for (k= 0; k< shp->sh_size ; k+= shp->sh_entsize)
329               relocate(symbol_table,(Elf32_Rela *)(rel + k),shp->sh_type);               relocate(symbol_table,(Elf32_Rela *)(rel + k),shp->sh_type);
330    
331           }           }
332         }  
333         }
334    
335     }     }
336    
337  #ifdef STAND  #ifdef STAND
# Line 691  relocate_symbols(sym,nsyms,nscns,init_ad Line 675  relocate_symbols(sym,nsyms,nscns,init_ad
675                    default:                    default:
676                      printf("[unknown rel secn %d type=%d]",                      printf("[unknown rel secn %d type=%d]",
677                             sym->st_shndx,                             sym->st_shndx,
678                             SECTION_H(sym->st_shndx).sh_type);                             (int)SECTION_H(sym->st_shndx).sh_type);
679                    }                    }
680                }                }
681              else              else
# Line 707  relocate_symbols(sym,nsyms,nscns,init_ad Line 691  relocate_symbols(sym,nsyms,nscns,init_ad
691                if (sym->st_shndx == text_index &&                if (sym->st_shndx == text_index &&
692                    bcmp("init_",string_table + sym->st_name,4) == 0)                    bcmp("init_",string_table + sym->st_name,4) == 0)
693                  {                  {
694                    *init_address_ptr = sym->st_value;                    *init_address_ptr = sym->st_value+section[sym->st_shndx].start;
695    
696                    }                    }
697              else                      else        

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

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