View | Details | Raw Unified | Return to bug 198611 | Differences between
and this patch

Collapse All | Expand All

(-)b/contrib/elftoolchain/common/_elftc.h (-1 / +2 lines)
Lines 342-353 struct name { \ Link Here
342
342
343
343
344
#if defined(__GLIBC__) || defined(__linux__)
344
#if defined(__GLIBC__) || defined(__linux__)
345
345
#ifndef _GNU_SOURCE
346
/*
346
/*
347
 * GLIBC based systems have a global 'char *' pointer referencing
347
 * GLIBC based systems have a global 'char *' pointer referencing
348
 * the executable's name.
348
 * the executable's name.
349
 */
349
 */
350
extern const char *program_invocation_short_name;
350
extern const char *program_invocation_short_name;
351
#endif	/* !_GNU_SOURCE */
351
352
352
#define	ELFTC_GETPROGNAME()	program_invocation_short_name
353
#define	ELFTC_GETPROGNAME()	program_invocation_short_name
353
354
(-)b/contrib/elftoolchain/common/elfdefinitions.h (+1 lines)
Lines 565-570 _ELF_DEFINE_EM(EM_SPARC, 2, "SPARC") \ Link Here
565
_ELF_DEFINE_EM(EM_386,              3, "Intel 80386")			\
565
_ELF_DEFINE_EM(EM_386,              3, "Intel 80386")			\
566
_ELF_DEFINE_EM(EM_68K,              4, "Motorola 68000")		\
566
_ELF_DEFINE_EM(EM_68K,              4, "Motorola 68000")		\
567
_ELF_DEFINE_EM(EM_88K,              5, "Motorola 88000")		\
567
_ELF_DEFINE_EM(EM_88K,              5, "Motorola 88000")		\
568
_ELF_DEFINE_EM(EM_IAMCU,            6, "Intel MCU")			\
568
_ELF_DEFINE_EM(EM_860,              7, "Intel 80860")			\
569
_ELF_DEFINE_EM(EM_860,              7, "Intel 80860")			\
569
_ELF_DEFINE_EM(EM_MIPS,             8, "MIPS I Architecture")		\
570
_ELF_DEFINE_EM(EM_MIPS,             8, "MIPS I Architecture")		\
570
_ELF_DEFINE_EM(EM_S370,             9, "IBM System/370 Processor")	\
571
_ELF_DEFINE_EM(EM_S370,             9, "IBM System/370 Processor")	\
(-)b/contrib/elftoolchain/elfcopy/sections.c (+69 lines)
Lines 56-61 static void print_data(const char *d, size_t sz); Link Here
56
static void	print_section(struct section *s);
56
static void	print_section(struct section *s);
57
static void	*read_section(struct section *s, size_t *size);
57
static void	*read_section(struct section *s, size_t *size);
58
static void	update_reloc(struct elfcopy *ecp, struct section *s);
58
static void	update_reloc(struct elfcopy *ecp, struct section *s);
59
static void	update_section_group(struct elfcopy *ecp, struct section *s);
59
60
60
int
61
int
61
is_remove_section(struct elfcopy *ecp, const char *name)
62
is_remove_section(struct elfcopy *ecp, const char *name)
Lines 552-557 copy_content(struct elfcopy *ecp) Link Here
552
		    (s->type == SHT_REL || s->type == SHT_RELA))
553
		    (s->type == SHT_REL || s->type == SHT_RELA))
553
			filter_reloc(ecp, s);
554
			filter_reloc(ecp, s);
554
555
556
		/*
557
		 * The section indices in the SHT_GROUP section needs
558
		 * to be updated since we might have stripped some
559
		 * sections and changed section numbering.
560
		 */
561
		if (s->type == SHT_GROUP)
562
			update_section_group(ecp, s);
563
555
		if (is_modify_section(ecp, s->name))
564
		if (is_modify_section(ecp, s->name))
556
			modify_section(ecp, s);
565
			modify_section(ecp, s);
557
566
Lines 571-576 copy_content(struct elfcopy *ecp) Link Here
571
	}
580
	}
572
}
581
}
573
582
583
584
/*
585
 * Update section group section. The section indices in the SHT_GROUP
586
 * section need update after section numbering changed.
587
 */
588
static void
589
update_section_group(struct elfcopy *ecp, struct section *s)
590
{
591
	GElf_Shdr	 ish;
592
	Elf_Data	*id;
593
	uint32_t	*ws, *wd;
594
	uint64_t	 n;
595
	size_t		 ishnum;
596
	int		 i;
597
598
	if (!elf_getshnum(ecp->ein, &ishnum))
599
		errx(EXIT_FAILURE, "elf_getshnum failed: %s",
600
		    elf_errmsg(-1));
601
602
	if (gelf_getshdr(s->is, &ish) == NULL)
603
		errx(EXIT_FAILURE, "gelf_getehdr() failed: %s",
604
		    elf_errmsg(-1));
605
606
	if ((id = elf_getdata(s->is, NULL)) == NULL)
607
		errx(EXIT_FAILURE, "elf_getdata() failed: %s",
608
		    elf_errmsg(-1));
609
610
	if (ish.sh_size == 0)
611
		return;
612
613
	if (ish.sh_entsize == 0)
614
		ish.sh_entsize = 4;
615
616
	ws = id->d_buf;
617
618
	/* We only support COMDAT section. */
619
	if ((*ws & GRP_COMDAT) == 0)
620
		return;
621
622
	if ((s->buf = malloc(ish.sh_size)) == NULL)
623
		err(EXIT_FAILURE, "malloc failed");
624
625
	wd = s->buf;
626
627
	/* Copy the flag word as-is. */
628
	*wd = *ws;
629
630
	/* Update the section indices. */
631
	n = ish.sh_size / ish.sh_entsize;
632
	for(i = 1; (uint64_t)i < n; i++) {
633
		if (ws[i] == SHN_UNDEF || ws[i] >= ishnum)
634
			wd[i] = ws[i];
635
		else
636
			wd[i] = ecp->secndx[ws[i]];
637
	}
638
639
	s->sz = ish.sh_size;
640
	s->nocopy = 1;
641
}
642
574
/*
643
/*
575
 * Filter relocation entries, only keep those entries whose
644
 * Filter relocation entries, only keep those entries whose
576
 * symbol is in the keep list.
645
 * symbol is in the keep list.
(-)b/contrib/elftoolchain/libdwarf/libdwarf_reloc.c (+1 lines)
Lines 75-80 _dwarf_get_reloc_size(Dwarf_Debug dbg, Dwarf_Unsigned rel_type) Link Here
75
			return (4);
75
			return (4);
76
		break;
76
		break;
77
	case EM_386:
77
	case EM_386:
78
	case EM_IAMCU:
78
		if (rel_type == R_386_32)
79
		if (rel_type == R_386_32)
79
			return (4);
80
			return (4);
80
		break;
81
		break;
(-)b/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c (-46 / +424 lines)
Lines 50-56 ELFTC_VCSID("$Id: libelftc_dem_gnu3.c 3194 2015-05-05 17:55:16Z emaste $"); Link Here
50
50
51
enum type_qualifier {
51
enum type_qualifier {
52
	TYPE_PTR, TYPE_REF, TYPE_CMX, TYPE_IMG, TYPE_EXT, TYPE_RST, TYPE_VAT,
52
	TYPE_PTR, TYPE_REF, TYPE_CMX, TYPE_IMG, TYPE_EXT, TYPE_RST, TYPE_VAT,
53
	TYPE_CST
53
	TYPE_CST, TYPE_VEC
54
};
54
};
55
55
56
struct vector_type_qualifier {
56
struct vector_type_qualifier {
Lines 84-89 struct cpp_demangle_data { Link Here
84
	int			 func_type;
84
	int			 func_type;
85
	const char		*cur;		/* current mangled name ptr */
