tools/llvm: Do not build with symbols
[minix3.git] / lib / libc / arch / powerpc / sys / brk.S
blob1c1a1ba3bd4f0cb0953d3dfcedcaa36a46472a20
1 /*      $NetBSD: brk.S,v 1.13 2013/09/12 15:36:15 joerg Exp $   */
3 #include "SYS.h"
5 #if defined(LIBC_SCCS) && !defined(lint)
6 __RCSID("$NetBSD: brk.S,v 1.13 2013/09/12 15:36:15 joerg Exp $")
7 #endif /* LIBC_SCCS && !lint */
9         .globl  _C_LABEL(__curbrk)
10         .globl  _C_LABEL(__minbrk)
11         .globl  _C_LABEL(_end)
13 #ifdef WEAK_ALIAS
14 WEAK_ALIAS(brk, _brk)
15 #endif
17         .data
18 _C_LABEL(__minbrk):
19         .long   _C_LABEL(_end)          # XXX not used yet
21         .text
22 ENTRY(_brk)
23 #ifdef __PIC__
24         mflr    %r10
25         PIC_GOTSETUP(%r9)
26         mtlr    %r10
27         lwz     %r5,_C_LABEL(_end)@got(%r9)
28 #else
29         lis     %r5,_C_LABEL(_end)@ha   # r5 = &_end
30         addi    %r5,%r5,_C_LABEL(_end)@l
31 #endif
32         cmplw   %r5,%r3                 # if (&_end <= r3)
33         bgt     0f
34         mr      %r5,%r3                 # r5 = r3
36         mr      %r3,%r5                 # new break value
37         _DOSYSCALL(break)               # assume, that r5 is kept
38         bso     1f
39 #ifdef __PIC__
40         lwz     %r6,_C_LABEL(__curbrk)@got(%r9)
41         stw     %r5,0(%r6)
42 #else
43         lis     %r6,_C_LABEL(__curbrk)@ha       # record new break
44         stw     %r5,_C_LABEL(__curbrk)@l(%r6)
45 #endif
46         blr                             # return 0
49         b       _C_LABEL(__cerror)
50 END(_brk)