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