blob: 40219013d86167d877a874e4c480f199cae8a0f0 [file] [log] [blame]
Ben Chengcc6695e2012-03-07 23:04:02 -08001diff -r -u -d /home/bccheng/local/elfutils-0.138/libdw/dwarf_begin.c ./libdw/dwarf_begin.c
2--- /home/bccheng/local/elfutils-0.138/libdw/dwarf_begin.c 2008-12-10 20:33:30.000000000 -0800
3+++ ./libdw/dwarf_begin.c 2012-03-07 15:56:49.000000000 -0800
4@@ -94,7 +94,9 @@
5 /* Get an ELF descriptor. */
6 elf = elf_begin (fd, elfcmd, NULL);
7 if (elf == NULL)
8+ /* ANDROID_CHANGE_BEGIN */
9 {
10+#if 0
11 /* Test why the `elf_begin" call failed. */
12 struct stat64 st;
13
14@@ -104,6 +106,10 @@
15 __libdw_seterrno (DWARF_E_INVALID_FILE);
16 else
17 __libdw_seterrno (DWARF_E_IO_ERROR);
18+#else
19+ __libdw_seterrno (DWARF_E_IO_ERROR);
20+#endif
21+ /* ANDROID_CHANGE_END */
22 }
23 else
24 {
25diff -r -u -d /home/bccheng/local/elfutils-0.138/libdw/dwarf_getpubnames.c ./libdw/dwarf_getpubnames.c
26--- /home/bccheng/local/elfutils-0.138/libdw/dwarf_getpubnames.c 2008-12-10 20:33:30.000000000 -0800
27+++ ./libdw/dwarf_getpubnames.c 2012-03-07 15:56:49.000000000 -0800
28@@ -60,6 +60,9 @@
29 #include <libdwP.h>
30 #include <dwarf.h>
31
32+/* ANDROID_CHANGE_BEGIN */
33+#include <AndroidFixup.h>
34+/* ANDROID_CHANGE_END */
35
36 static int
37 get_offsets (Dwarf *dbg)
38@@ -235,7 +238,13 @@
39 gl.die_offset += dbg->pubnames_sets[cnt].cu_offset;
40
41 gl.name = (char *) readp;
42+ /* ANDROID_CHANGE_BEGIN */
43+#ifdef __BIONIC__
44+ readp = gl.name + strlen(gl.name) + 1;
45+#else
46 readp = (unsigned char *) rawmemchr (gl.name, '\0') + 1;
47+#endif
48+ /* ANDROID_CHANGE_END */
49
50 /* We found name and DIE offset. Report it. */
51 if (callback (dbg, &gl, arg) != DWARF_CB_OK)
52diff -r -u -d /home/bccheng/local/elfutils-0.138/libdw/libdw_alloc.c ./libdw/libdw_alloc.c
53--- /home/bccheng/local/elfutils-0.138/libdw/libdw_alloc.c 2008-12-10 20:33:30.000000000 -0800
54+++ ./libdw/libdw_alloc.c 2012-03-07 15:56:49.000000000 -0800
55@@ -58,6 +58,9 @@
56 #include <sys/param.h>
57 #include "libdwP.h"
58
59+/* ANDROID_CHANGE_BEGIN */
60+#include <AndroidFixup.h>
61+/* ANDROID_CHANGE_END */
62
63 void *
64 __libdw_allocate (Dwarf *dbg, size_t minsize, size_t align)
65diff -r -u -d /home/bccheng/local/elfutils-0.138/libdwfl/dwfl_build_id_find_elf.c ./libdwfl/dwfl_build_id_find_elf.c
66--- /home/bccheng/local/elfutils-0.138/libdwfl/dwfl_build_id_find_elf.c 2008-12-10 20:33:30.000000000 -0800
67+++ ./libdwfl/dwfl_build_id_find_elf.c 2012-03-07 15:56:49.000000000 -0800
68@@ -52,6 +52,9 @@
69 #include <fcntl.h>
70 #include <unistd.h>
71
72+/* ANDROID_CHANGE_BEGIN */
73+#include <AndroidFixup.h>
74+/* ANDROID_CHANGE_END */
75
76 int
77 internal_function
78@@ -84,8 +87,16 @@
79 ".debug");
80
81 const Dwfl_Callbacks *const cb = mod->dwfl->callbacks;
82+
83+/* ANDROID_CHANGE_BEGIN */
84+#ifdef __BIONIC__
85+ char *path = strdup ((cb->debuginfo_path ? *cb->debuginfo_path : NULL)
86+ ?: DEFAULT_DEBUGINFO_PATH);
87+#else
88 char *path = strdupa ((cb->debuginfo_path ? *cb->debuginfo_path : NULL)
89 ?: DEFAULT_DEBUGINFO_PATH);
90+#endif
91+/* ANDROID_CHANGE_END */
92
93 int fd = -1;
94 char *dir;
95@@ -103,7 +114,6 @@
96 if (unlikely (name == NULL))
97 break;
98 memcpy (mempcpy (name, dir, dirlen), id_name, sizeof id_name);
99-
100 fd = TEMP_FAILURE_RETRY (open64 (name, O_RDONLY));
101 if (fd >= 0)
102 {
103@@ -119,6 +129,12 @@
104 free (name);
105 }
106
107+/* ANDROID_CHANGE_BEGIN */
108+#ifdef __BIONIC__
109+ free(path);
110+#endif
111+/* ANDROID_CHANGE_END */
112+
113 /* If we simply found nothing, clear errno. If we had some other error
114 with the file, report that. Possibly this should treat other errors
115 like ENOENT too. But ignoring all errors could mask some that should
116diff -r -u -d /home/bccheng/local/elfutils-0.138/libdwfl/dwfl_module_build_id.c ./libdwfl/dwfl_module_build_id.c
117--- /home/bccheng/local/elfutils-0.138/libdwfl/dwfl_module_build_id.c 2008-12-30 21:48:23.000000000 -0800
118+++ ./libdwfl/dwfl_module_build_id.c 2012-03-07 15:56:49.000000000 -0800
119@@ -139,9 +139,16 @@
120 return result;
121 }
122
123+/* ANDROID_CHANGE_BEGIN */
124+#if 0
125 int
126 __dwfl_module_build_id (Dwfl_Module *mod,
127 const unsigned char **bits, GElf_Addr *vaddr)
128+#else
129+dwfl_module_build_id (Dwfl_Module *mod,
130+ const unsigned char **bits, GElf_Addr *vaddr)
131+#endif
132+/* ANDROID_CHANGE_END */
133 {
134 if (mod == NULL)
135 return -1;
136@@ -164,6 +171,9 @@
137 *vaddr = mod->build_id_vaddr;
138 return mod->build_id_len;
139 }
140+
141+/* ANDROID_CHANGE_BEGIN */
142+#if 0
143 extern __typeof__ (dwfl_module_build_id) INTUSE(dwfl_module_build_id)
144 __attribute__ ((alias ("__dwfl_module_build_id")));
145 asm (".symver "
146@@ -180,3 +190,5 @@
147 }
148 asm (".symver "
149 "_BUG_COMPAT_dwfl_module_build_id, dwfl_module_build_id@ELFUTILS_0.130");
150+#endif
151+/* ANDROID_CHANGE_END */
152diff -r -u -d /home/bccheng/local/elfutils-0.138/libdwfl/dwfl_module_getdwarf.c ./libdwfl/dwfl_module_getdwarf.c
153--- /home/bccheng/local/elfutils-0.138/libdwfl/dwfl_module_getdwarf.c 2008-12-10 20:33:30.000000000 -0800
154+++ ./libdwfl/dwfl_module_getdwarf.c 2012-03-07 15:56:49.000000000 -0800
155@@ -53,6 +53,9 @@
156 #include <unistd.h>
157 #include "../libdw/libdwP.h" /* DWARF_E_* values are here. */
158
159+/* ANDROID_CHANGE_BEGIN */
160+#include <AndroidFixup.h>
161+/* ANDROID_CHANGE_END */
162
163 /* Open libelf FILE->fd and compute the load base of ELF as loaded in MOD.
164 When we return success, FILE->elf and FILE->bias are set up. */
165diff -r -u -d /home/bccheng/local/elfutils-0.138/libdwfl/find-debuginfo.c ./libdwfl/find-debuginfo.c
166--- /home/bccheng/local/elfutils-0.138/libdwfl/find-debuginfo.c 2008-12-10 20:33:30.000000000 -0800
167+++ ./libdwfl/find-debuginfo.c 2012-03-07 15:56:49.000000000 -0800
168@@ -53,6 +53,9 @@
169 #include <unistd.h>
170 #include "system.h"
171
172+/* ANDROID_CHANGE_BEGIN */
173+#include <AndroidFixup.h>
174+/* ANDROID_CHANGE_END */
175
176 /* Try to open64 [DIR/][SUBDIR/]DEBUGLINK, return file descriptor or -1.
177 On success, *DEBUGINFO_FILE_NAME has the malloc'd name of the open file. */
178@@ -145,8 +148,15 @@
179 indicated by the debug directory path setting. */
180
181 const Dwfl_Callbacks *const cb = mod->dwfl->callbacks;
182+/* ANDROID_CHANGE_BEGIN */
183+#ifdef __BIONIC__
184+ char *path = strdup ((cb->debuginfo_path ? *cb->debuginfo_path : NULL)
185+ ?: DEFAULT_DEBUGINFO_PATH);
186+#else
187 char *path = strdupa ((cb->debuginfo_path ? *cb->debuginfo_path : NULL)
188 ?: DEFAULT_DEBUGINFO_PATH);
189+#endif
190+/* ANDROID_CHANGE_END */
191
192 /* A leading - or + in the whole path sets whether to check file CRCs. */
193 bool defcheck = true;
194@@ -156,8 +166,15 @@
195 ++path;
196 }
197
198+ /* ANDROID_CHANGE_BEGIN */
199+#ifdef __BIONIC__
200+ char *file_dirname = (file_basename == file_name ? NULL
201+ : strndup (file_name, file_basename - 1 - file_name));
202+#else
203 char *file_dirname = (file_basename == file_name ? NULL
204 : strndupa (file_name, file_basename - 1 - file_name));
205+#endif
206+ /* ANDROID_CHANGE_END */
207 char *p;
208 while ((p = strsep (&path, ":")) != NULL)
209 {
210@@ -201,17 +218,36 @@
211 case ENOTDIR:
212 continue;
213 default:
214+/* ANDROID_CHANGE_BEGIN */
215+#ifdef __BIONIC__
216+ free(path);
217+ free(file_dirname);
218+#endif
219+/* ANDROID_CHANGE_END */
220 return -1;
221 }
222 if (validate (mod, fd, check, debuglink_crc))
223 {
224 *debuginfo_file_name = fname;
225+/* ANDROID_CHANGE_BEGIN */
226+#ifdef __BIONIC__
227+ free(path);
228+ free(file_dirname);
229+#endif
230+/* ANDROID_CHANGE_END */
231 return fd;
232 }
233 free (fname);
234 close (fd);
235 }
236
237+/* ANDROID_CHANGE_BEGIN */
238+#ifdef __BIONIC__
239+ free(path);
240+ free(file_dirname);
241+#endif
242+/* ANDROID_CHANGE_END */
243+
244 /* No dice. */
245 errno = 0;
246 return -1;
247diff -r -u -d /home/bccheng/local/elfutils-0.138/libdwfl/offline.c ./libdwfl/offline.c
248--- /home/bccheng/local/elfutils-0.138/libdwfl/offline.c 2008-12-17 16:29:37.000000000 -0800
249+++ ./libdwfl/offline.c 2012-03-07 15:56:49.000000000 -0800
250@@ -51,6 +51,10 @@
251 #include <fcntl.h>
252 #include <unistd.h>
253
254+/* ANDROID_CHANGE_BEGIN */
255+#include <AndroidFixup.h>
256+/* ANDROID_CHANGE_END */
257+
258 /* Since dwfl_report_elf lays out the sections already, this will only be
259 called when the section headers of the debuginfo file are being
260 consulted instead, or for the section placed at 0. With binutils
261diff -r -u -d /home/bccheng/local/elfutils-0.138/libebl/libeblP.h ./libebl/libeblP.h
262--- /home/bccheng/local/elfutils-0.138/libebl/libeblP.h 2008-12-10 20:33:30.000000000 -0800
263+++ ./libebl/libeblP.h 2012-03-07 15:56:49.000000000 -0800
264@@ -55,7 +55,6 @@
265 #include <libebl.h>
266 #include <libintl.h>
267
268-
269 /* Backend handle. */
270 struct ebl
271 {
272diff -r -u -d /home/bccheng/local/elfutils-0.138/libelf/elf32_fsize.c ./libelf/elf32_fsize.c
273--- /home/bccheng/local/elfutils-0.138/libelf/elf32_fsize.c 2008-12-10 20:33:30.000000000 -0800
274+++ ./libelf/elf32_fsize.c 2012-03-08 15:00:38.000000000 -0800
275@@ -88,5 +88,9 @@
276 * __libelf_type_sizes[0][ELFW(ELFCLASS,LIBELFBITS) - 1][type]);
277 #endif
278 }
279+/* ANDROID_CHANGE_BEGIN */
280+#ifndef __APPLE__
281 #define local_strong_alias(n1, n2) strong_alias (n1, n2)
282 local_strong_alias (elfw2(LIBELFBITS, fsize), __elfw2(LIBELFBITS, msize))
283+#endif
284+/* ANDROID_CHANGE_END */
285diff -r -u -d /home/bccheng/local/elfutils-0.138/libelf/elf_begin.c ./libelf/elf_begin.c
286--- /home/bccheng/local/elfutils-0.138/libelf/elf_begin.c 2008-12-10 20:33:30.000000000 -0800
287+++ ./libelf/elf_begin.c 2012-03-08 15:34:30.000000000 -0800
288@@ -68,7 +68,6 @@
289 #include "libelfP.h"
290 #include "common.h"
291
292-
293 /* Create descriptor for archive in memory. */
294 static inline Elf *
295 file_read_ar (int fildes, void *map_address, off_t offset, size_t maxsize,
296diff -r -u -d /home/bccheng/local/elfutils-0.138/libelf/elf.h ./libelf/elf.h
297--- /home/bccheng/local/elfutils-0.138/libelf/elf.h 2008-12-10 20:33:30.000000000 -0800
298+++ ./libelf/elf.h 2012-03-08 15:06:31.000000000 -0800
299@@ -21,7 +21,15 @@
300 #ifndef _ELF_H
301 #define _ELF_H 1
302
303+/* ANDROID_CHANGE_BEGIN */
304+/*
305+ * elf.h may be directly included from a different project, and features.h does
306+ * not exist on host Mac OS.
307+ */
308+#ifndef __APPLE__
309 #include <features.h>
310+#endif
311+/* ANDROID_CHANGE_END */
312
313 __BEGIN_DECLS
314
315diff -r -u -d /home/bccheng/local/elfutils-0.138/libelf/gelf_xlate.c ./libelf/gelf_xlate.c
316--- /home/bccheng/local/elfutils-0.138/libelf/gelf_xlate.c 2008-12-10 20:33:30.000000000 -0800
317+++ ./libelf/gelf_xlate.c 2012-03-08 15:00:38.000000000 -0800
318@@ -229,7 +229,11 @@
319 }
320 }
321 };
322+/* ANDROID_CHANGE_BEGIN */
323+#ifndef __APPLE__
324 /* For now we only handle the case where the memory representation is the
325 same as the file representation. Should this change we have to define
326 separate functions. For now reuse them. */
327 strong_alias (__elf_xfctstom, __elf_xfctstof)
328+#endif
329+/* ANDROID_CHANGE_END */