1 diff -uNr elfutils-0.94.orig/libdw/dwarf_getaranges.c elfutils-0.94/libdw/dwarf_getaranges.c
2 --- elfutils-0.94.orig/libdw/dwarf_getaranges.c 2004-01-12 21:08:03.000000000 +0100
3 +++ elfutils-0.94/libdw/dwarf_getaranges.c 2004-04-02 19:03:13.297222616 +0200
5 struct arangelist *arangelist = NULL;
6 unsigned int narangelist = 0;
9 - = (const char *) dbg->sectiondata[IDX_debug_aranges]->d_buf;
10 - const char *readendp = readp + dbg->sectiondata[IDX_debug_aranges]->d_size;
11 + unsigned char *readp
12 + = (unsigned char *) dbg->sectiondata[IDX_debug_aranges]->d_buf;
13 + const unsigned char *readendp = readp + dbg->sectiondata[IDX_debug_aranges]->d_size;
15 while (readp < readendp)
17 - const char *hdrstart = readp;
18 + const unsigned char *hdrstart = readp;
20 /* Each entry starts with a header:
24 5. A 1-byte unsigned integer containing the size in bytes of
25 a segment descriptor on the target system. */
26 - Dwarf_Word length = read_4ubyte_unaligned_inc (dbg, readp);
27 + Dwarf_Word length = read_4ubyte_unaligned_inc (dbg, &readp);
28 unsigned int length_bytes = 4;
29 if (length == 0xffffffff)
31 - length = read_8ubyte_unaligned_inc (dbg, readp);
32 + length = read_8ubyte_unaligned_inc (dbg, &readp);
36 - unsigned int version = read_2ubyte_unaligned_inc (dbg, readp);
37 + unsigned int version = read_2ubyte_unaligned_inc (dbg, &readp);
44 if (length_bytes == 4)
45 - offset = read_4ubyte_unaligned_inc (dbg, readp);
46 + offset = read_4ubyte_unaligned_inc (dbg, &readp);
48 - offset = read_8ubyte_unaligned_inc (dbg, readp);
49 + offset = read_8ubyte_unaligned_inc (dbg, &readp);
51 unsigned int address_size = *readp++;
52 if (address_size != 4 && address_size != 8)
55 if (address_size == 4)
57 - range_address = read_4ubyte_unaligned_inc (dbg, readp);
58 - range_length = read_4ubyte_unaligned_inc (dbg, readp);
59 + range_address = read_4ubyte_unaligned_inc (dbg, &readp);
60 + range_length = read_4ubyte_unaligned_inc (dbg, &readp);
64 - range_address = read_8ubyte_unaligned_inc (dbg, readp);
65 - range_length = read_8ubyte_unaligned_inc (dbg, readp);
66 + range_address = read_8ubyte_unaligned_inc (dbg, &readp);
67 + range_length = read_8ubyte_unaligned_inc (dbg, &readp);
70 /* Two zero values mark the end. */
71 diff -uNr elfutils-0.94.orig/libdw/dwarf_getloclist.c elfutils-0.94/libdw/dwarf_getloclist.c
72 --- elfutils-0.94.orig/libdw/dwarf_getloclist.c 2004-01-09 09:39:54.000000000 +0100
73 +++ elfutils-0.94/libdw/dwarf_getloclist.c 2004-04-02 19:03:32.961233232 +0200
78 - newloc->number = read_4ubyte_unaligned_inc (dbg, data);
79 + newloc->number = read_4ubyte_unaligned_inc (dbg, &data);
83 if (unlikely (data + 8 > end_data))
86 - newloc->number = read_8ubyte_unaligned_inc (dbg, data);
87 + newloc->number = read_8ubyte_unaligned_inc (dbg, &data);
92 if (unlikely (data >= end_data))
95 - newloc->number = *((int8_t *) data)++;
96 + newloc->number = *(int8_t *)data++;
100 if (unlikely (data + 2 > end_data))
103 - newloc->number = read_2ubyte_unaligned_inc (dbg, data);
104 + newloc->number = read_2ubyte_unaligned_inc (dbg, &data);
108 @@ -194,14 +194,14 @@
109 if (unlikely (data + 2 > end_data))
112 - newloc->number = read_2sbyte_unaligned_inc (dbg, data);
113 + newloc->number = read_2sbyte_unaligned_inc (dbg, &data);
117 if (unlikely (data + 4 > end_data))
120 - newloc->number = read_4ubyte_unaligned_inc (dbg, data);
121 + newloc->number = read_4ubyte_unaligned_inc (dbg, &data);
125 @@ -209,21 +209,21 @@
126 if (unlikely (data + 4 > end_data))
129 - newloc->number = read_4sbyte_unaligned_inc (dbg, data);
130 + newloc->number = read_4sbyte_unaligned_inc (dbg, &data);
134 if (unlikely (data + 8 > end_data))
137 - newloc->number = read_8ubyte_unaligned_inc (dbg, data);
138 + newloc->number = read_8ubyte_unaligned_inc (dbg, &data);
142 if (unlikely (data + 8 > end_data))
145 - newloc->number = read_8sbyte_unaligned_inc (dbg, data);
146 + newloc->number = read_8sbyte_unaligned_inc (dbg, &data);
150 diff -uNr elfutils-0.94.orig/libdw/dwarf_getpubnames.c elfutils-0.94/libdw/dwarf_getpubnames.c
151 --- elfutils-0.94.orig/libdw/dwarf_getpubnames.c 2004-01-16 09:34:11.000000000 +0100
152 +++ elfutils-0.94/libdw/dwarf_getpubnames.c 2004-04-02 19:03:13.299222312 +0200
155 /* Read the set header. */
157 - Dwarf_Off len = read_4ubyte_unaligned_inc (dbg, readp);
158 + Dwarf_Off len = read_4ubyte_unaligned_inc (dbg, &readp);
159 if (len == 0xffffffff)
161 - len = read_8ubyte_unaligned_inc (dbg, readp);
162 + len = read_8ubyte_unaligned_inc (dbg, &readp);
168 /* READP points to the next offset/name pair. */
169 if (dbg->pubnames_sets[cnt].address_len == 4)
170 - gl.die_offset = read_4ubyte_unaligned_inc (dbg, readp);
171 + gl.die_offset = read_4ubyte_unaligned_inc (dbg, &readp);
173 - gl.die_offset = read_8ubyte_unaligned_inc (dbg, readp);
174 + gl.die_offset = read_8ubyte_unaligned_inc (dbg, &readp);
176 /* If the offset is zero we reached the end of the set. */
177 if (gl.die_offset == 0)
178 diff -uNr elfutils-0.94.orig/libdw/dwarf_getsrclines.c elfutils-0.94/libdw/dwarf_getsrclines.c
179 --- elfutils-0.94.orig/libdw/dwarf_getsrclines.c 2004-01-12 01:30:17.000000000 +0100
180 +++ elfutils-0.94/libdw/dwarf_getsrclines.c 2004-04-02 19:03:31.124512456 +0200
181 @@ -109,13 +109,13 @@
182 __libdw_seterrno (DWARF_E_INVALID_DEBUG_LINE);
185 - Dwarf_Word unit_length = read_4ubyte_unaligned_inc (dbg, linep);
186 + Dwarf_Word unit_length = read_4ubyte_unaligned_inc (dbg, &linep);
187 unsigned int length = 4;
188 if (unlikely (unit_length == 0xffffffff))
190 if (linep + 8 > lineendp)
192 - unit_length = read_8ubyte_unaligned_inc (dbg, linep);
193 + unit_length = read_8ubyte_unaligned_inc (dbg, &linep);
198 lineendp = linep + unit_length;
200 /* The next element of the header is the version identifier. */
201 - uint_fast16_t version = read_2ubyte_unaligned_inc (dbg, linep);
202 + uint_fast16_t version = read_2ubyte_unaligned_inc (dbg, &linep);
203 if (unlikely (version != DWARF_VERSION))
205 __libdw_seterrno (DWARF_E_VERSION);
207 /* Next comes the header length. */
208 Dwarf_Word header_length;
210 - header_length = read_4ubyte_unaligned_inc (dbg, linep);
211 + header_length = read_4ubyte_unaligned_inc (dbg, &linep);
213 - header_length = read_8ubyte_unaligned_inc (dbg, linep);
214 + header_length = read_8ubyte_unaligned_inc (dbg, &linep);
215 unsigned char *header_start = linep;
217 /* Next the minimum instruction length. */
219 uint_fast8_t default_is_stmt = *linep++;
221 /* Now the line base. */
222 - int_fast8_t line_base = *((int_fast8_t *) linep)++;
223 + int_fast8_t line_base = *(int_fast8_t *)linep++;
225 /* And the line range. */
226 uint_fast8_t line_range = *linep++;
229 case DW_LNE_set_address:
230 if (cu->address_size == 4)
231 - address = read_4ubyte_unaligned_inc (dbg, linep);
232 + address = read_4ubyte_unaligned_inc (dbg, &linep);
234 - address = read_8ubyte_unaligned_inc (dbg, linep);
235 + address = read_8ubyte_unaligned_inc (dbg, &linep);
238 case DW_LNE_define_file:
239 diff -uNr elfutils-0.94.orig/libdw/dwarf_nextcu.c elfutils-0.94/libdw/dwarf_nextcu.c
240 --- elfutils-0.94.orig/libdw/dwarf_nextcu.c 2004-01-10 04:43:17.000000000 +0100
241 +++ elfutils-0.94/libdw/dwarf_nextcu.c 2004-04-02 19:03:13.305221400 +0200
244 /* This points into the .debug_info section to the beginning of the
246 - char *bytes = (char *) dwarf->sectiondata[IDX_debug_info]->d_buf + off;
247 + unsigned char *bytes = (char *) dwarf->sectiondata[IDX_debug_info]->d_buf + off;
249 /* The format of the CU header is described in dwarf2p1 7.5.1:
252 an address on the target architecture. If the system uses
253 segmented addressing, this value represents the size of the
254 offset portion of an address. */
255 - uint64_t length = read_4ubyte_unaligned_inc (dwarf, bytes);
256 + uint64_t length = read_4ubyte_unaligned_inc (dwarf, &bytes);
257 size_t offset_size = 4;
258 if (length == 0xffffffffu)
262 if (length == 0xffffffffu)
263 /* This is a 64-bit DWARF format. */
264 - length = read_8ubyte_unaligned_inc (dwarf, bytes);
265 + length = read_8ubyte_unaligned_inc (dwarf, &bytes);
267 /* Read the version stamp. Always a 16-bit value.
268 XXX Do we need the value? */
269 - read_2ubyte_unaligned_inc (dwarf, bytes);
270 + read_2ubyte_unaligned_inc (dwarf, &bytes);
272 /* Get offset in .debug_abbrev. Note that the size of the entry
273 depends on whether this is a 32-bit or 64-bit DWARF definition. */
274 uint64_t abbrev_offset;
275 if (offset_size == 4)
276 - abbrev_offset = read_4ubyte_unaligned_inc (dwarf, bytes);
277 + abbrev_offset = read_4ubyte_unaligned_inc (dwarf, &bytes);
279 - abbrev_offset = read_8ubyte_unaligned_inc (dwarf, bytes);
280 + abbrev_offset = read_8ubyte_unaligned_inc (dwarf, &bytes);
281 if (abbrev_offsetp != NULL)
282 *abbrev_offsetp = abbrev_offset;
285 /* Store the header length. */
286 if (header_sizep != NULL)
287 *header_sizep = (bytes
288 - - ((char *) dwarf->sectiondata[IDX_debug_info]->d_buf
289 + - ((unsigned char *)dwarf->sectiondata[IDX_debug_info]->d_buf
292 /* See above for an explanation of the trick in this formula. */
293 diff -uNr elfutils-0.94.orig/libdw/memory-access.h elfutils-0.94/libdw/memory-access.h
294 --- elfutils-0.94.orig/libdw/memory-access.h 2004-01-16 18:43:30.000000000 +0100
295 +++ elfutils-0.94/libdw/memory-access.h 2004-04-02 19:03:22.820774816 +0200
297 /* Number decoding macros. See 7.6 Variable Length Data. */
298 #define get_uleb128(var, addr) \
300 - unsigned char __b = *((const unsigned char *) addr)++; \
301 + unsigned char __b = *(const unsigned char *)addr++; \
305 - __b = *((const unsigned char *) addr)++; \
306 + __b = *(const unsigned char *)addr++; \
307 var |= (__b & 0x7f) << 7; \
310 - __b = *((const unsigned char *) addr)++; \
311 + __b = *(const unsigned char *)addr++; \
312 var |= (__b & 0x7f) << 14; \
315 - __b = *((const unsigned char *) addr)++; \
316 + __b = *(const unsigned char *)addr++; \
317 var |= (__b & 0x7f) << 21; \
319 /* Other implementation set VALUE to UINT_MAX in this \
321 /* The signed case is a big more complicated. */
322 #define get_sleb128(var, addr) \
324 - unsigned char __b = *((const unsigned char *) addr)++; \
325 + unsigned char __b = *(const unsigned char *)addr++; \
326 int32_t __res = __b & 0x7f; \
327 if ((__b & 0x80) == 0) \
333 - __b = *((const unsigned char *) addr)++; \
334 + __b = *(const unsigned char *)addr++; \
335 __res |= (__b & 0x7f) << 7; \
336 if ((__b & 0x80) == 0) \
342 - __b = *((const unsigned char *) addr)++; \
343 + __b = *(const unsigned char *)addr++; \
344 __res |= (__b & 0x7f) << 14; \
345 if ((__b & 0x80) == 0) \
351 - __b = *((const unsigned char *) addr)++; \
352 + __b = *(const unsigned char *)addr++; \
353 __res |= (__b & 0x7f) << 21; \
354 if ((__b & 0x80) == 0) \
356 @@ -200,31 +200,43 @@
357 #endif /* allow unaligned */
360 -#define read_2ubyte_unaligned_inc(Dbg, Addr) \
361 - ({ uint16_t t_ = read_2ubyte_unaligned (Dbg, Addr); \
362 - ++((const uint16_t *) (Addr)); \
364 -#define read_2sbyte_unaligned_inc(Dbg, Addr) \
365 - ({ int16_t t_ = read_2sbyte_unaligned (Dbg, Addr); \
366 - ++((const int16_t *) (Addr)); \
369 -#define read_4ubyte_unaligned_inc(Dbg, Addr) \
370 - ({ uint32_t t_ = read_4ubyte_unaligned (Dbg, Addr); \
371 - ++((const uint32_t *) (Addr)); \
373 -#define read_4sbyte_unaligned_inc(Dbg, Addr) \
374 - ({ int32_t t_ = read_4sbyte_unaligned (Dbg, Addr); \
375 - ++((const int32_t *) (Addr)); \
378 -#define read_8ubyte_unaligned_inc(Dbg, Addr) \
379 - ({ uint64_t t_ = read_8ubyte_unaligned (Dbg, Addr); \
380 - ++((const uint64_t *) (Addr)); \
382 -#define read_8sbyte_unaligned_inc(Dbg, Addr) \
383 - ({ int64_t t_ = read_8sbyte_unaligned (Dbg, Addr); \
384 - ++((const int64_t *) (Addr)); \
386 +static inline uint16_t read_2ubyte_unaligned_inc(Dwarf *dbg, unsigned char **p)
388 + uint16_t tmp = read_2ubyte_unaligned(dbg, *p);
392 +static inline int16_t read_2sbyte_unaligned_inc(Dwarf *dbg, unsigned char **p)
394 + int16_t tmp = read_2sbyte_unaligned(dbg, *p);
399 +static inline uint32_t read_4ubyte_unaligned_inc(Dwarf *dbg, unsigned char **p)
401 + uint32_t tmp = read_4ubyte_unaligned(dbg, *p);
405 +static inline int32_t read_4sbyte_unaligned_inc(Dwarf *dbg, unsigned char **p)
407 + int32_t tmp = read_4sbyte_unaligned(dbg, *p);
412 +static inline uint64_t read_8ubyte_unaligned_inc(Dwarf *dbg, unsigned char **p)
414 + uint64_t tmp = read_8ubyte_unaligned(dbg, *p);
418 +static inline int64_t read_8sbyte_unaligned_inc(Dwarf *dbg, unsigned char **p)
420 + int64_t tmp = read_8sbyte_unaligned(dbg, *p);
425 #endif /* memory-access.h */
426 diff -uNr elfutils-0.94.orig/libelf/dl-hash.h elfutils-0.94/libelf/dl-hash.h
427 --- elfutils-0.94.orig/libelf/dl-hash.h 2003-12-25 19:31:59.000000000 +0100
428 +++ elfutils-0.94/libelf/dl-hash.h 2004-04-02 19:03:13.296222768 +0200
430 __attribute__ ((__pure__))
431 _dl_elf_hash (const char *name)
433 - unsigned int hash = (unsigned int) *((const unsigned char *) name)++;
434 + unsigned int hash = (unsigned int) *(const unsigned char *)name++;
438 - + (unsigned int) *((const unsigned char *) name)++);
439 + + (unsigned int) *(const unsigned char *)name++);
443 - + (unsigned int) *((const unsigned char *) name)++);
444 + + (unsigned int) *(const unsigned char *)name++);
448 - + (unsigned int) *((const unsigned char *) name)++);
449 + + (unsigned int) *(const unsigned char *)name++);
453 - + (unsigned int) *((const unsigned char *) name)++);
454 + + (unsigned int) *(const unsigned char *)name++);
455 while (*name != '\0')
459 - + (unsigned int) *((const unsigned char *) name)++);
460 + + (unsigned int) *(const unsigned char *)name++);
461 hi = hash & 0xf0000000;
463 /* The algorithm specified in the ELF ABI is as
464 diff -uNr elfutils-0.94.orig/libelf/gelf_xlate.c elfutils-0.94/libelf/gelf_xlate.c
465 --- elfutils-0.94.orig/libelf/gelf_xlate.c 2003-12-25 19:42:38.000000000 +0100
466 +++ elfutils-0.94/libelf/gelf_xlate.c 2004-04-02 19:03:28.501911152 +0200
471 - *((word##Bytes##_t *) dest)++ = \
472 + *((word##Bytes##_t *)dest) = \
473 LEN##Bytes##_SWAP ((word##Bytes##_t *) ptr); \
474 - ((word##Bytes##_t *) ptr)++; \
475 + dest += sizeof(word##Bytes##_t *); \
476 + ptr += sizeof(word##Bytes##_t *); \
480 diff -uNr elfutils-0.94.orig/src/ldgeneric.c elfutils-0.94/src/ldgeneric.c
481 --- elfutils-0.94.orig/src/ldgeneric.c 2003-08-18 01:49:51.000000000 +0200
482 +++ elfutils-0.94/src/ldgeneric.c 2004-04-02 19:03:35.409860984 +0200
483 @@ -2449,9 +2449,8 @@
484 ld_state.outfname = "a.out";
486 size_t outfname_len = strlen (ld_state.outfname);
487 - char *tempfname = (char *) ld_state.tempfname
488 - = (char *) obstack_alloc (&ld_state.smem,
489 - outfname_len + sizeof (".XXXXXX"));
490 + char *tempfname = ld_state.tempfname
491 + = obstack_alloc (&ld_state.smem, outfname_len + sizeof (".XXXXXX"));
495 diff -uNr elfutils-0.94.orig/src/ld.h elfutils-0.94/src/ld.h
496 --- elfutils-0.94.orig/src/ld.h 2003-08-12 08:46:39.000000000 +0200
497 +++ elfutils-0.94/src/ld.h 2004-04-02 19:03:35.412860528 +0200
499 /* Name of the output file. */
500 const char *outfname;
501 /* Name of the temporary file we initially create. */
502 - const char *tempfname;
504 /* File descriptor opened for the output file. */
506 /* The ELF descriptor for the output file. */
507 diff -uNr elfutils-0.94.orig/src/readelf.c elfutils-0.94/src/readelf.c
508 --- elfutils-0.94.orig/src/readelf.c 2004-01-16 10:29:37.000000000 +0100
509 +++ elfutils-0.94/src/readelf.c 2004-04-02 19:03:35.418859616 +0200
510 @@ -2974,7 +2974,7 @@
511 Dwarf_Word offset = 0;
514 - size_t op = *((unsigned char *) data)++;
515 + size_t op = *(unsigned char *)data++;
519 @@ -3004,7 +3004,7 @@
521 printf (" %*s [%4" PRIuMAX "] %s %" PRIu8 "\n",
522 (int) (20 + level * 2), "", (uintmax_t) offset,
523 - known[op] ?: "???", *((uint8_t *) data)++);
524 + known[op] ?: "???", *(uint8_t *)data++);
528 @@ -3039,7 +3039,7 @@
530 printf (" %*s [%4" PRIuMAX "] %s %" PRId8 "\n",
531 (int) (20 + level * 2), "", (uintmax_t) offset,
532 - known[op] ?: "???", *((int8_t *) data)++);
533 + known[op] ?: "???", *(int8_t *)data++);
537 @@ -3090,7 +3090,7 @@
541 - get_sleb128 (sleb, ((unsigned char *) data));
542 + get_sleb128 (sleb, (unsigned char *)data);
543 printf (" %*s [%4" PRIuMAX "] %s %d\n",
544 (int) (20 + level * 2), "", (uintmax_t) offset,
545 known[op] ?: "???", sleb);
546 @@ -3100,8 +3100,8 @@
550 - get_uleb128 (uleb, ((unsigned char *) data));
551 - get_sleb128 (sleb, ((unsigned char *) data));
552 + get_uleb128 (uleb, (unsigned char *)data);
553 + get_sleb128 (sleb, (unsigned char *)data);
554 printf (" %*s [%4" PRIuMAX "] %s %u %d\n",
555 (int) (20 + level * 2), "", (uintmax_t) offset,
556 known[op] ?: "???", uleb, sleb);