85
	const char		*cur;		/* current mangled name ptr */
86
	const char		*last_sname;	/* last source name */
86
	const char		*last_sname;	/* last source name */
87
	int			 push_head;
87
};
88
};
88
89
89
#define	CPP_DEMANGLE_TRY_LIMIT	128
90
#define	CPP_DEMANGLE_TRY_LIMIT	128
Lines 112-117 static int cpp_demangle_read_array(struct cpp_demangle_data *); Link Here
112
static int	cpp_demangle_read_encoding(struct cpp_demangle_data *);
113
static int	cpp_demangle_read_encoding(struct cpp_demangle_data *);
113
static int	cpp_demangle_read_expr_primary(struct cpp_demangle_data *);
114
static int	cpp_demangle_read_expr_primary(struct cpp_demangle_data *);
114
static int	cpp_demangle_read_expression(struct cpp_demangle_data *);
115
static int	cpp_demangle_read_expression(struct cpp_demangle_data *);
116
static int	cpp_demangle_read_expression_flat(struct cpp_demangle_data *,
117
		    char **);
115
static int	cpp_demangle_read_expression_binary(struct cpp_demangle_data *,
118
static int	cpp_demangle_read_expression_binary(struct cpp_demangle_data *,
116
		    const char *, size_t);
119
		    const char *, size_t);
