~ubuntu-branches/ubuntu/vivid/gcl/vivid

« back to all changes in this revision

Viewing changes to o/rel_sun3.c

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2002-03-04 14:29:59 UTC
  • Revision ID: james.westby@ubuntu.com-20020304142959-dey14w08kr7lldu3
Tags: upstream-2.5.0.cvs20020219
ImportĀ upstreamĀ versionĀ 2.5.0.cvs20020219

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/* Copyright William Schelter. All rights reserved.  This file does
 
3
the low level relocation which tends to be very system dependent.
 
4
It is included by the file sfasl.c
 
5
*/
 
6
 
 
7
relocate()
 
8
{
 
9
 char *where;
 
10
 
 
11
  {unsigned int new_value;
 
12
   where = the_start + relocation_info.r_address;
 
13
   if(relocation_info.r_extern)
 
14
     {
 
15
       if (relocation_info.r_pcrel)
 
16
         new_value=   - (int)start_address
 
17
           + symbol_table[relocation_info.r_symbolnum].n_value;
 
18
       else
 
19
         { new_value= 
 
20
             symbol_table[relocation_info.r_symbolnum].n_value;}}
 
21
   else
 
22
     { switch(relocation_info.r_symbolnum){
 
23
     case N_DATA: case N_BSS: case N_TEXT:
 
24
       new_value= (int)start_address;
 
25
       break;
 
26
     default:
 
27
       dprintf(relocation_info.r_extern = %d, relocation_info.r_extern);
 
28
       printf("\nrelocation_info {r_symbolnum= %d, r_address = %d, r_extern=0 Ignored:",relocation_info.r_address,
 
29
              relocation_info.r_symbolnum);fflush(stdout);
 
30
       goto DONT;}
 
31
     };
 
32
   switch(relocation_info.r_length){
 
33
   case 0:
 
34
     *( char *)where = new_value + *( char *) where; break;
 
35
   case 1:
 
36
     *( short *)where = new_value + *( short *) where; break;
 
37
   case 2:
 
38
     *( long *)where = new_value + *( long *) where; break;
 
39
   }
 
40
 DONT:;
 
41
 }
 
42
}
 
43
 
 
44
 
 
45