This repository has been archived by the owner on Nov 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
/
android.patch
491 lines (454 loc) · 15 KB
/
android.patch
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
diff -r -u -d /local/elfutils-0.138/libdw/dwarf_begin.c ./libdw/dwarf_begin.c
--- /local/elfutils-0.138/libdw/dwarf_begin.c 2008-12-10 20:33:30.000000000 -0800
+++ ./libdw/dwarf_begin.c 2012-03-09 10:19:33.000000000 -0800
@@ -94,7 +94,9 @@
/* Get an ELF descriptor. */
elf = elf_begin (fd, elfcmd, NULL);
if (elf == NULL)
+ /* ANDROID_CHANGE_BEGIN */
{
+#if 0
/* Test why the `elf_begin" call failed. */
struct stat64 st;
@@ -104,6 +106,10 @@
__libdw_seterrno (DWARF_E_INVALID_FILE);
else
__libdw_seterrno (DWARF_E_IO_ERROR);
+#else
+ __libdw_seterrno (DWARF_E_IO_ERROR);
+#endif
+ /* ANDROID_CHANGE_END */
}
else
{
diff -r -u -d /local/elfutils-0.138/libdw/dwarf_getpubnames.c ./libdw/dwarf_getpubnames.c
--- /local/elfutils-0.138/libdw/dwarf_getpubnames.c 2008-12-10 20:33:30.000000000 -0800
+++ ./libdw/dwarf_getpubnames.c 2012-03-12 11:09:29.000000000 -0700
@@ -60,6 +60,9 @@
#include <libdwP.h>
#include <dwarf.h>
+/* ANDROID_CHANGE_BEGIN */
+#include <AndroidFixup.h>
+/* ANDROID_CHANGE_END */
static int
get_offsets (Dwarf *dbg)
diff -r -u -d /local/elfutils-0.138/libdw/dwarf_getsrc_file.c ./libdw/dwarf_getsrc_file.c
--- /local/elfutils-0.138/libdw/dwarf_getsrc_file.c 2008-12-10 20:33:30.000000000 -0800
+++ ./libdw/dwarf_getsrc_file.c 2012-03-12 12:42:46.000000000 -0700
@@ -59,7 +59,6 @@
#include "libdwP.h"
-
int
dwarf_getsrc_file (Dwarf *dbg, const char *fname, int lineno, int column,
Dwarf_Line ***srcsp, size_t *nsrcs)
diff -r -u -d /local/elfutils-0.138/libdw/libdw_alloc.c ./libdw/libdw_alloc.c
--- /local/elfutils-0.138/libdw/libdw_alloc.c 2008-12-10 20:33:30.000000000 -0800
+++ ./libdw/libdw_alloc.c 2012-03-09 10:19:35.000000000 -0800
@@ -58,6 +58,9 @@
#include <sys/param.h>
#include "libdwP.h"
+/* ANDROID_CHANGE_BEGIN */
+#include <AndroidFixup.h>
+/* ANDROID_CHANGE_END */
void *
__libdw_allocate (Dwarf *dbg, size_t minsize, size_t align)
diff -r -u -d /local/elfutils-0.138/libdwfl/dwfl_build_id_find_elf.c ./libdwfl/dwfl_build_id_find_elf.c
--- /local/elfutils-0.138/libdwfl/dwfl_build_id_find_elf.c 2008-12-10 20:33:30.000000000 -0800
+++ ./libdwfl/dwfl_build_id_find_elf.c 2012-03-12 12:23:29.000000000 -0700
@@ -52,7 +52,6 @@
#include <fcntl.h>
#include <unistd.h>
-
int
internal_function
__libdwfl_open_by_build_id (Dwfl_Module *mod, bool debug, char **file_name)
@@ -84,8 +83,16 @@
".debug");
const Dwfl_Callbacks *const cb = mod->dwfl->callbacks;
+
+/* ANDROID_CHANGE_BEGIN */
+#ifdef __BIONIC__
+ char *path = strdup ((cb->debuginfo_path ? *cb->debuginfo_path : NULL)
+ ?: DEFAULT_DEBUGINFO_PATH);
+#else
char *path = strdupa ((cb->debuginfo_path ? *cb->debuginfo_path : NULL)
?: DEFAULT_DEBUGINFO_PATH);
+#endif
+/* ANDROID_CHANGE_END */
int fd = -1;
char *dir;
@@ -103,7 +110,6 @@
if (unlikely (name == NULL))
break;
memcpy (mempcpy (name, dir, dirlen), id_name, sizeof id_name);
-
fd = TEMP_FAILURE_RETRY (open64 (name, O_RDONLY));
if (fd >= 0)
{
@@ -119,6 +125,12 @@
free (name);
}
+/* ANDROID_CHANGE_BEGIN */
+#ifdef __BIONIC__
+ free(path);
+#endif
+/* ANDROID_CHANGE_END */
+
/* If we simply found nothing, clear errno. If we had some other error
with the file, report that. Possibly this should treat other errors
like ENOENT too. But ignoring all errors could mask some that should
diff -r -u -d /local/elfutils-0.138/libdwfl/dwfl_error.c ./libdwfl/dwfl_error.c
--- /local/elfutils-0.138/libdwfl/dwfl_error.c 2008-12-10 20:33:30.000000000 -0800
+++ ./libdwfl/dwfl_error.c 2012-03-12 12:39:16.000000000 -0700
@@ -218,7 +218,14 @@
switch (error &~ 0xffff)
{
case OTHER_ERROR (ERRNO):
+ /* ANDROID_CHANGE_BEGIN */
+#ifdef __BIONIC__
+ strerror_r (error & 0xffff, "bad", 0);
+ return NULL;
+#else
return strerror_r (error & 0xffff, "bad", 0);
+#endif
+ /* ANDROID_CHANGE_END */
case OTHER_ERROR (LIBELF):
return elf_errmsg (error & 0xffff);
case OTHER_ERROR (LIBDW):
diff -r -u -d /local/elfutils-0.138/libdwfl/dwfl_module_build_id.c ./libdwfl/dwfl_module_build_id.c
--- /local/elfutils-0.138/libdwfl/dwfl_module_build_id.c 2008-12-30 21:48:23.000000000 -0800
+++ ./libdwfl/dwfl_module_build_id.c 2012-03-12 12:40:16.000000000 -0700
@@ -139,9 +139,17 @@
return result;
}
+/* ANDROID_CHANGE_BEGIN */
+#if 0
int
__dwfl_module_build_id (Dwfl_Module *mod,
const unsigned char **bits, GElf_Addr *vaddr)
+#else
+int
+dwfl_module_build_id (Dwfl_Module *mod,
+ const unsigned char **bits, GElf_Addr *vaddr)
+#endif
+/* ANDROID_CHANGE_END */
{
if (mod == NULL)
return -1;
@@ -164,6 +172,9 @@
*vaddr = mod->build_id_vaddr;
return mod->build_id_len;
}
+
+/* ANDROID_CHANGE_BEGIN */
+#if 0
extern __typeof__ (dwfl_module_build_id) INTUSE(dwfl_module_build_id)
__attribute__ ((alias ("__dwfl_module_build_id")));
asm (".symver "
@@ -180,3 +191,5 @@
}
asm (".symver "
"_BUG_COMPAT_dwfl_module_build_id, dwfl_module_build_id@ELFUTILS_0.130");
+#endif
+/* ANDROID_CHANGE_END */
diff -r -u -d /local/elfutils-0.138/libdwfl/dwfl_module_getdwarf.c ./libdwfl/dwfl_module_getdwarf.c
--- /local/elfutils-0.138/libdwfl/dwfl_module_getdwarf.c 2008-12-10 20:33:30.000000000 -0800
+++ ./libdwfl/dwfl_module_getdwarf.c 2012-03-12 12:24:14.000000000 -0700
@@ -53,7 +53,6 @@
#include <unistd.h>
#include "../libdw/libdwP.h" /* DWARF_E_* values are here. */
-
/* Open libelf FILE->fd and compute the load base of ELF as loaded in MOD.
When we return success, FILE->elf and FILE->bias are set up. */
static inline Dwfl_Error
diff -r -u -d /local/elfutils-0.138/libdwfl/dwfl_module_getsrc_file.c ./libdwfl/dwfl_module_getsrc_file.c
--- /local/elfutils-0.138/libdwfl/dwfl_module_getsrc_file.c 2008-12-10 20:33:30.000000000 -0800
+++ ./libdwfl/dwfl_module_getsrc_file.c 2012-03-12 12:42:55.000000000 -0700
@@ -50,7 +50,6 @@
#include "libdwflP.h"
#include "../libdw/libdwP.h"
-
int
dwfl_module_getsrc_file (Dwfl_Module *mod,
const char *fname, int lineno, int column,
diff -r -u -d /local/elfutils-0.138/libdwfl/find-debuginfo.c ./libdwfl/find-debuginfo.c
--- /local/elfutils-0.138/libdwfl/find-debuginfo.c 2008-12-10 20:33:30.000000000 -0800
+++ ./libdwfl/find-debuginfo.c 2012-03-12 12:24:39.000000000 -0700
@@ -53,7 +53,6 @@
#include <unistd.h>
#include "system.h"
-
/* Try to open64 [DIR/][SUBDIR/]DEBUGLINK, return file descriptor or -1.
On success, *DEBUGINFO_FILE_NAME has the malloc'd name of the open file. */
static int
@@ -145,8 +144,15 @@
indicated by the debug directory path setting. */
const Dwfl_Callbacks *const cb = mod->dwfl->callbacks;
+/* ANDROID_CHANGE_BEGIN */
+#ifdef __BIONIC__
+ char *path = strdup ((cb->debuginfo_path ? *cb->debuginfo_path : NULL)
+ ?: DEFAULT_DEBUGINFO_PATH);
+#else
char *path = strdupa ((cb->debuginfo_path ? *cb->debuginfo_path : NULL)
?: DEFAULT_DEBUGINFO_PATH);
+#endif
+/* ANDROID_CHANGE_END */
/* A leading - or + in the whole path sets whether to check file CRCs. */
bool defcheck = true;
@@ -156,8 +162,15 @@
++path;
}
+ /* ANDROID_CHANGE_BEGIN */
+#ifdef __BIONIC__
+ char *file_dirname = (file_basename == file_name ? NULL
+ : strndup (file_name, file_basename - 1 - file_name));
+#else
char *file_dirname = (file_basename == file_name ? NULL
: strndupa (file_name, file_basename - 1 - file_name));
+#endif
+ /* ANDROID_CHANGE_END */
char *p;
while ((p = strsep (&path, ":")) != NULL)
{
@@ -201,17 +214,36 @@
case ENOTDIR:
continue;
default:
+/* ANDROID_CHANGE_BEGIN */
+#ifdef __BIONIC__
+ free(path);
+ free(file_dirname);
+#endif
+/* ANDROID_CHANGE_END */
return -1;
}
if (validate (mod, fd, check, debuglink_crc))
{
*debuginfo_file_name = fname;
+/* ANDROID_CHANGE_BEGIN */
+#ifdef __BIONIC__
+ free(path);
+ free(file_dirname);
+#endif
+/* ANDROID_CHANGE_END */
return fd;
}
free (fname);
close (fd);
}
+/* ANDROID_CHANGE_BEGIN */
+#ifdef __BIONIC__
+ free(path);
+ free(file_dirname);
+#endif
+/* ANDROID_CHANGE_END */
+
/* No dice. */
errno = 0;
return -1;
diff -r -u -d /local/elfutils-0.138/libebl/eblopenbackend.c ./libebl/eblopenbackend.c
--- /local/elfutils-0.138/libebl/eblopenbackend.c 2008-12-10 20:33:30.000000000 -0800
+++ ./libebl/eblopenbackend.c 2012-03-16 16:55:06.000000000 -0700
@@ -196,8 +196,15 @@
uint32_t descsz, const char *desc);
static bool default_debugscn_p (const char *name);
static bool default_copy_reloc_p (int reloc);
+/* ANDROID_CHANGE_BEGIN */
+#ifndef __APPLE__
static bool default_none_reloc_p (int reloc);
static bool default_relative_reloc_p (int reloc);
+#else
+#define default_none_reloc_p default_copy_reloc_p
+#define default_relative_reloc_p default_copy_reloc_p
+#endif
+/* ANDROID_CHANGE_END */
static bool default_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr,
const GElf_Sym *sym,
const char *name,
@@ -677,8 +684,12 @@
{
return false;
}
+/* ANDROID_CHANGE_BEGIN */
+#ifndef __APPLE__
strong_alias (default_copy_reloc_p, default_none_reloc_p)
strong_alias (default_copy_reloc_p, default_relative_reloc_p)
+#endif
+/* ANDROID_CHANGE_END */
static bool
default_check_special_symbol (Elf *elf __attribute__ ((unused)),
diff -r -u -d /local/elfutils-0.138/libebl/libeblP.h ./libebl/libeblP.h
--- /local/elfutils-0.138/libebl/libeblP.h 2008-12-10 20:33:30.000000000 -0800
+++ ./libebl/libeblP.h 2012-03-09 10:19:37.000000000 -0800
@@ -55,7 +55,6 @@
#include <libebl.h>
#include <libintl.h>
-
/* Backend handle. */
struct ebl
{
diff -r -u -d /local/elfutils-0.138/libelf/elf32_fsize.c ./libelf/elf32_fsize.c
--- /local/elfutils-0.138/libelf/elf32_fsize.c 2008-12-10 20:33:30.000000000 -0800
+++ ./libelf/elf32_fsize.c 2012-03-09 10:19:38.000000000 -0800
@@ -88,5 +88,9 @@
* __libelf_type_sizes[0][ELFW(ELFCLASS,LIBELFBITS) - 1][type]);
#endif
}
+/* ANDROID_CHANGE_BEGIN */
+#ifndef __APPLE__
#define local_strong_alias(n1, n2) strong_alias (n1, n2)
local_strong_alias (elfw2(LIBELFBITS, fsize), __elfw2(LIBELFBITS, msize))
+#endif
+/* ANDROID_CHANGE_END */
diff -r -u -d /local/elfutils-0.138/libelf/elf_begin.c ./libelf/elf_begin.c
--- /local/elfutils-0.138/libelf/elf_begin.c 2008-12-10 20:33:30.000000000 -0800
+++ ./libelf/elf_begin.c 2012-03-09 10:19:38.000000000 -0800
@@ -68,7 +68,6 @@
#include "libelfP.h"
#include "common.h"
-
/* Create descriptor for archive in memory. */
static inline Elf *
file_read_ar (int fildes, void *map_address, off_t offset, size_t maxsize,
diff -r -u -d /local/elfutils-0.138/libelf/elf_getdata_rawchunk.c ./libelf/elf_getdata_rawchunk.c
--- /local/elfutils-0.138/libelf/elf_getdata_rawchunk.c 2008-12-10 20:33:30.000000000 -0800
+++ ./libelf/elf_getdata_rawchunk.c 2012-03-15 11:14:32.000000000 -0700
@@ -64,7 +64,13 @@
Elf_Data *
elf_getdata_rawchunk (elf, offset, size, type)
Elf *elf;
+ /* ANDROID_CHANGE_BEGIN */
+#if 0
off64_t offset;
+#else
+ off_t offset;
+#endif
+ /* ANDROID_CHANGE_END */
size_t size;
Elf_Type type;
{
@@ -78,8 +84,15 @@
return NULL;
}
+ /* ANDROID_CHANGE_BEGIN */
+#if 0
if (unlikely (size > elf->maximum_size
|| (off64_t) (elf->maximum_size - size) < offset))
+#else
+ if (unlikely (size > elf->maximum_size
+ || (off_t) (elf->maximum_size - size) < offset))
+#endif
+ /* ANDROID_CHANGE_END */
{
/* Invalid request. */
__libelf_seterrno (ELF_E_INVALID_OP);
diff -r -u -d /local/elfutils-0.138/libelf/elf.h ./libelf/elf.h
--- /local/elfutils-0.138/libelf/elf.h 2008-12-10 20:33:30.000000000 -0800
+++ ./libelf/elf.h 2012-03-09 10:19:38.000000000 -0800
@@ -21,7 +21,15 @@
#ifndef _ELF_H
#define _ELF_H 1
+/* ANDROID_CHANGE_BEGIN */
+/*
+ * elf.h may be directly included from a different project, and features.h does
+ * not exist on host Mac OS.
+ */
+#ifndef __APPLE__
#include <features.h>
+#endif
+/* ANDROID_CHANGE_END */
__BEGIN_DECLS
diff -r -u -d /local/elfutils-0.138/libelf/gelf_xlate.c ./libelf/gelf_xlate.c
--- /local/elfutils-0.138/libelf/gelf_xlate.c 2008-12-10 20:33:30.000000000 -0800
+++ ./libelf/gelf_xlate.c 2012-03-09 10:19:39.000000000 -0800
@@ -229,7 +229,11 @@
}
}
};
+/* ANDROID_CHANGE_BEGIN */
+#ifndef __APPLE__
/* For now we only handle the case where the memory representation is the
same as the file representation. Should this change we have to define
separate functions. For now reuse them. */
strong_alias (__elf_xfctstom, __elf_xfctstof)
+#endif
+/* ANDROID_CHANGE_END */
diff -r -u -d /local/elfutils-0.138/libelf/libelf.h ./libelf/libelf.h
--- /local/elfutils-0.138/libelf/libelf.h 2008-12-17 16:29:37.000000000 -0800
+++ ./libelf/libelf.h 2012-03-15 11:07:48.000000000 -0700
@@ -95,7 +95,13 @@
Elf_Type d_type; /* Type of this piece of data. */
unsigned int d_version; /* ELF version. */
size_t d_size; /* Size in bytes. */
+ /* ANDROID_CHANGE_BEGIN */
+#if 0
loff_t d_off; /* Offset into section. */
+#else
+ off_t d_off; /* Offset into section. */
+#endif
+ /* ANDROID_CHANGE_END */
size_t d_align; /* Alignment in section. */
} Elf_Data;
@@ -157,7 +163,13 @@
uid_t ar_uid; /* User ID. */
gid_t ar_gid; /* Group ID. */
mode_t ar_mode; /* File mode. */
+ /* ANDROID_CHANGE_BEGIN */
+#if 0
loff_t ar_size; /* File size. */
+#else
+ off_t ar_size; /* File size. */
+#endif
+ /* ANDROID_CHANGE_END */
char *ar_rawname; /* Original name of archive member. */
} Elf_Arhdr;
@@ -198,13 +210,25 @@
extern int elf_end (Elf *__elf);
/* Update ELF descriptor and write file to disk. */
-extern loff_t elf_update (Elf *__elf, Elf_Cmd __cmd);
+/* ANDROID_CHANGE_BEGIN */
+#if 0
+extern off_t elf_update (Elf *__elf, Elf_Cmd __cmd);
+#else
+#endif
+/* ANDROID_CHANGE_END */
+
/* Determine what kind of file is associated with ELF. */
extern Elf_Kind elf_kind (Elf *__elf) __attribute__ ((__pure__));
/* Get the base offset for an object file. */
+/* ANDROID_CHANGE_BEGIN */
+#if 0
extern loff_t elf_getbase (Elf *__elf);
+#else
+extern off_t elf_getbase (Elf *__elf);
+#endif
+/* ANDROID_CHANGE_END */
/* Retrieve file identification data. */
@@ -305,9 +329,17 @@
/* Get data translated from a chunk of the file contents as section data
would be for TYPE. The resulting Elf_Data pointer is valid until
elf_end (ELF) is called. */
+/* ANDROID_CHANGE_BEGIN */
+#if 0
extern Elf_Data *elf_getdata_rawchunk (Elf *__elf,
loff_t __offset, size_t __size,
Elf_Type __type);
+#else
+extern Elf_Data *elf_getdata_rawchunk (Elf *__elf,
+ off_t __offset, size_t __size,
+ Elf_Type __type);
+#endif
+/* ANDROID_CHANGE_END */
/* Return pointer to string at OFFSET in section INDEX. */
@@ -318,7 +350,13 @@
extern Elf_Arhdr *elf_getarhdr (Elf *__elf);
/* Return offset in archive for current file ELF. */
+/* ANDROID_CHANGE_BEGIN */
+#if 0
extern loff_t elf_getaroff (Elf *__elf);
+#else
+extern off_t elf_getaroff (Elf *__elf);
+#endif
+/* ANDROID_CHANGE_END */
/* Select archive element at OFFSET. */
extern size_t elf_rand (Elf *__elf, size_t __offset);