117
static int	cpp_demangle_read_expression_unary(struct cpp_demangle_data *,
120
static int	cpp_demangle_read_expression_unary(struct cpp_demangle_data *,
Lines 123-130 static int cpp_demangle_read_function(struct cpp_demangle_data *, int *, Link Here
123
static int	cpp_demangle_local_source_name(struct cpp_demangle_data *ddata);
126
static int	cpp_demangle_local_source_name(struct cpp_demangle_data *ddata);
124
static int	cpp_demangle_read_local_name(struct cpp_demangle_data *);
127
static int	cpp_demangle_read_local_name(struct cpp_demangle_data *);
125
static int	cpp_demangle_read_name(struct cpp_demangle_data *);
128
static int	cpp_demangle_read_name(struct cpp_demangle_data *);
129
static int	cpp_demangle_read_name_flat(struct cpp_demangle_data *,
130
		    char**);
126
static int	cpp_demangle_read_nested_name(struct cpp_demangle_data *);
131
static int	cpp_demangle_read_nested_name(struct cpp_demangle_data *);
127
static int	cpp_demangle_read_number(struct cpp_demangle_data *, long *);
132
static int	cpp_demangle_read_number(struct cpp_demangle_data *, long *);
133
static int	cpp_demangle_read_number_as_string(struct cpp_demangle_data *,
134
		    char **);
128
static int	cpp_demangle_read_nv_offset(struct cpp_demangle_data *);
135
static int	cpp_demangle_read_nv_offset(struct cpp_demangle_data *);
129
static int	cpp_demangle_read_offset(struct cpp_demangle_data *);
136
static int	cpp_demangle_read_offset(struct cpp_demangle_data *);
130
static int	cpp_demangle_read_offset_number(struct cpp_demangle_data *);
137
static int	cpp_demangle_read_offset_number(struct cpp_demangle_data *);
Lines 138-143 static int cpp_demangle_read_tmpl_arg(struct cpp_demangle_data *); Link Here
138
static int	cpp_demangle_read_tmpl_args(struct cpp_demangle_data *);
145
static int	cpp_demangle_read_tmpl_args(struct cpp_demangle_data *);
139
static int	cpp_demangle_read_tmpl_param(struct cpp_demangle_data *);
146
static int	cpp_demangle_read_tmpl_param(struct cpp_demangle_data *);
140
static int	cpp_demangle_read_type(struct cpp_demangle_data *, int);
147
static int	cpp_demangle_read_type(struct cpp_demangle_data *, int);
148
static int	cpp_demangle_read_type_flat(struct cpp_demangle_data *,
149
		    char **);
141
static int	cpp_demangle_read_uqname(struct cpp_demangle_data *);
150
static int	cpp_demangle_read_uqname(struct cpp_demangle_data *);
142
static int	cpp_demangle_read_v_offset(struct cpp_demangle_data *);
151
static int	cpp_demangle_read_v_offset(struct cpp_demangle_data *);
143
static char	*decode_fp_to_double(const char *, size_t);
152
static char	*decode_fp_to_double(const char *, size_t);
Lines 156-163 static int vector_type_qualifier_init(struct vector_type_qualifier *); Link Here
156
static int	vector_type_qualifier_push(struct vector_type_qualifier *,
165
static int	vector_type_qualifier_push(struct vector_type_qualifier *,
157
		    enum type_qualifier);
166
		    enum type_qualifier);
158
167
159
static int cpp_demangle_gnu3_push_head;
160
161
/**
168
/**
162
 * @brief Decode the input string by IA-64 C++ ABI style.
169
 * @brief Decode the input string by IA-64 C++ ABI style.
163
 *
170
 *
Lines 190-196 cpp_demangle_gnu3(const char *org) Link Here
190
	if (!cpp_demangle_data_init(&ddata, org + 2))
197
	if (!cpp_demangle_data_init(&ddata, org + 2))
191
		return (NULL);
198
		return (NULL);
192
199
193
	cpp_demangle_gnu3_push_head = 0;
194
	rtn = NULL;
200
	rtn = NULL;
195
201
196
	if (!cpp_demangle_read_encoding(&ddata))
202
	if (!cpp_demangle_read_encoding(&ddata))
Lines 277-282 cpp_demangle_data_init(struct cpp_demangle_data *d, const char *cur) Link Here
277
	d->func_type = 0;
283
	d->func_type = 0;
278
	d->cur = cur;
284
	d->cur = cur;
279
	d->last_sname = NULL;
285
	d->last_sname = NULL;
286
	d->push_head = 0;
280
287
281
	return (1);
288
	return (1);
282
289
Lines 309-315 cpp_demangle_push_fp(struct cpp_demangle_data *ddata, Link Here
309
	fp = ddata->cur;
316
	fp = ddata->cur;
310
	while (*ddata->cur != 'E')
317
	while (*ddata->cur != 'E')
311
		++ddata->cur;
318
		++ddata->cur;
312
	++ddata->cur;
313
319
314
	if ((f = decoder(fp, ddata->cur - fp)) == NULL)
320
	if ((f = decoder(fp, ddata->cur - fp)) == NULL)
315
		return (0);
321
		return (0);
Lines 320-325 cpp_demangle_push_fp(struct cpp_demangle_data *ddata, Link Here
320
326
321
	free(f);
327
	free(f);
322
328
329
	++ddata->cur;
330
323
	return (rtn);
331
	return (rtn);
324
}
332
}
325
333
Lines 331-337 cpp_demangle_push_str(struct cpp_demangle_data *ddata, const char *str, Link Here
331
	if (ddata == NULL || str == NULL || len == 0)
339
	if (ddata == NULL || str == NULL || len == 0)
332
		return (0);
340
		return (0);
333
341
334
	if (cpp_demangle_gnu3_push_head > 0)
342
	if (ddata->push_head > 0)
335
		return (vector_str_push(&ddata->output_tmp, str, len));
343
		return (vector_str_push(&ddata->output_tmp, str, len));
336
344
337
	return (vector_str_push(&ddata->output, str, len));
345
	return (vector_str_push(&ddata->output, str, len));
Lines 403-409 cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata, Link Here
403
			if (type_str != NULL) {
411
			if (type_str != NULL) {
404
				if (!vector_str_push(&subst_v, "*", 1))
412
				if (!vector_str_push(&subst_v, "*", 1))
405
					goto clean;
413
					goto clean;
406
				if (!cpp_demangle_push_subst_v(ddata, &subst_v))
414
				if (!cpp_demangle_push_subst_v(ddata,
415
				    &subst_v))
407
					goto clean;
416
					goto clean;
408
			}
417
			}
409
			break;
418
			break;
Lines 414-420 cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata, Link Here
414
			if (type_str != NULL) {
423
			if (type_str != NULL) {
415
				if (!vector_str_push(&subst_v, "&", 1))
424
				if (!vector_str_push(&subst_v, "&", 1))
416
					goto clean;
425
					goto clean;
417
				if (!cpp_demangle_push_subst_v(ddata, &subst_v))
426
				if (!cpp_demangle_push_subst_v(ddata,
427
				    &subst_v))
418
					goto clean;
428
					goto clean;
419
			}
429
			}
420
			break;
430
			break;
Lines 425-431 cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata, Link Here
425
			if (type_str != NULL) {
435
			if (type_str != NULL) {
426
				if (!vector_str_push(&subst_v, " complex", 8))
436
				if (!vector_str_push(&subst_v, " complex", 8))
427
					goto clean;
437
					goto clean;
428
				if (!cpp_demangle_push_subst_v(ddata, &subst_v))
438
				if (!cpp_demangle_push_subst_v(ddata,
439
				    &subst_v))
429
					goto clean;
440
					goto clean;
430
			}
441
			}
431
			break;
442
			break;
Lines 434-456 cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata, Link Here
434
			if (!cpp_demangle_push_str(ddata, " imaginary", 10))
445
			if (!cpp_demangle_push_str(ddata, " imaginary", 10))
435
				goto clean;
446
				goto clean;
436
			if (type_str != NULL) {
447
			if (type_str != NULL) {
437
				if (!vector_str_push(&subst_v, " imaginary", 10))
448
				if (!vector_str_push(&subst_v, " imaginary",
449
				    10))
438
					goto clean;
450
					goto clean;
439
				if (!cpp_demangle_push_subst_v(ddata, &subst_v))
451
				if (!cpp_demangle_push_subst_v(ddata,
452
				    &subst_v))
440
					goto clean;
453
					goto clean;
441
			}
454
			}
442
			break;
455
			break;
443
456
444
		case TYPE_EXT:
457
		case TYPE_EXT:
445
			if (e_idx > v->ext_name.size - 1)
458
			if (v->ext_name.size == 0 ||
459
			    e_idx > v->ext_name.size - 1)
446
				goto clean;
460
				goto clean;
447
			if ((e_len = strlen(v->ext_name.container[e_idx])) == 0)
461
			if ((e_len = strlen(v->ext_name.container[e_idx])) ==
462
			    0)
448
				goto clean;
463
				goto clean;
449
			if ((buf = malloc(sizeof(char) * (e_len + 1))) == NULL)
464
			if ((buf = malloc(e_len + 2)) == NULL)
450
				goto clean;
465
				goto clean;
451
466
			snprintf(buf, e_len + 2, " %s",
452
			memcpy(buf, " ", 1);
467
			    v->ext_name.container[e_idx]);
453
			memcpy(buf + 1, v->ext_name.container[e_idx], e_len);
454
468
455
			if (!cpp_demangle_push_str(ddata, buf, e_len + 1)) {
469
			if (!cpp_demangle_push_str(ddata, buf, e_len + 1)) {
456
				free(buf);
470
				free(buf);
Lines 463-469 cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata, Link Here
463
					free(buf);
477
					free(buf);
464
					goto clean;
478
					goto clean;
465
				}
479
				}
466
				if (!cpp_demangle_push_subst_v(ddata, &subst_v)) {
480
				if (!cpp_demangle_push_subst_v(ddata,
481
				    &subst_v)) {
467
					free(buf);
482
					free(buf);
468
					goto clean;
483
					goto clean;
469
				}
484
				}
Lines 478-484 cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata, Link Here
478
			if (type_str != NULL) {
493
			if (type_str != NULL) {
479
				if (!vector_str_push(&subst_v, " restrict", 9))
494
				if (!vector_str_push(&subst_v, " restrict", 9))
480
					goto clean;
495
					goto clean;
481
				if (!cpp_demangle_push_subst_v(ddata, &subst_v))
496
				if (!cpp_demangle_push_subst_v(ddata,
497
				    &subst_v))
482
					goto clean;
498
					goto clean;
483
			}
499
			}
484
			break;
500
			break;
Lines 489-495 cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata, Link Here
489
			if (type_str != NULL) {
505
			if (type_str != NULL) {
490
				if (!vector_str_push(&subst_v, " volatile", 9))
506
				if (!vector_str_push(&subst_v, " volatile", 9))
491
					goto clean;
507
					goto clean;
492
				if (!cpp_demangle_push_subst_v(ddata, &subst_v))
508
				if (!cpp_demangle_push_subst_v(ddata,
509
				    &subst_v))
493
					goto clean;
510
					goto clean;
494
			}
511
			}
495
			break;
512
			break;
Lines 500-510 cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata, Link Here
500
			if (type_str != NULL) {
517
			if (type_str != NULL) {
501
				if (!vector_str_push(&subst_v, " const", 6))
518
				if (!vector_str_push(&subst_v, " const", 6))
502
					goto clean;
519
					goto clean;
503
				if (!cpp_demangle_push_subst_v(ddata, &subst_v))
520
				if (!cpp_demangle_push_subst_v(ddata,
521
				    &subst_v))
504
					goto clean;
522
					goto clean;
505
			}
523
			}
506
			break;
524
			break;
507
525
526
		case TYPE_VEC:
527
			if (v->ext_name.size == 0 ||
528
			    e_idx > v->ext_name.size - 1)
529
				goto clean;
530
			if ((e_len = strlen(v->ext_name.container[e_idx])) ==
531
			    0)
532
				goto clean;
533
			if ((buf = malloc(e_len + 12)) == NULL)
534
				goto clean;
535
			snprintf(buf, e_len + 12, " __vector(%s)",
536
			    v->ext_name.container[e_idx]);
537
			if (!cpp_demangle_push_str(ddata, buf, e_len + 11)) {
538
				free(buf);
539
				goto clean;
540
			}
541
			if (type_str != NULL) {
542
				if (!vector_str_push(&subst_v, buf,
543
				    e_len + 11)) {
544
					free(buf);
545
					goto clean;
546
				}
547
				if (!cpp_demangle_push_subst_v(ddata,
548
				    &subst_v)) {
549
					free(buf);
550
					goto clean;
551
				}
552
			}
553
			free(buf);
554
			++e_idx;
555
			break;
508
		};
556
		};
509
		--idx;
557
		--idx;
510
	}
558
	}
Lines 655-664 cpp_demangle_read_expr_primary(struct cpp_demangle_data *ddata) Link Here
655
703
656
	switch (*ddata->cur) {
704
	switch (*ddata->cur) {
657
	case 'b':
705
	case 'b':
706
		if (*(ddata->cur + 2) != 'E')
707
			return (0);
658
		switch (*(++ddata->cur)) {
708
		switch (*(++ddata->cur)) {
659
		case '0':
709
		case '0':
710
			ddata->cur += 2;
660
			return (cpp_demangle_push_str(ddata, "false", 5));
711
			return (cpp_demangle_push_str(ddata, "false", 5));
661
		case '1':
712
		case '1':
713
			ddata->cur += 2;
662
			return (cpp_demangle_push_str(ddata, "true", 4));
714
			return (cpp_demangle_push_str(ddata, "true", 4));
663
		default:
715
		default:
664
			return (0);
716
			return (0);
Lines 707-713 cpp_demangle_read_expr_primary(struct cpp_demangle_data *ddata) Link Here
707
			++ddata->cur;
759
			++ddata->cur;
708
		}
760
		}
709
		++ddata->cur;
761
		++ddata->cur;
710
		return (cpp_demangle_push_str(ddata, num, ddata->cur - num));
762
		return (cpp_demangle_push_str(ddata, num,
763
		    ddata->cur - num - 1));
711
764
712
	default:
765
	default:
713
		return (0);
766
		return (0);
Lines 999-1004 cpp_demangle_read_expression(struct cpp_demangle_data *ddata) Link Here
999
}
1052
}
1000
1053
1001
static int
1054
static int
1055
cpp_demangle_read_expression_flat(struct cpp_demangle_data *ddata, char **str)
1056
{
1057
	struct vector_str *output;
1058
	size_t i, p_idx, idx, exp_len;
1059
	char *exp;
1060
1061
	output = ddata->push_head > 0 ? &ddata->output_tmp :
1062
	    &ddata->output;
1063
1064
	p_idx = output->size;
1065
1066
	if (!cpp_demangle_read_expression(ddata))
1067
		return (0);
1068
1069
	if ((exp = vector_str_substr(output, p_idx, output->size - 1,
1070
	    &exp_len)) == NULL)
1071
		return (0);
1072
1073
	idx = output->size;
1074
	for (i = p_idx; i < idx; ++i) {
1075
		if (!vector_str_pop(output)) {
1076
			free(exp);
1077
			return (0);
1078
		}
1079
	}
1080
1081
	*str = exp;
1082
1083
	return (1);
1084
}
1085
1086
static int
1002
cpp_demangle_read_expression_binary(struct cpp_demangle_data *ddata,
1087
cpp_demangle_read_expression_binary(struct cpp_demangle_data *ddata,
1003
    const char *name, size_t len)
1088
    const char *name, size_t len)
1004
{
1089
{
Lines 1127-1138 cpp_demangle_read_function(struct cpp_demangle_data *ddata, int *ext_c, Link Here
1127
static int
1212
static int
1128
cpp_demangle_read_encoding(struct cpp_demangle_data *ddata)
1213
cpp_demangle_read_encoding(struct cpp_demangle_data *ddata)
1129
{
1214
{
1215
	char *name, *type, *num_str;
1216
	long offset;
1217
	int rtn;
1130
1218
1131
	if (ddata == NULL || *ddata->cur == '\0')
1219
	if (ddata == NULL || *ddata->cur == '\0')
1132
		return (0);
1220
		return (0);
1133
1221
1134
	/* special name */
1222
	/* special name */
1135
	switch (SIMPLE_HASH(*ddata->cur, *(ddata->cur + 1))) {
1223
	switch (SIMPLE_HASH(*ddata->cur, *(ddata->cur + 1))) {
1224
	case SIMPLE_HASH('G', 'A'):
1225
		if (!cpp_demangle_push_str(ddata, "hidden alias for ", 17))
1226
			return (0);
1227
		ddata->cur += 2;
1228
		if (*ddata->cur == '\0')
1229
			return (0);
1230
		return (cpp_demangle_read_encoding(ddata));
1231
1232
	case SIMPLE_HASH('G', 'R'):
1233
		if (!cpp_demangle_push_str(ddata, "reference temporary #", 21))
1234
			return (0);
1235
		ddata->cur += 2;
1236
		if (*ddata->cur == '\0')
1237
			return (0);
1238
		if (!cpp_demangle_read_name_flat(ddata, &name))
1239
			return (0);
1240
		rtn = 0;
1241
		if (!cpp_demangle_read_number_as_string(ddata, &num_str))
1242
			goto clean1;
1243
		if (!cpp_demangle_push_str(ddata, num_str, strlen(num_str)))
1244
			goto clean2;
1245
		if (!cpp_demangle_push_str(ddata, " for ", 5))
1246
			goto clean2;
1247
		if (!cpp_demangle_push_str(ddata, name, strlen(name)))
1248
			goto clean2;
1249
		rtn = 1;
1250
	clean2:
1251
		free(num_str);
1252
	clean1:
1253
		free(name);
1254
		return (rtn);
1255
1256
	case SIMPLE_HASH('G', 'T'):
1257
		ddata->cur += 2;
1258
		if (*ddata->cur == '\0')
1259
			return (0);
1260
		switch (*ddata->cur) {
1261
		case 'n':
1262
			if (!cpp_demangle_push_str(ddata,
1263
			    "non-transaction clone for ", 26))
1264
				return (0);
1265
		case 't':
1266
		default:
1267
			if (!cpp_demangle_push_str(ddata,
1268
			    "transaction clone for ", 22))
1269
				return (0);
1270
		}
1271
		++ddata->cur;
1272
		return (cpp_demangle_read_encoding(ddata));
1273
1136
	case SIMPLE_HASH('G', 'V'):
1274
	case SIMPLE_HASH('G', 'V'):
1137
		/* sentry object for 1 time init */
1275
		/* sentry object for 1 time init */
1138
		if (!cpp_demangle_push_str(ddata, "guard variable for ", 20))
1276
		if (!cpp_demangle_push_str(ddata, "guard variable for ", 20))
Lines 1154-1167 cpp_demangle_read_encoding(struct cpp_demangle_data *ddata) Link Here
1154
			return (0);
1292
			return (0);
1155
		return (cpp_demangle_read_encoding(ddata));
1293
		return (cpp_demangle_read_encoding(ddata));
1156
1294
1295
	case SIMPLE_HASH('T', 'C'):
1296
		/* construction vtable */
1297
		if (!cpp_demangle_push_str(ddata, "construction vtable for ",
1298
		    24))
1299
			return (0);
1300
		ddata->cur += 2;
1301
		if (*ddata->cur == '\0')
1302
			return (0);
1303
		if (!cpp_demangle_read_type_flat(ddata, &type))
1304
			return (0);
1305
		rtn = 0;
1306
		if (!cpp_demangle_read_number(ddata, &offset))
1307
			goto clean3;
1308
		if (*ddata->cur++ != '_')
1309
			goto clean3;
1310
		if (!cpp_demangle_read_type(ddata, 0))
1311
			goto clean3;
1312
		if (!cpp_demangle_push_str(ddata, "-in-", 4))
1313
			goto clean3;
1314
		if (!cpp_demangle_push_str(ddata, type, strlen(type)))
1315
			goto clean3;
1316
		rtn = 1;
1317
	clean3:
1318
		free(type);
1319
		return (rtn);
1320
1157
	case SIMPLE_HASH('T', 'D'):
1321
	case SIMPLE_HASH('T', 'D'):
1158
		/* typeinfo common proxy */
1322
		/* typeinfo common proxy */
1159
		break;
1323
		break;
1160
1324
1325
	case SIMPLE_HASH('T', 'F'):
1326
		/* typeinfo fn */
1327
		if (!cpp_demangle_push_str(ddata, "typeinfo fn for ", 16))
1328
			return (0);
1329
		ddata->cur += 2;
1330
		if (*ddata->cur == '\0')
1331
			return (0);
1332
		return (cpp_demangle_read_type(ddata, 0));
1333
1161
	case SIMPLE_HASH('T', 'h'):
1334
	case SIMPLE_HASH('T', 'h'):
1162
		/* virtual function non-virtual override thunk */
1335
		/* virtual function non-virtual override thunk */
1163
		if (cpp_demangle_push_str(ddata,
1336
		if (!cpp_demangle_push_str(ddata,
1164
		    "virtual function non-virtual override ", 38) == 0)
1337
		    "virtual function non-virtual override ", 38))
1165
			return (0);
1338
			return (0);
1166
		ddata->cur += 2;
1339
		ddata->cur += 2;
1167
		if (*ddata->cur == '\0')
1340
		if (*ddata->cur == '\0')
Lines 1170-1193 cpp_demangle_read_encoding(struct cpp_demangle_data *ddata) Link Here
1170
			return (0);
1343
			return (0);
1171
		return (cpp_demangle_read_encoding(ddata));
1344
		return (cpp_demangle_read_encoding(ddata));
1172
1345
1346
	case SIMPLE_HASH('T', 'H'):
1347
		/* TLS init function */
1348
		if (!cpp_demangle_push_str(ddata, "TLS init function for ",
1349
		    22))
1350
			return (0);
1351
		ddata->cur += 2;
1352
		if (*ddata->cur == '\0')
1353
			return (0);
1354
		break;
1355
1173
	case SIMPLE_HASH('T', 'I'):
1356
	case SIMPLE_HASH('T', 'I'):
1174
		/* typeinfo structure */
1357
		/* typeinfo structure */
1175
		/* FALLTHROUGH */
1358
		if (!cpp_demangle_push_str(ddata, "typeinfo for ", 13))
1359
			return (0);
1360
		ddata->cur += 2;
1361
		if (*ddata->cur == '\0')
1362
			return (0);
1363
		return (cpp_demangle_read_type(ddata, 0));
1364
1365
	case SIMPLE_HASH('T', 'J'):
1366
		/* java class */
1367
		if (!cpp_demangle_push_str(ddata, "java Class for ", 15))
1368
			return (0);
1369
		ddata->cur += 2;
1370
		if (*ddata->cur == '\0')
1371
			return (0);
1372
		return (cpp_demangle_read_type(ddata, 0));
1373
1176
	case SIMPLE_HASH('T', 'S'):
1374
	case SIMPLE_HASH('T', 'S'):
1177
		/* RTTI name (NTBS) */
1375
		/* RTTI name (NTBS) */
1178
		if (!cpp_demangle_push_str(ddata, "typeinfo for ", 14))
1376
		if (!cpp_demangle_push_str(ddata, "typeinfo name for ", 18))
1179
			return (0);
1377
			return (0);
1180
		ddata->cur += 2;
1378
		ddata->cur += 2;
1181
		if (*ddata->cur == '\0')
1379
		if (*ddata->cur == '\0')
1182
			return (0);
1380
			return (0);
1183
		return (cpp_demangle_read_type(ddata, 1));
1381
		return (cpp_demangle_read_type(ddata, 0));
1184
1382
1185
	case SIMPLE_HASH('T', 'T'):
1383
	case SIMPLE_HASH('T', 'T'):
1186
		/* VTT table */
1384
		/* VTT table */
1187
		if (!cpp_demangle_push_str(ddata, "VTT for ", 8))
1385
		if (!cpp_demangle_push_str(ddata, "VTT for ", 8))
1188
			return (0);
1386
			return (0);
1189
		ddata->cur += 2;
1387
		ddata->cur += 2;
1190
		return (cpp_demangle_read_type(ddata, 1));
1388
		if (*ddata->cur == '\0')
1389
			return (0);
1390
		return (cpp_demangle_read_type(ddata, 0));
1191
1391
1192
	case SIMPLE_HASH('T', 'v'):
1392
	case SIMPLE_HASH('T', 'v'):
1193
		/* virtual function virtual override thunk */
1393
		/* virtual function virtual override thunk */
Lines 1208-1214 cpp_demangle_read_encoding(struct cpp_demangle_data *ddata) Link Here
1208
		ddata->cur += 2;
1408
		ddata->cur += 2;
1209
		if (*ddata->cur == '\0')
1409
		if (*ddata->cur == '\0')
1210
			return (0);
1410
			return (0);
1211
		return (cpp_demangle_read_type(ddata, 1));
1411
		return (cpp_demangle_read_type(ddata, 0));
1412
1413
	case SIMPLE_HASH('T', 'W'):
1414
		/* TLS wrapper function */
1415
		if (!cpp_demangle_push_str(ddata, "TLS wrapper function for ",
1416
		    25))
1417
			return (0);
1418
		ddata->cur += 2;
1419
		if (*ddata->cur == '\0')
1420
			return (0);
1421
		break;
1212
	};
1422
	};
1213
1423
1214
	return (cpp_demangle_read_name(ddata));
1424
	return (cpp_demangle_read_name(ddata));
Lines 1270-1277 cpp_demangle_read_name(struct cpp_demangle_data *ddata) Link Here
1270
	if (ddata == NULL || *ddata->cur == '\0')
1480
	if (ddata == NULL || *ddata->cur == '\0')
1271
		return (0);
1481
		return (0);
1272
1482
1273
	output = cpp_demangle_gnu3_push_head > 0 ?
1483
	output = ddata->push_head > 0 ? &ddata->output_tmp : &ddata->output;
1274
	    &ddata->output_tmp : &ddata->output;
1275
1484
1276
	subst_str = NULL;
1485
	subst_str = NULL;
1277
1486
Lines 1327-1332 clean: Link Here
1327
}
1536
}
1328
1537
1329
static int
1538
static int
1539
cpp_demangle_read_name_flat(struct cpp_demangle_data *ddata, char **str)
1540
{
1541
	struct vector_str *output;
1542
	size_t i, p_idx, idx, name_len;
1543
	char *name;
1544
1545
	output = ddata->push_head > 0 ? &ddata->output_tmp :
1546
	    &ddata->output;
1547
1548
	p_idx = output->size;
1549
1550
	if (!cpp_demangle_read_name(ddata))
1551
		return (0);
1552
1553
	if ((name = vector_str_substr(output, p_idx, output->size - 1,
1554
	    &name_len)) == NULL)
1555
		return (0);
1556
1557
	idx = output->size;
1558
	for (i = p_idx; i < idx; ++i) {
1559
		if (!vector_str_pop(output)) {
1560
			free(name);
1561
			return (0);
1562
		}
1563
	}
1564
1565
	*str = name;
1566
1567
	return (1);
1568
}
1569
1570
static int
1330
cpp_demangle_read_nested_name(struct cpp_demangle_data *ddata)
1571
cpp_demangle_read_nested_name(struct cpp_demangle_data *ddata)
1331
{
1572
{
1332
	struct vector_str *output, v;
1573
	struct vector_str *output, v;
Lines 1355-1362 cpp_demangle_read_nested_name(struct cpp_demangle_data *ddata) Link Here
1355
		++ddata->cur;
1596
		++ddata->cur;
1356
	}
1597
	}
1357
1598
1358
	output = cpp_demangle_gnu3_push_head > 0 ?
1599
	output = ddata->push_head > 0 ? &ddata->output_tmp : &ddata->output;
1359
	    &ddata->output_tmp : &ddata->output;
1360
	if (!vector_str_init(&v))
1600
	if (!vector_str_init(&v))
1361
		return (0);
1601
		return (0);
1362
1602
Lines 1453-1458 cpp_demangle_read_number(struct cpp_demangle_data *ddata, long *rtn) Link Here
1453
}
1693
}
1454
1694
1455
static int
1695
static int
1696
cpp_demangle_read_number_as_string(struct cpp_demangle_data *ddata, char **str)
1697
{
1698
	long n;
1699
1700
	if (!cpp_demangle_read_number(ddata, &n)) {
1701
		*str = NULL;
1702
		return (0);
1703
	}
1704
1705
	if (asprintf(str, "%ld", n) < 0) {
1706
		*str = NULL;
1707
		return (0);
1708
	}
1709
1710
	return (1);
1711
}
1712
1713
static int
1456
cpp_demangle_read_nv_offset(struct cpp_demangle_data *ddata)
1714
cpp_demangle_read_nv_offset(struct cpp_demangle_data *ddata)
1457
{
1715
{
1458
1716
Lines 1581-1589 static int Link Here
1581
cpp_demangle_read_sname(struct cpp_demangle_data *ddata)
1839
cpp_demangle_read_sname(struct cpp_demangle_data *ddata)
1582
{
1840
{
1583
	long len;
1841
	long len;
1842
	int err;
1584
1843
1585
	if (ddata == NULL || cpp_demangle_read_number(ddata, &len) == 0 ||
1844
	if (ddata == NULL || cpp_demangle_read_number(ddata, &len) == 0 ||
1586
	    len <= 0 || cpp_demangle_push_str(ddata, ddata->cur, len) == 0)
1845
	    len <= 0)
1846
		return (0);
1847
1848
	if (len == 12 && (memcmp("_GLOBAL__N_1", ddata->cur, 12) == 0))
1849
		err = cpp_demangle_push_str(ddata, "(anonymous namespace)", 21);
1850
	else
1851
		err = cpp_demangle_push_str(ddata, ddata->cur, len);
1852
1853
	if (err == 0)
1587
		return (0);
1854
		return (0);
1588
1855
1589
	assert(ddata->output.size > 0);
1856
	assert(ddata->output.size > 0);
Lines 1732-1739 cpp_demangle_read_subst_std(struct cpp_demangle_data *ddata) Link Here
1732
1999
1733
	ddata->cur += 2;
2000
	ddata->cur += 2;
1734
2001
1735
	output = cpp_demangle_gnu3_push_head > 0 ?
2002
	output = ddata->push_head > 0 ? &ddata->output_tmp : &ddata->output;
1736
	    &ddata->output_tmp : &ddata->output;
1737
2003
1738
	p_idx = output->size;
2004
	p_idx = output->size;
1739
	if (!cpp_demangle_read_uqname(ddata))
2005
	if (!cpp_demangle_read_uqname(ddata))
Lines 1783-1790 cpp_demangle_read_subst_stdtmpl(struct cpp_demangle_data *ddata, Link Here
1783
	if (ddata == NULL || str == NULL || len == 0)
2049
	if (ddata == NULL || str == NULL || len == 0)
1784
		return (0);
2050
		return (0);
1785
2051
1786
	output = cpp_demangle_gnu3_push_head > 0 ? &ddata->output_tmp :
2052
	output = ddata->push_head > 0 ? &ddata->output_tmp : &ddata->output;
1787
	    &ddata->output;
1788
2053
1789
	p_idx = output->size;
2054
	p_idx = output->size;
1790
	substr = NULL;
2055
	substr = NULL;
Lines 1852-1859 cpp_demangle_read_tmpl_args(struct cpp_demangle_data *ddata) Link Here
1852
		return (0);
2117
		return (0);
1853
2118
1854
	limit = 0;
2119
	limit = 0;
1855
	v = cpp_demangle_gnu3_push_head > 0 ?
2120
	v = ddata->push_head > 0 ? &ddata->output_tmp : &ddata->output;
1856
	    &ddata->output_tmp : &ddata->output;
1857
	for (;;) {
2121
	for (;;) {
1858
		idx = v->size;
2122
		idx = v->size;
1859
		if (!cpp_demangle_read_tmpl_arg(ddata))
2123
		if (!cpp_demangle_read_tmpl_arg(ddata))
Lines 1936-1949 cpp_demangle_read_type(struct cpp_demangle_data *ddata, int delimit) Link Here
1936
	size_t p_idx, type_str_len;
2200
	size_t p_idx, type_str_len;
1937
	int extern_c, is_builtin;
2201
	int extern_c, is_builtin;
1938
	long len;
2202
	long len;
1939
	char *type_str;
2203
	char *type_str, *exp_str, *num_str;
1940
2204
1941
	if (ddata == NULL)
2205
	if (ddata == NULL)
1942
		return (0);
2206
		return (0);
1943
2207
1944
	output = &ddata->output;
2208
	output = &ddata->output;
1945
	if (!strncmp(ddata->output.container[ddata->output.size - 1], ">", 1)) {
2209
	if (!strncmp(ddata->output.container[ddata->output.size - 1], ">", 1)) {
1946
		cpp_demangle_gnu3_push_head++;
2210
		ddata->push_head++;
1947
		output = &ddata->output_tmp;
2211
		output = &ddata->output_tmp;
1948
	} else if (delimit == 1) {
2212
	} else if (delimit == 1) {
1949
		if (ddata->paren == false) {
2213
		if (ddata->paren == false) {
Lines 1978-1984 cpp_demangle_read_type(struct cpp_demangle_data *ddata, int delimit) Link Here
1978
	extern_c = 0;
2242
	extern_c = 0;
1979
	is_builtin = 1;
2243
	is_builtin = 1;
1980
	p_idx = output->size;
2244
	p_idx = output->size;
1981
	type_str = NULL;
2245
	type_str = exp_str = num_str = NULL;
1982
again:
2246
again:
1983
	/* builtin type */
2247
	/* builtin type */
1984
	switch (*ddata->cur) {
2248
	switch (*ddata->cur) {
Lines 2024-2029 again: Link Here
2024
		++ddata->cur;
2288
		++ddata->cur;
2025
		goto rtn;
2289
		goto rtn;
2026
2290
2291
	case 'D':
2292
		++ddata->cur;
2293
		switch (*ddata->cur) {
2294
		case 'd':
2295
			/* IEEE 754r decimal floating point (64 bits) */
2296
			if (!cpp_demangle_push_str(ddata, "decimal64", 9))
2297
				goto clean;
2298
			++ddata->cur;
2299
			break;
2300
		case 'e':
2301
			/* IEEE 754r decimal floating point (128 bits) */
2302
			if (!cpp_demangle_push_str(ddata, "decimal128", 10))
2303
				goto clean;
2304
			++ddata->cur;
2305
			break;
2306
		case 'f':
2307
			/* IEEE 754r decimal floating point (32 bits) */
2308
			if (!cpp_demangle_push_str(ddata, "decimal32", 9))
2309
				goto clean;
2310
			++ddata->cur;
2311
			break;
2312
		case 'h':
2313
			/* IEEE 754r half-precision floating point (16 bits) */
2314
			if (!cpp_demangle_push_str(ddata, "half", 4))
2315
				goto clean;
2316
			++ddata->cur;
2317
			break;
2318
		case 'i':
2319
			/* char32_t */
2320
			if (!cpp_demangle_push_str(ddata, "char32_t", 8))
2321
				goto clean;
2322
			++ddata->cur;
2323
			break;
2324
		case 'n':
2325
			/* std::nullptr_t (i.e., decltype(nullptr)) */
2326
			if (!cpp_demangle_push_str(ddata, "decltype(nullptr)",
2327
			    17))
2328
				goto clean;
2329
			++ddata->cur;
2330
			break;
2331
		case 's':
2332
			/* char16_t */
2333
			if (!cpp_demangle_push_str(ddata, "char16_t", 8))
2334
				goto clean;
2335
			++ddata->cur;
2336
			break;
2337
		case 'v':
2338
			/* gcc vector_size extension. */
2339
			++ddata->cur;
2340
			if (*ddata->cur == '_') {
2341
				++ddata->cur;
2342
				if (!cpp_demangle_read_expression_flat(ddata,
2343
				    &exp_str))
2344
					goto clean;
2345
				if (!vector_str_push(&v.ext_name, exp_str,
2346
				    strlen(exp_str)))
2347
					goto clean;
2348
			} else {
2349
				if (!cpp_demangle_read_number_as_string(ddata,
2350
				    &num_str))
2351
					goto clean;
2352
				if (!vector_str_push(&v.ext_name, num_str,
2353
				    strlen(num_str)))
2354
					goto clean;
2355
			}
2356
			if (*ddata->cur != '_')
2357
				goto clean;
2358
			++ddata->cur;
2359
			if (!vector_type_qualifier_push(&v, TYPE_VEC))
2360
				goto clean;
2361
			goto again;
2362
		default:
2363
			goto clean;
2364
		}
2365
		goto rtn;
2366
2027
	case 'e':
2367
	case 'e':
2028
		/* long double */
2368
		/* long double */
2029
		if (!cpp_demangle_push_str(ddata, "long double", 11))
2369
		if (!cpp_demangle_push_str(ddata, "long double", 11))
Lines 2118-2124 again: Link Here
2118
2458
2119
	case 'o':
2459
	case 'o':
2120
		/* unsigned __int128 */
2460
		/* unsigned __int128 */
2121
		if (!cpp_demangle_push_str(ddata, "unsigned _;int128", 17))
2461
		if (!cpp_demangle_push_str(ddata, "unsigned __int128", 17))
2122
			goto clean;
2462
			goto clean;
2123
		++ddata->cur;
2463
		++ddata->cur;
2124
		goto rtn;
2464
		goto rtn;
Lines 2189-2194 again: Link Here
2189
		if (!vector_str_push(&v.ext_name, ddata->cur, len))
2529
		if (!vector_str_push(&v.ext_name, ddata->cur, len))
2190
			return (0);
2530
			return (0);
2191
		ddata->cur += len;
2531
		ddata->cur += len;
2532
		if (!vector_type_qualifier_push(&v, TYPE_EXT))
2533
			goto clean;
2192
		goto again;
2534
		goto again;
2193
2535
2194
	case 'v':
2536
	case 'v':
Lines 2253-2266 rtn: Link Here
2253
		goto clean;
2595
		goto clean;
2254
2596
2255
	free(type_str);
2597
	free(type_str);
2598
	free(exp_str);
2599
	free(num_str);
2256
	vector_type_qualifier_dest(&v);
2600
	vector_type_qualifier_dest(&v);
2257
2601
2258
	if (cpp_demangle_gnu3_push_head > 0) {
2602
	if (ddata->push_head > 0) {
2259
		if (*ddata->cur == 'I' && cpp_demangle_read_tmpl_args(ddata)
2603
		if (*ddata->cur == 'I' && cpp_demangle_read_tmpl_args(ddata)
2260
		    == 0)
2604
		    == 0)
2261
			return (0);
2605
			return (0);
2262
2606
2263
		if (--cpp_demangle_gnu3_push_head > 0)
2607
		if (--ddata->push_head > 0)
2264
			return (1);
2608
			return (1);
2265
2609
2266
		if (!vector_str_push(&ddata->output_tmp, " ", 1))
2610
		if (!vector_str_push(&ddata->output_tmp, " ", 1))
Lines 2284-2294 rtn: Link Here
2284
	return (1);
2628
	return (1);
2285
clean:
2629
clean:
2286
	free(type_str);
2630
	free(type_str);
2631
	free(exp_str);
2632
	free(num_str);
2287
	vector_type_qualifier_dest(&v);
2633
	vector_type_qualifier_dest(&v);
2288
2634
2289
	return (0);
2635
	return (0);
2290
}
2636
}
2291
2637
2638
static int
2639
cpp_demangle_read_type_flat(struct cpp_demangle_data *ddata, char **str)
2640
{
2641
	struct vector_str *output;
2642
	size_t i, p_idx, idx, type_len;
2643
	char *type;
2644
2645
	output = ddata->push_head > 0 ? &ddata->output_tmp :
2646
	    &ddata->output;
2647
2648
	p_idx = output->size;
2649
2650
	if (!cpp_demangle_read_type(ddata, 0))
2651
		return (0);
2652
2653
	if ((type = vector_str_substr(output, p_idx, output->size - 1,
2654
	    &type_len)) == NULL)
2655
		return (0);
2656
2657
	idx = output->size;
2658
	for (i = p_idx; i < idx; ++i) {
2659
		if (!vector_str_pop(output)) {
2660
			free(type);
2661
			return (0);
2662
		}
2663
	}
2664
2665
	*str = type;
2666
2667
	return (1);
2668
}
2669
2292
/*
2670
/*
2293
 * read unqualified-name, unqualified name are operator-name, ctor-dtor-name,
2671
 * read unqualified-name, unqualified name are operator-name, ctor-dtor-name,
2294
 * source-name
2672
 * source-name
(-)b/contrib/elftoolchain/libelftc/os.Linux.mk (-1 / +1 lines)
Lines 1-3 Link Here
1
# $Id: os.Linux.mk 994 2010-06-13 10:39:19Z jkoshy $
1
# $Id: os.Linux.mk 994 2010-06-13 10:39:19Z jkoshy $
2
2
3
CFLAGS+=	-Wall
3
CFLAGS+=	-Wall -D_GNU_SOURCE
(-)b/contrib/elftoolchain/readelf/readelf.c (+3 lines)
Lines 445-450 elf_machine(unsigned int mach) Link Here
445
	case EM_SPARC: return "Sun SPARC";
445
	case EM_SPARC: return "Sun SPARC";
446
	case EM_386: return "Intel i386";
446
	case EM_386: return "Intel i386";
447
	case EM_68K: return "Motorola 68000";
447
	case EM_68K: return "Motorola 68000";
448
	case EM_IAMCU: return "Intel MCU";
448
	case EM_88K: return "Motorola 88000";
449
	case EM_88K: return "Motorola 88000";
449
	case EM_860: return "Intel i860";
450
	case EM_860: return "Intel i860";
450
	case EM_MIPS: return "MIPS R3000 Big-Endian only";
451
	case EM_MIPS: return "MIPS R3000 Big-Endian only";
Lines 1050-1055 r_type(unsigned int mach, unsigned int type) Link Here
1050
	switch(mach) {
1051
	switch(mach) {
1051
	case EM_NONE: return "";
1052
	case EM_NONE: return "";
1052
	case EM_386:
1053
	case EM_386:
1054
	case EM_IAMCU:
1053
		switch(type) {
1055
		switch(type) {
1054
		case 0: return "R_386_NONE";
1056
		case 0: return "R_386_NONE";
1055
		case 1: return "R_386_32";
1057
		case 1: return "R_386_32";
Lines 2381-2386 dwarf_reg(unsigned int mach, unsigned int reg) Link Here
2381
2383
2382
	switch (mach) {
2384
	switch (mach) {
2383
	case EM_386:
2385
	case EM_386:
2386
	case EM_IAMCU:
2384
		switch (reg) {
2387
		switch (reg) {
2385
		case 0: return "eax";
2388
		case 0: return "eax";
2386
		case 1: return "ecx";
2389
		case 1: return "ecx";

Return to bug 198611