4 * Copyright (C) 1997 Mark Brinicombe
5 * Copyright (C) 1997 Causality Limited
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by Causality Limited.
18 * 4. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 * Called by ld.so when onanating.
36 * This *must* be a static function, so it is not called through a jmpslot.
40 #define RELOC_JMPSLOT 0x06 /* See note below */
41 #define RELOC_GOT32 0x24
44 * The value is RELOC_JMPSLOT is special. Really it should be 0x46 i.e.
45 * have the r_jmptable bit set however due to the usage of the
46 * relocation bits outside the linker the r_jmptable is only used
47 * internal to the linker and thus this bit get lost when the
48 * relocations are written out.
52 md_relocate_simple(r
, relocation
, addr
)
53 struct relocation_info
*r
;
59 index
= r
->r_pcrel
| (r
->r_length
<< 1) | (r
->r_extern
<< 3)
60 | (r
->r_neg
<< 4) | (r
->r_baserel
<< 5);
62 if (index
== RELOC_JMPSLOT
)
63 *(long *)addr
+= relocation
;
64 else if (index
== RELOC_GOT32
)
65 *(long *)addr
+= relocation
;
66 else if (index
== RELOC_32
)
67 *(long *)addr
+= relocation
;
70 *(long *)addr += relocation;*/