xref: /xnu-8020.121.3/EXTERNAL_HEADERS/mach-o/arm/reloc.h (revision fdd8201d7b966f0c3ea610489d29bd841d358941)
1 /*
2  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3  *
4  * @APPLE_LICENSE_HEADER_START@
5  *
6  * This file contains Original Code and/or Modifications of Original Code
7  * as defined in and that are subject to the Apple Public Source License
8  * Version 2.0 (the 'License'). You may not use this file except in
9  * compliance with the License. Please obtain a copy of the License at
10  * http://www.opensource.apple.com/apsl/ and read it before using this
11  * file.
12  *
13  * The Original Code and all software distributed under the License are
14  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18  * Please see the License for the specific language governing rights and
19  * limitations under the License.
20  *
21  * @APPLE_LICENSE_HEADER_END@
22  */
23 /*
24  * Relocation types used in the arm implementation.  Relocation entries for
25  * things other than instructions use the same generic relocation as discribed
26  * in <mach-o/reloc.h> and their r_type is ARM_RELOC_VANILLA, one of the
27  * *_SECTDIFF or the *_PB_LA_PTR types.  The rest of the relocation types are
28  * for instructions.  Since they are for instructions the r_address field
29  * indicates the 32 bit instruction that the relocation is to be preformed on.
30  */
31 enum reloc_type_arm
32 {
33     ARM_RELOC_VANILLA,	/* generic relocation as discribed above */
34     ARM_RELOC_PAIR,	/* the second relocation entry of a pair */
35     ARM_RELOC_SECTDIFF,	/* a PAIR follows with subtract symbol value */
36     ARM_RELOC_LOCAL_SECTDIFF, /* like ARM_RELOC_SECTDIFF, but the symbol
37 				 referenced was local.  */
38     ARM_RELOC_PB_LA_PTR,/* prebound lazy pointer */
39     ARM_RELOC_BR24,	/* 24 bit branch displacement (to a word address) */
40     ARM_THUMB_RELOC_BR22, /* 22 bit branch displacement (to a half-word
41 			     address) */
42     ARM_THUMB_32BIT_BRANCH, /* obsolete - a thumb 32-bit branch instruction
43 			     possibly needing page-spanning branch workaround */
44 
45     /*
46      * For these two r_type relocations they always have a pair following them
47      * and the r_length bits are used differently.  The encoding of the
48      * r_length is as follows:
49      * low bit of r_length:
50      *  0 - :lower16: for movw instructions
51      *  1 - :upper16: for movt instructions
52      * high bit of r_length:
53      *  0 - arm instructions
54      *  1 - thumb instructions
55      * the other half of the relocated expression is in the following pair
56      * relocation entry in the the low 16 bits of r_address field.
57      */
58     ARM_RELOC_HALF,
59     ARM_RELOC_HALF_SECTDIFF
60 };
61