d2060e3d4459e2ba3e981f02dbeca8dcaea5975a
[musl] / src / ldso / powerpc / start.s
1 # FIXME : does not work, the small data array needs to be relocated.
2 # see elfspec_ppc.pdf, page 76-84
3         .global _start
4         .type   _start,@function
5 _start:
6         mr      9, 1                  # Save the original stack pointer.
7         clrrwi  1, 1, 4               # Align the stack to 16 bytes.
8         lis     13, _SDA_BASE_@ha      # r13 points to the small data area.
9         addi    13, 13, _SDA_BASE_@l
10         li      0, 0                   # Zero the frame pointer.
11         lwz     3, 0(9)               # and argc...
12         addi    4, 9, 4               # and argv ...
13         mtlr    0                      # Clear the link register.
14         # Go to the musl dynamic linker entry point.
15         bl      __dynlink
16         cmpi    4, 0, 3, 1            # Check for a 1.
17         bne     4, .                   # Stay here
18         mtlr    3                      # Set the link address...
19         li      3, 0
20         blr                             # and go.
21         .end    _start
22         .size   _start, .-_start
23