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
31 .long _FIXUP_START_ # start of .fixup section
34 .long _FIXUP_END_ # end of .fixup section
38 .long .LCTOC1-.Laddr # PC relative pointer to .got2
39 .long 0x4000 # traceback table
42 bl .Laddr # get current address
44 mflr 12 # real address of .Laddr
45 lwz 11,(.Lptr-.Laddr)(12) # linker generated address of .LCTOC1
46 add 11,11,12 # correct to real pointer
47 lwz 12,.Ltable(11) # get linker's idea of where .Laddr is
48 subf. 12,12,11 # calculate difference
49 mtlr 0 # restore link register
50 bc 4,2,.Lreloc # skip if we need to relocate
52 # Only load up register 2 if there is a .got section
54 lwz 3,.Lgots(11) # start of .got section
55 lwz 4,.Lgote(11) # end of .got section
56 cmpw 1,3,4 # .got section non-empty?
59 # Normal program, load up register 2
61 lwz 2,.Lgot(11) # normal GOT address
62 b __do_global_ctors # do any C++ global constructors (which returns to caller)
64 # We need to relocate the .got2 pointers. Don't load register 2
67 lwz 3,.Lgot2s(11) # GOT pointers start
68 lwz 4,.Lgot2e(11) # GOT pointers end
69 add 3,12,3 # adjust pointers
72 cmpw 1,3,4 # any pointers to adjust
76 lwz 5,0(3) # next pointer
79 addi 3,3,4 # bump to next word
80 cmpw 1,3,4 # more pointers to adjust?
83 # Fixup any user initialized pointers now (the compiler drops pointers to
84 # each of the relocs that it does in the .fixup section). Note, the pointers
85 # themselves have already been fixed up by the previous loop.
88 lwz 3,.Lfixups(11) # fixup pointers start
89 lwz 4,.Lfixupe(11) # fixup pointers end
91 cmpw 1,3,4 # any user pointers to adjust
95 lwz 5,0(3) # next pointer
96 lwz 6,0(5) # get the pointer it points to
99 addi 3,3,4 # bump to next word
100 cmpw 1,3,4 # more pointers to adjust?
103 # Done adjusting pointers, return
106 b __do_global_ctors # do any C++ global constructors (which returns to caller)
108 # Routines for saving floating point registers, called by the compiler.
109 # Called with r11 pointing to the stack header word of the caller of the
110 # function, just beyond the end of the floating point save area.
131 .long 0x00400000 # traceback tag
132 _savefpr_14_l: stfd 14,-144(11) # save fp registers
133 _savefpr_15_l: stfd 15,-136(11)
134 _savefpr_16_l: stfd 16,-128(11)
135 _savefpr_17_l: stfd 17,-120(11)
136 _savefpr_18_l: stfd 18,-112(11)
137 _savefpr_19_l: stfd 19,-104(11)
138 _savefpr_20_l: stfd 20,-96(11)
139 _savefpr_21_l: stfd 21,-88(11)
140 _savefpr_22_l: stfd 22,-80(11)
141 _savefpr_23_l: stfd 23,-72(11)
142 _savefpr_24_l: stfd 24,-64(11)
143 _savefpr_25_l: stfd 25,-56(11)
144 _savefpr_26_l: stfd 26,-48(11)
145 _savefpr_27_l: stfd 27,-40(11)
146 _savefpr_28_l: stfd 28,-32(11)
147 _savefpr_29_l: stfd 29,-24(11)
148 _savefpr_30_l: stfd 30,-16(11)
149 _savefpr_31_l: stfd 31,-8(11)
150 stw 0,4(11) # save return address also
154 # Routines for restoring floating point registers, called by the compiler.
155 # Called with r11 pointing to the stack header word of the caller of the
156 # function, just beyond the end of the floating point save area.
177 .long 0x00600000 # traceback tag
178 _restfpr_14_l: lfd 14,-144(11) # restore fp registers
179 _restfpr_15_l: lfd 15,-136(11)
180 _restfpr_16_l: lfd 16,-128(11)
181 _restfpr_17_l: lfd 17,-120(11)
182 _restfpr_18_l: lfd 18,-112(11)
183 _restfpr_19_l: lfd 19,-104(11)
184 _restfpr_20_l: lfd 20,-96(11)
185 _restfpr_21_l: lfd 21,-88(11)
186 _restfpr_22_l: lfd 22,-80(11)
187 _restfpr_23_l: lfd 23,-72(11)
188 _restfpr_24_l: lfd 24,-64(11)
189 _restfpr_25_l: lfd 25,-56(11)
190 _restfpr_26_l: lfd 26,-48(11)
191 _restfpr_27_l: lfd 27,-40(11)
192 _restfpr_28_l: lfd 28,-32(11)
193 _restfpr_29_l: lfd 29,-24(11)
194 _restfpr_30_l: lfd 30,-16(11)
195 _restfpr_31_l: lwz 0,4(11) # caller's caller address