aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/eglibc/eglibc-2.15/relocatable_sdk.patch
blob: 0ee25d60d70e20f9ea7d97d0cce75f9c424d1263 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
Upstream-Status: Inappropriate [SDK specific]

This patch puts the dynamic loader path in the binaries, SYSTEM_DIRS strings
and lengths as well as ld.so.cache path in the dynamic loader to specific
sections in memory. The sections that contain paths have been allocated a 4096
byte section, which is the maximum path length in linux. This will allow the
relocating script to parse the ELF binary, detect the section and easily replace
the strings in a certain path.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>

Index: libc/elf/interp.c
===================================================================
--- libc.orig/elf/interp.c
+++ libc/elf/interp.c
@@ -17,5 +17,5 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-const char __invoke_dynamic_linker__[] __attribute__ ((section (".interp")))
+const char __invoke_dynamic_linker__[4096] __attribute__ ((section (".interp")))
   = RUNTIME_LINKER;
Index: libc/elf/dl-load.c
===================================================================
--- libc.orig/elf/dl-load.c
+++ libc/elf/dl-load.c
@@ -145,8 +145,8 @@ static size_t max_capstrlen attribute_re
 /* Get the generated information about the trusted directories.  */
 #include "trusted-dirs.h"
 
-static const char system_dirs[] = SYSTEM_DIRS;
-static const size_t system_dirs_len[] =
+static const char system_dirs[4096] __attribute__ ((section (".sysdirs"))) = SYSTEM_DIRS;
+volatile static const size_t system_dirs_len[] __attribute__ ((section (".sysdirslen"))) =
 {
   SYSTEM_DIRS_LEN
 };
Index: libc/elf/dl-cache.c
===================================================================
--- libc.orig/elf/dl-cache.c
+++ libc/elf/dl-cache.c
@@ -134,6 +134,10 @@ do									      \
 while (0)
 
 
+const char LD_SO_CACHE[4096] __attribute__ ((section (".ldsocache"))) =
+		SYSCONFDIR "/ld.so.cache";
+
+
 int
 internal_function
 _dl_cache_libcmp (const char *p1, const char *p2)
Index: libc/elf/ldconfig.c
===================================================================
--- libc.orig/elf/ldconfig.c
+++ libc/elf/ldconfig.c
@@ -167,6 +167,9 @@ static struct argp argp =
   options, parse_opt, NULL, doc, NULL, more_help, NULL
 };
 
+
+extern const char LD_SO_CACHE[4096] __attribute__ ((section (".ldsocache")));
+
 /* Check if string corresponds to an important hardware capability or
    a platform.  */
 static int
Index: libc/sysdeps/generic/dl-cache.h
===================================================================
--- libc.orig/sysdeps/generic/dl-cache.h
+++ libc/sysdeps/generic/dl-cache.h
@@ -28,10 +28,6 @@
   ((flags) == 1 || (flags) == _DL_CACHE_DEFAULT_ID)
 #endif
 
-#ifndef LD_SO_CACHE
-# define LD_SO_CACHE SYSCONFDIR "/ld.so.cache"
-#endif
-
 #ifndef add_system_dir
 # define add_system_dir(dir) add_dir (dir)
 #endif