xref: /haiku/src/system/runtime_loader/arch/ppc/arch_relocate.cpp (revision e7c8829c5d8e5d34a2a1e111f1c06aceff256013)
1 /*
2  * Copyright 2003-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 #include "runtime_loader_private.h"
7 
8 #include <runtime_loader.h>
9 
10 #include <string.h>
11 #include <stdio.h>
12 #include <stdlib.h>
13 
14 
15 //#define TRACE_RLD
16 #ifdef TRACE_RLD
17 #	define TRACE(x) dprintf x
18 #else
19 #	define TRACE(x) ;
20 #endif
21 
22 
23 static int
24 relocate_rel(image_t *rootImage, image_t *image, struct Elf32_Rel *rel,
25 	int rel_len)
26 {
27 	// ToDo: implement me!
28 
29 	return B_NO_ERROR;
30 }
31 
32 
33 status_t
34 arch_relocate_image(image_t *rootImage, image_t *image)
35 {
36 	status_t status = B_NO_ERROR;
37 
38 	// deal with the rels first
39 	if (image->rel) {
40 		status = relocate_rel(rootImage, image, image->rel, image->rel_len);
41 		if (status < B_OK)
42 			return status;
43 	}
44 
45 	if (image->pltrel) {
46 		status = relocate_rel(rootImage, image, image->pltrel,
47 			image->pltrel_len);
48 		if (status < B_OK)
49 			return status;
50 	}
51 
52 	if (image->rela) {
53 		//int i;
54 		printf("RELA relocations not supported\n");
55 		return EOPNOTSUPP;
56 
57 		//for (i = 1; i * (int)sizeof(struct Elf32_Rela) < image->rela_len; i++) {
58 		//	printf("rela: type %d\n", ELF32_R_TYPE(image->rela[i].r_info));
59 		//}
60 	}
61 
62 	return B_OK;
63 }
64