1 # File to either setup register 2 to point to the GOT, or to adjust the
2 # pointers in the .got2 section to point to their new addresses.
13 .long .LCTOC1 # address we are really at
16 .long _GLOBAL_OFFSET_TABLE_ # normal GOT address
19 .long _GOT_START_ # start of .got section
22 .long _GOT_END_ # end of .got section
25 .long _GOT2_START_ # -mrelocatable GOT pointers start
28 .long _GOT2_END_ # -mrelocatable GOT pointers end
32 .long .LCTOC1-.Laddr # PC relative pointer to .got2
33 .long 0x4000 # traceback table
36 bl .Laddr # get current address
38 mflr 12 # real address of .Laddr
39 lwz 11,(.Lptr-.Laddr)(12) # linker generated address of .LCTOC1
40 add 11,11,12 # correct to real pointer
41 lwz 12,.Ltable(11) # get linker's idea of where .Laddr is
42 subf. 12,12,11 # calculate difference
43 mtlr 0 # restore link register
44 bc 4,2,.Lreloc # skip if we need to relocate
46 # Only load up register 2 if there is a .got section
48 lwz 3,.Lgots(11) # start of .got section
49 lwz 4,.Lgote(11) # end of .got section
50 cmpw 1,3,4 # .got section non-empty?
53 # Normal program, load up register 2
55 lwz 2,.Lgot(11) # normal GOT address
56 b __do_global_ctors # do any C++ global contstructors (which returns to caller)
58 # We need to relocate the .got2 pointers. Don't load register 2
61 lwz 3,.Lgot2s(11) # GOT pointers start
62 lwz 4,.Lgot2e(11) # GOT pointers end
63 add 3,12,3 # adjust pointers
66 cmpw 1,3,4 # any pointers to adjust
70 lwz 11,0(3) # next pointer
73 addi 3,3,4 # bump to next word
74 cmpw 1,3,4 # more pointers to adjust?
77 # Done adjusting pointers, return
80 b __do_global_ctors # do any C++ global contstructors (which returns to caller)
82 # Routines for saving floating point registers, called by the compiler.
83 # Called with r11 pointing to the stack header word of the caller of the
84 # function, just beyond the end of the floating point save area.
105 .long 0x00400000 # traceback tag
106 _savefpr_14_l: stfd 14,-144(11) # save fp registers
107 _savefpr_15_l: stfd 15,-136(11)
108 _savefpr_16_l: stfd 16,-128(11)
109 _savefpr_17_l: stfd 17,-120(11)
110 _savefpr_18_l: stfd 18,-112(11)
111 _savefpr_19_l: stfd 19,-104(11)
112 _savefpr_20_l: stfd 20,-96(11)
113 _savefpr_21_l: stfd 21,-88(11)
114 _savefpr_22_l: stfd 22,-80(11)
115 _savefpr_23_l: stfd 23,-72(11)
116 _savefpr_24_l: stfd 24,-64(11)
117 _savefpr_25_l: stfd 25,-56(11)
118 _savefpr_26_l: stfd 26,-48(11)
119 _savefpr_27_l: stfd 27,-40(11)
120 _savefpr_28_l: stfd 28,-32(11)
121 _savefpr_29_l: stfd 29,-24(11)
122 _savefpr_30_l: stfd 30,-16(11)
123 _savefpr_31_l: stfd 31,-8(11)
124 stw 0,4(11) # save return address also
128 # Routines for restoring floating point registers, called by the compiler.
129 # Called with r11 pointing to the stack header word of the caller of the
130 # function, just beyond the end of the floating point save area.
151 .long 0x00600000 # traceback tag
152 _restfpr_14_l: lfd 14,-144(11) # restore fp registers
153 _restfpr_15_l: lfd 15,-136(11)
154 _restfpr_16_l: lfd 16,-128(11)
155 _restfpr_17_l: lfd 17,-120(11)
156 _restfpr_18_l: lfd 18,-112(11)
157 _restfpr_19_l: lfd 19,-104(11)
158 _restfpr_20_l: lfd 20,-96(11)
159 _restfpr_21_l: lfd 21,-88(11)
160 _restfpr_22_l: lfd 22,-80(11)
161 _restfpr_23_l: lfd 23,-72(11)
162 _restfpr_24_l: lfd 24,-64(11)
163 _restfpr_25_l: lfd 25,-56(11)
164 _restfpr_26_l: lfd 26,-48(11)
165 _restfpr_27_l: lfd 27,-40(11)
166 _restfpr_28_l: lfd 28,-32(11)
167 _restfpr_29_l: lfd 29,-24(11)
168 _restfpr_30_l: lfd 30,-16(11)
169 _restfpr_31_l: lwz 0,4(11) # caller's caller address