aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Wang <kaiw@FreeBSD.org>2014-01-15 08:43:20 +0000
committerKai Wang <kaiw@FreeBSD.org>2014-01-15 08:43:20 +0000
commit5265ace0e440a23fb522c516f4ee20f43eaed2b3 (patch)
tree13068447bb61372f7540b168e913b8eb88ef7578
downloadsrc-5265ace0e440a23fb522c516f4ee20f43eaed2b3.tar.gz
src-5265ace0e440a23fb522c516f4ee20f43eaed2b3.zip
Initial import of elftoolchain r2974.vendor/elftoolchain/elftoolchain-r2974
Obtained from: elftoolchain.org
Notes
Notes: svn path=/vendor/elftoolchain/dist/; revision=260684 svn path=/vendor/elftoolchain/elftoolchain-r2974/; revision=260685; tag=vendor/elftoolchain/elftoolchain-r2974
-rw-r--r--GNUmakefile22
-rw-r--r--INSTALL283
-rw-r--r--Makefile54
-rw-r--r--README127
-rw-r--r--RELEASE-NOTES206
-rw-r--r--addr2line/Makefile15
-rw-r--r--addr2line/addr2line.1159
-rw-r--r--addr2line/addr2line.c410
-rw-r--r--ar/Makefile35
-rw-r--r--ar/acplex.l84
-rw-r--r--ar/acpyacc.y661
-rw-r--r--ar/ar.1603
-rw-r--r--ar/ar.5327
-rw-r--r--ar/ar.c435
-rw-r--r--ar/ar.h143
-rwxr-xr-xar/benchmark/acp.sh65
-rw-r--r--ar/ranlib.186
-rw-r--r--ar/read.c192
-rw-r--r--ar/util.c185
-rw-r--r--ar/write.c978
-rw-r--r--as/Makefile14
-rw-r--r--as/as.1211
-rw-r--r--as/as.c216
-rw-r--r--brandelf/Makefile9
-rw-r--r--brandelf/brandelf.1149
-rw-r--r--brandelf/brandelf.c314
-rw-r--r--common/Makefile15
-rw-r--r--common/_elftc.h458
-rw-r--r--common/elfdefinitions.h2614
-rwxr-xr-xcommon/native-elf-format47
-rw-r--r--common/os.Linux.mk13
-rw-r--r--common/utarray.h237
-rw-r--r--common/uthash.h919
-rw-r--r--cxxfilt/Makefile15
-rw-r--r--cxxfilt/c++filt.1109
-rw-r--r--cxxfilt/cxxfilt.c224
-rw-r--r--documentation/Makefile7
-rw-r--r--documentation/libelf-by-example/Makefile28
-rw-r--r--documentation/libelf-by-example/libelf-by-example.tex2846
-rw-r--r--documentation/libelf-by-example/prog1.txt58
-rw-r--r--documentation/libelf-by-example/prog2.txt102
-rw-r--r--documentation/libelf-by-example/prog3.txt102
-rw-r--r--documentation/libelf-by-example/prog4.txt92
-rw-r--r--documentation/libelf-by-example/prog5.txt133
-rw-r--r--documentation/libelf-by-example/prog6.txt57
-rw-r--r--elfcopy/Makefile41
-rw-r--r--elfcopy/archive.c528
-rw-r--r--elfcopy/ascii.c1078
-rw-r--r--elfcopy/binary.c286
-rw-r--r--elfcopy/elfcopy.1323
-rw-r--r--elfcopy/elfcopy.h313
-rw-r--r--elfcopy/main.c1500
-rw-r--r--elfcopy/mcs.1125
-rw-r--r--elfcopy/sections.c1518
-rw-r--r--elfcopy/segments.c493
-rw-r--r--elfcopy/strip.1132
-rw-r--r--elfcopy/symbols.c1040
-rw-r--r--elfdump/Makefile11
-rw-r--r--elfdump/elfdump.1158
-rw-r--r--elfdump/elfdump.c2821
-rw-r--r--findtextrel/Makefile15
-rw-r--r--findtextrel/findtextrel.1104
-rw-r--r--findtextrel/findtextrel.c417
-rw-r--r--isa/Makefile20
-rw-r--r--isa/avr.isa280
-rw-r--r--isa/isa.1248
-rw-r--r--isa/isa.5366
-rw-r--r--isa/isa.c286
-rw-r--r--ld/Makefile49
-rw-r--r--ld/amd64.c1363
-rw-r--r--ld/amd64.h31
-rw-r--r--ld/amd64_script.ld151
-rw-r--r--ld/i386.c624
-rw-r--r--ld/i386.h31
-rw-r--r--ld/i386_script.ld148
-rw-r--r--ld/ld.h158
-rw-r--r--ld/ld_arch.c209
-rw-r--r--ld/ld_arch.h65
-rw-r--r--ld/ld_dynamic.c610
-rw-r--r--ld/ld_dynamic.h34
-rw-r--r--ld/ld_ehframe.c770
-rw-r--r--ld/ld_ehframe.h32
-rw-r--r--ld/ld_error.c95
-rw-r--r--ld/ld_exp.c714
-rw-r--r--ld/ld_exp.h100
-rw-r--r--ld/ld_file.c233
-rw-r--r--ld/ld_file.h70
-rw-r--r--ld/ld_hash.c126
-rw-r--r--ld/ld_hash.h29
-rw-r--r--ld/ld_input.c653
-rw-r--r--ld/ld_input.h121
-rw-r--r--ld/ld_layout.c1254
-rw-r--r--ld/ld_layout.h33
-rw-r--r--ld/ld_main.c145
-rw-r--r--ld/ld_options.c507
-rw-r--r--ld/ld_options.h161
-rw-r--r--ld/ld_output.c1154
-rw-r--r--ld/ld_output.h165
-rw-r--r--ld/ld_path.c295
-rw-r--r--ld/ld_path.h46
-rw-r--r--ld/ld_reloc.c875
-rw-r--r--ld/ld_reloc.h69
-rw-r--r--ld/ld_script.awk16
-rw-r--r--ld/ld_script.c746
-rw-r--r--ld/ld_script.h285
-rw-r--r--ld/ld_script_lexer.l264
-rw-r--r--ld/ld_script_parser.y1227
-rw-r--r--ld/ld_strtab.c238
-rw-r--r--ld/ld_strtab.h35
-rw-r--r--ld/ld_symbols.c1412
-rw-r--r--ld/ld_symbols.h105
-rw-r--r--ld/ld_symver.c854
-rw-r--r--ld/ld_symver.h79
-rw-r--r--ld/ld_utils.h164
-rw-r--r--libdwarf/Makefile324
-rw-r--r--libdwarf/Version.map228
-rw-r--r--libdwarf/_libdwarf.h658
-rw-r--r--libdwarf/dwarf.3727
-rw-r--r--libdwarf/dwarf.h544
-rw-r--r--libdwarf/dwarf_abbrev.c136
-rw-r--r--libdwarf/dwarf_add_AT_comp_dir.399
-rw-r--r--libdwarf/dwarf_add_AT_const_value_string.3126
-rw-r--r--libdwarf/dwarf_add_AT_dataref.3122
-rw-r--r--libdwarf/dwarf_add_AT_flag.3115
-rw-r--r--libdwarf/dwarf_add_AT_location_expr.3120
-rw-r--r--libdwarf/dwarf_add_AT_name.399
-rw-r--r--libdwarf/dwarf_add_AT_producer.399
-rw-r--r--libdwarf/dwarf_add_AT_ref_address.3117
-rw-r--r--libdwarf/dwarf_add_AT_reference.3117
-rw-r--r--libdwarf/dwarf_add_AT_signed_const.3131
-rw-r--r--libdwarf/dwarf_add_AT_string.3114
-rw-r--r--libdwarf/dwarf_add_AT_targ_address.3137
-rw-r--r--libdwarf/dwarf_add_arange.3151
-rw-r--r--libdwarf/dwarf_add_die_to_debug.395
-rw-r--r--libdwarf/dwarf_add_directory_decl.397
-rw-r--r--libdwarf/dwarf_add_expr_addr.3111
-rw-r--r--libdwarf/dwarf_add_expr_gen.3118
-rw-r--r--libdwarf/dwarf_add_fde_inst.3113
-rw-r--r--libdwarf/dwarf_add_file_decl.3122
-rw-r--r--libdwarf/dwarf_add_frame_cie.3124
-rw-r--r--libdwarf/dwarf_add_frame_fde.3201
-rw-r--r--libdwarf/dwarf_add_funcname.3103
-rw-r--r--libdwarf/dwarf_add_line_entry.3163
-rw-r--r--libdwarf/dwarf_add_pubname.3103
-rw-r--r--libdwarf/dwarf_add_typename.3103
-rw-r--r--libdwarf/dwarf_add_varname.3103
-rw-r--r--libdwarf/dwarf_add_weakname.3103
-rw-r--r--libdwarf/dwarf_arange.c171
-rw-r--r--libdwarf/dwarf_attr.3119
-rw-r--r--libdwarf/dwarf_attr.c275
-rw-r--r--libdwarf/dwarf_attrlist.3146
-rw-r--r--libdwarf/dwarf_attrval.c210
-rw-r--r--libdwarf/dwarf_attrval_signed.3205
-rw-r--r--libdwarf/dwarf_child.3202
-rw-r--r--libdwarf/dwarf_cu.c99
-rw-r--r--libdwarf/dwarf_dealloc.3203
-rw-r--r--libdwarf/dwarf_dealloc.c117
-rw-r--r--libdwarf/dwarf_def_macro.3129
-rw-r--r--libdwarf/dwarf_die.c335
-rw-r--r--libdwarf/dwarf_die_abbrev_code.355
-rw-r--r--libdwarf/dwarf_die_link.3118
-rw-r--r--libdwarf/dwarf_diename.390
-rw-r--r--libdwarf/dwarf_dieoffset.3172
-rw-r--r--libdwarf/dwarf_dump.c1292
-rw-r--r--libdwarf/dwarf_end_macro_file.390
-rw-r--r--libdwarf/dwarf_errmsg.367
-rw-r--r--libdwarf/dwarf_errmsg.c90
-rw-r--r--libdwarf/dwarf_errno.358
-rw-r--r--libdwarf/dwarf_expand_frame_instructions.3182
-rw-r--r--libdwarf/dwarf_expr_current_offset.384
-rw-r--r--libdwarf/dwarf_expr_into_block.394
-rw-r--r--libdwarf/dwarf_fde_cfa_offset.399
-rw-r--r--libdwarf/dwarf_find_macro_value_start.368
-rw-r--r--libdwarf/dwarf_finish.3140
-rw-r--r--libdwarf/dwarf_finish.c61
-rw-r--r--libdwarf/dwarf_form.c480
-rw-r--r--libdwarf/dwarf_formaddr.397
-rw-r--r--libdwarf/dwarf_formblock.3109
-rw-r--r--libdwarf/dwarf_formexprloc.3109
-rw-r--r--libdwarf/dwarf_formflag.397
-rw-r--r--libdwarf/dwarf_formref.3136
-rw-r--r--libdwarf/dwarf_formsig8.396
-rw-r--r--libdwarf/dwarf_formstring.3101
-rw-r--r--libdwarf/dwarf_formudata.3122
-rw-r--r--libdwarf/dwarf_frame.c603
-rw-r--r--libdwarf/dwarf_funcs.m436
-rw-r--r--libdwarf/dwarf_get_AT_name.3258
-rw-r--r--libdwarf/dwarf_get_abbrev.3179
-rw-r--r--libdwarf/dwarf_get_abbrev_children_flag.3100
-rw-r--r--libdwarf/dwarf_get_abbrev_code.386
-rw-r--r--libdwarf/dwarf_get_abbrev_entry.3159
-rw-r--r--libdwarf/dwarf_get_abbrev_tag.386
-rw-r--r--libdwarf/dwarf_get_address_size.382
-rw-r--r--libdwarf/dwarf_get_arange.3121
-rw-r--r--libdwarf/dwarf_get_arange_info.3134
-rw-r--r--libdwarf/dwarf_get_aranges.3148
-rw-r--r--libdwarf/dwarf_get_cie_index.386
-rw-r--r--libdwarf/dwarf_get_cie_info.3150
-rw-r--r--libdwarf/dwarf_get_cie_of_fde.388
-rw-r--r--libdwarf/dwarf_get_cu_die_offset.3103
-rw-r--r--libdwarf/dwarf_get_elf.3103
-rw-r--r--libdwarf/dwarf_get_fde_at_pc.3125
-rw-r--r--libdwarf/dwarf_get_fde_info_for_all_regs.3155
-rw-r--r--libdwarf/dwarf_get_fde_info_for_all_regs3.3183
-rw-r--r--libdwarf/dwarf_get_fde_info_for_cfa_reg3.3171
-rw-r--r--libdwarf/dwarf_get_fde_info_for_reg.3156
-rw-r--r--libdwarf/dwarf_get_fde_info_for_reg3.3214
-rw-r--r--libdwarf/dwarf_get_fde_instr_bytes.3113
-rw-r--r--libdwarf/dwarf_get_fde_list.3218
-rw-r--r--libdwarf/dwarf_get_fde_n.3111
-rw-r--r--libdwarf/dwarf_get_fde_range.3149
-rw-r--r--libdwarf/dwarf_get_form_class.387
-rw-r--r--libdwarf/dwarf_get_funcs.3215
-rw-r--r--libdwarf/dwarf_get_globals.3211
-rw-r--r--libdwarf/dwarf_get_loclist_entry.3156
-rw-r--r--libdwarf/dwarf_get_macro_details.3192
-rw-r--r--libdwarf/dwarf_get_pubtypes.3243
-rw-r--r--libdwarf/dwarf_get_ranges.3258
-rw-r--r--libdwarf/dwarf_get_relocation_info.3228
-rw-r--r--libdwarf/dwarf_get_relocation_info_count.3116
-rw-r--r--libdwarf/dwarf_get_section_bytes.3157
-rw-r--r--libdwarf/dwarf_get_str.3149
-rw-r--r--libdwarf/dwarf_get_types.3232
-rw-r--r--libdwarf/dwarf_get_vars.3210
-rw-r--r--libdwarf/dwarf_get_weaks.3215
-rw-r--r--libdwarf/dwarf_hasattr.391
-rw-r--r--libdwarf/dwarf_hasform.3127
-rw-r--r--libdwarf/dwarf_highpc.3162
-rw-r--r--libdwarf/dwarf_init.3178
-rw-r--r--libdwarf/dwarf_init.c163
-rw-r--r--libdwarf/dwarf_lineno.3202
-rw-r--r--libdwarf/dwarf_lineno.c294
-rw-r--r--libdwarf/dwarf_lne_end_sequence.3100
-rw-r--r--libdwarf/dwarf_lne_set_address.3105
-rw-r--r--libdwarf/dwarf_loclist.3230
-rw-r--r--libdwarf/dwarf_loclist.c262
-rw-r--r--libdwarf/dwarf_loclist_from_expr.3173
-rw-r--r--libdwarf/dwarf_macinfo.c88
-rw-r--r--libdwarf/dwarf_nametbl.m4159
-rw-r--r--libdwarf/dwarf_new_die.3164
-rw-r--r--libdwarf/dwarf_new_expr.3135
-rw-r--r--libdwarf/dwarf_new_fde.387
-rw-r--r--libdwarf/dwarf_next_cu_header.3203
-rw-r--r--libdwarf/dwarf_object_init.3227
-rw-r--r--libdwarf/dwarf_pro_arange.c73
-rw-r--r--libdwarf/dwarf_pro_attr.c384
-rw-r--r--libdwarf/dwarf_pro_die.c110
-rw-r--r--libdwarf/dwarf_pro_expr.c223
-rw-r--r--libdwarf/dwarf_pro_finish.c45
-rw-r--r--libdwarf/dwarf_pro_frame.c195
-rw-r--r--libdwarf/dwarf_pro_funcs.m436
-rw-r--r--libdwarf/dwarf_pro_init.c122
-rw-r--r--libdwarf/dwarf_pro_lineno.c187
-rw-r--r--libdwarf/dwarf_pro_macinfo.c142
-rw-r--r--libdwarf/dwarf_pro_nametbl.m470
-rw-r--r--libdwarf/dwarf_pro_pubnames.m436
-rw-r--r--libdwarf/dwarf_pro_reloc.c114
-rw-r--r--libdwarf/dwarf_pro_sections.c81
-rw-r--r--libdwarf/dwarf_pro_types.m436
-rw-r--r--libdwarf/dwarf_pro_vars.m436
-rw-r--r--libdwarf/dwarf_pro_weaks.m436
-rw-r--r--libdwarf/dwarf_producer_init.3297
-rw-r--r--libdwarf/dwarf_producer_set_isa.398
-rw-r--r--libdwarf/dwarf_pubnames.m436
-rw-r--r--libdwarf/dwarf_pubtypes.m436
-rw-r--r--libdwarf/dwarf_ranges.c87
-rw-r--r--libdwarf/dwarf_reloc.c40
-rw-r--r--libdwarf/dwarf_reset_section_bytes.369
-rw-r--r--libdwarf/dwarf_set_frame_cfa_value.3140
-rw-r--r--libdwarf/dwarf_set_reloc_application.380
-rw-r--r--libdwarf/dwarf_seterrarg.3102
-rw-r--r--libdwarf/dwarf_seterror.c63
-rw-r--r--libdwarf/dwarf_srcfiles.3105
-rw-r--r--libdwarf/dwarf_srclines.3163
-rw-r--r--libdwarf/dwarf_start_macro_file.3106
-rw-r--r--libdwarf/dwarf_str.c62
-rw-r--r--libdwarf/dwarf_tag.377
-rw-r--r--libdwarf/dwarf_transform_to_disk_form.399
-rw-r--r--libdwarf/dwarf_types.m436
-rw-r--r--libdwarf/dwarf_undef_macro.3119
-rw-r--r--libdwarf/dwarf_vars.m436
-rw-r--r--libdwarf/dwarf_vendor_ext.3110
-rw-r--r--libdwarf/dwarf_weaks.m436
-rw-r--r--libdwarf/dwarf_whatattr.378
-rw-r--r--libdwarf/libdwarf.c35
-rw-r--r--libdwarf/libdwarf.h808
-rw-r--r--libdwarf/libdwarf_abbrev.c266
-rw-r--r--libdwarf/libdwarf_arange.c260
-rw-r--r--libdwarf/libdwarf_attr.c458
-rw-r--r--libdwarf/libdwarf_die.c455
-rw-r--r--libdwarf/libdwarf_elf_access.c164
-rw-r--r--libdwarf/libdwarf_elf_init.c334
-rw-r--r--libdwarf/libdwarf_error.c58
-rw-r--r--libdwarf/libdwarf_frame.c1593
-rw-r--r--libdwarf/libdwarf_info.c281
-rw-r--r--libdwarf/libdwarf_init.c316
-rw-r--r--libdwarf/libdwarf_lineno.c785
-rw-r--r--libdwarf/libdwarf_loc.c641
-rw-r--r--libdwarf/libdwarf_loclist.c224
-rw-r--r--libdwarf/libdwarf_macinfo.c254
-rw-r--r--libdwarf/libdwarf_nametbl.c253
-rw-r--r--libdwarf/libdwarf_ranges.c152
-rw-r--r--libdwarf/libdwarf_reloc.c476
-rw-r--r--libdwarf/libdwarf_rw.c562
-rw-r--r--libdwarf/libdwarf_sections.c259
-rw-r--r--libdwarf/libdwarf_str.c159
-rw-r--r--libelf/Makefile165
-rw-r--r--libelf/Version.map96
-rw-r--r--libelf/_libelf.h225
-rw-r--r--libelf/_libelf_ar.h56
-rw-r--r--libelf/_libelf_config.h177
-rw-r--r--libelf/elf.3589
-rw-r--r--libelf/elf.c40
-rw-r--r--libelf/elf_begin.3315
-rw-r--r--libelf/elf_begin.c91
-rw-r--r--libelf/elf_cntl.3111
-rw-r--r--libelf/elf_cntl.c58
-rw-r--r--libelf/elf_data.c256
-rw-r--r--libelf/elf_end.376
-rw-r--r--libelf/elf_end.c97
-rw-r--r--libelf/elf_errmsg.3107
-rw-r--r--libelf/elf_errmsg.c85
-rw-r--r--libelf/elf_errno.c43
-rw-r--r--libelf/elf_fill.352
-rw-r--r--libelf/elf_fill.c39
-rw-r--r--libelf/elf_flag.c198
-rw-r--r--libelf/elf_flagdata.3226
-rw-r--r--libelf/elf_getarhdr.397
-rw-r--r--libelf/elf_getarhdr.c47
-rw-r--r--libelf/elf_getarsym.3130
-rw-r--r--libelf/elf_getarsym.c58
-rw-r--r--libelf/elf_getbase.371
-rw-r--r--libelf/elf_getbase.c48
-rw-r--r--libelf/elf_getdata.3229
-rw-r--r--libelf/elf_getident.383
-rw-r--r--libelf/elf_getident.c68
-rw-r--r--libelf/elf_getphdrnum.386
-rw-r--r--libelf/elf_getphnum.393
-rw-r--r--libelf/elf_getscn.3151
-rw-r--r--libelf/elf_getshdrnum.378
-rw-r--r--libelf/elf_getshdrstrndx.379
-rw-r--r--libelf/elf_getshnum.384
-rw-r--r--libelf/elf_getshstrndx.394
-rw-r--r--libelf/elf_hash.357
-rw-r--r--libelf/elf_hash.c56
-rw-r--r--libelf/elf_kind.371
-rw-r--r--libelf/elf_kind.c44
-rw-r--r--libelf/elf_memory.3122
-rw-r--r--libelf/elf_memory.c47
-rw-r--r--libelf/elf_next.396
-rw-r--r--libelf/elf_next.c62
-rw-r--r--libelf/elf_open.3121
-rw-r--r--libelf/elf_open.c67
-rw-r--r--libelf/elf_phnum.c67
-rw-r--r--libelf/elf_rand.3118
-rw-r--r--libelf/elf_rand.c59
-rw-r--r--libelf/elf_rawfile.376
-rw-r--r--libelf/elf_rawfile.c53
-rw-r--r--libelf/elf_scn.c232
-rw-r--r--libelf/elf_shnum.c67
-rw-r--r--libelf/elf_shstrndx.c82
-rw-r--r--libelf/elf_strptr.3116
-rw-r--r--libelf/elf_strptr.c132
-rw-r--r--libelf/elf_types.m4309
-rw-r--r--libelf/elf_update.3378
-rw-r--r--libelf/elf_update.c1202
-rw-r--r--libelf/elf_version.395
-rw-r--r--libelf/elf_version.c52
-rw-r--r--libelf/gelf.3201
-rw-r--r--libelf/gelf.h108
-rw-r--r--libelf/gelf_cap.c151
-rw-r--r--libelf/gelf_checksum.3115
-rw-r--r--libelf/gelf_checksum.c58
-rw-r--r--libelf/gelf_dyn.c150
-rw-r--r--libelf/gelf_ehdr.c168
-rw-r--r--libelf/gelf_fsize.396
-rw-r--r--libelf/gelf_fsize.c62
-rw-r--r--libelf/gelf_getcap.3121
-rw-r--r--libelf/gelf_getclass.361
-rw-r--r--libelf/gelf_getclass.c39
-rw-r--r--libelf/gelf_getdyn.3123
-rw-r--r--libelf/gelf_getehdr.3123
-rw-r--r--libelf/gelf_getmove.3120
-rw-r--r--libelf/gelf_getphdr.3141
-rw-r--r--libelf/gelf_getrel.3121
-rw-r--r--libelf/gelf_getrela.3121
-rw-r--r--libelf/gelf_getshdr.3115
-rw-r--r--libelf/gelf_getsym.3125
-rw-r--r--libelf/gelf_getsyminfo.3115
-rw-r--r--libelf/gelf_getsymshndx.3162
-rw-r--r--libelf/gelf_move.c157
-rw-r--r--libelf/gelf_newehdr.3185
-rw-r--r--libelf/gelf_newphdr.3133
-rw-r--r--libelf/gelf_phdr.c178
-rw-r--r--libelf/gelf_rel.c159
-rw-r--r--libelf/gelf_rela.c162
-rw-r--r--libelf/gelf_shdr.c131
-rw-r--r--libelf/gelf_sym.c160
-rw-r--r--libelf/gelf_syminfo.c151
-rw-r--r--libelf/gelf_symshndx.c136
-rw-r--r--libelf/gelf_update_ehdr.3123
-rw-r--r--libelf/gelf_xlate.c81
-rw-r--r--libelf/gelf_xlatetof.3247
-rw-r--r--libelf/libelf.h252
-rw-r--r--libelf/libelf_align.c137
-rw-r--r--libelf/libelf_allocate.c212
-rw-r--r--libelf/libelf_ar.c461
-rw-r--r--libelf/libelf_ar_util.c359
-rw-r--r--libelf/libelf_checksum.c100
-rw-r--r--libelf/libelf_convert.m41086
-rw-r--r--libelf/libelf_data.c88
-rw-r--r--libelf/libelf_ehdr.c204
-rw-r--r--libelf/libelf_extended.c136
-rw-r--r--libelf/libelf_fsize.m4159
-rw-r--r--libelf/libelf_memory.c96
-rw-r--r--libelf/libelf_msize.m4108
-rw-r--r--libelf/libelf_open.c249
-rw-r--r--libelf/libelf_phdr.c154
-rw-r--r--libelf/libelf_shdr.c56
-rw-r--r--libelf/libelf_xlate.c150
-rw-r--r--libelf/os.FreeBSD.mk7
-rw-r--r--libelf/os.NetBSD.mk7
-rw-r--r--libelftc/Makefile65
-rw-r--r--libelftc/Version.map18
-rw-r--r--libelftc/_libelftc.h89
-rw-r--r--libelftc/elftc.383
-rw-r--r--libelftc/elftc_bfd_find_target.3189
-rw-r--r--libelftc/elftc_bfdtarget.c75
-rw-r--r--libelftc/elftc_copyfile.373
-rw-r--r--libelftc/elftc_copyfile.c107
-rw-r--r--libelftc/elftc_demangle.3116
-rw-r--r--libelftc/elftc_demangle.c110
-rw-r--r--libelftc/elftc_set_timestamps.384
-rw-r--r--libelftc/elftc_set_timestamps.c85
-rw-r--r--libelftc/elftc_string_table.c392
-rw-r--r--libelftc/elftc_string_table_create.3227
-rw-r--r--libelftc/elftc_symbol_table_create.3529
-rw-r--r--libelftc/elftc_version.379
-rw-r--r--libelftc/libelftc.h89
-rw-r--r--libelftc/libelftc_bfdtarget.c383
-rw-r--r--libelftc/libelftc_dem_arm.c1227
-rw-r--r--libelftc/libelftc_dem_gnu2.c1376
-rw-r--r--libelftc/libelftc_dem_gnu3.c3238
-rw-r--r--libelftc/libelftc_hash.c70
-rw-r--r--libelftc/libelftc_vstr.c318
-rwxr-xr-xlibelftc/make-toolchain-version104
-rw-r--r--libelftc/os.FreeBSD.mk7
-rw-r--r--libelftc/os.Linux.mk3
-rw-r--r--mk/elftoolchain.inc.mk36
-rw-r--r--mk/elftoolchain.lib.mk61
-rw-r--r--mk/elftoolchain.m4.mk14
-rw-r--r--mk/elftoolchain.os.mk22
-rw-r--r--mk/elftoolchain.prog.mk86
-rw-r--r--mk/elftoolchain.subdir.mk19
-rw-r--r--mk/elftoolchain.test.mk14
-rw-r--r--mk/elftoolchain.tet.mk67
-rw-r--r--mk/elftoolchain.tetvars.mk22
-rw-r--r--mk/elftoolchain.tex.mk98
-rw-r--r--mk/os.DragonFly.mk9
-rw-r--r--mk/os.FreeBSD.mk27
-rw-r--r--mk/os.Linux.mk21
-rw-r--r--mk/os.Minix.mk16
-rw-r--r--mk/os.NetBSD.mk13
-rw-r--r--mk/os.OpenBSD.mk9
-rw-r--r--nm/Makefile13
-rw-r--r--nm/nm.1334
-rw-r--r--nm/nm.c2096
-rw-r--r--readelf/Makefile15
-rw-r--r--readelf/readelf.1197
-rw-r--r--readelf/readelf.c6845
-rw-r--r--size/Makefile11
-rw-r--r--size/size.1257
-rw-r--r--size/size.c914
-rw-r--r--strings/Makefile11
-rw-r--r--strings/strings.1162
-rw-r--r--strings/strings.c454
-rw-r--r--test/Makefile27
-rw-r--r--test/ar/Makefile20
-rw-r--r--test/ar/README15
-rwxr-xr-xtest/ar/func.sh219
-rw-r--r--test/ar/plugin/Makefile15
-rw-r--r--test/ar/plugin/Makefile.ardiff16
-rw-r--r--test/ar/plugin/Makefile.teraser11
-rw-r--r--test/ar/plugin/ardiff.c254
-rw-r--r--test/ar/plugin/teraser.c145
-rwxr-xr-xtest/ar/run.sh28
-rw-r--r--test/ar/tc/addself-liba/addself-liba.err1
-rw-r--r--test/ar/tc/addself-liba/addself-liba.eval1
-rw-r--r--test/ar/tc/addself-liba/addself-liba.out0
-rwxr-xr-xtest/ar/tc/addself-liba/addself-liba.sh8
-rw-r--r--test/ar/tc/addself-liba/in/addself-liba.in.shar98
-rw-r--r--test/ar/tc/addself-liba/out/addself-liba.out.shar98
-rw-r--r--test/ar/tc/archive-liba-v/archive-liba-v.err0
-rw-r--r--test/ar/tc/archive-liba-v/archive-liba-v.eval1
-rw-r--r--test/ar/tc/archive-liba-v/archive-liba-v.out4
-rwxr-xr-xtest/ar/tc/archive-liba-v/archive-liba-v.sh8
-rw-r--r--test/ar/tc/archive-liba-v/in/archive-liba-v.in.shar111
-rw-r--r--test/ar/tc/archive-liba-v/out/archive-liba-v.out.shar199
-rw-r--r--test/ar/tc/archive-liba/archive-liba.err0
-rw-r--r--test/ar/tc/archive-liba/archive-liba.eval1
-rw-r--r--test/ar/tc/archive-liba/archive-liba.out0
-rwxr-xr-xtest/ar/tc/archive-liba/archive-liba.sh8
-rw-r--r--test/ar/tc/archive-liba/in/archive-liba.in.shar111
-rw-r--r--test/ar/tc/archive-liba/out/archive-liba.out.shar199
-rw-r--r--test/ar/tc/archive-liblong/archive-liblong.err0
-rw-r--r--test/ar/tc/archive-liblong/archive-liblong.eval1
-rw-r--r--test/ar/tc/archive-liblong/archive-liblong.out4
-rwxr-xr-xtest/ar/tc/archive-liblong/archive-liblong.sh8
-rw-r--r--test/ar/tc/archive-liblong/in/archive-liblong.in.shar111
-rw-r--r--test/ar/tc/archive-liblong/out/archive-liblong.out.shar201
-rw-r--r--test/ar/tc/archive-libmix-v/archive-libmix-v.err0
-rw-r--r--test/ar/tc/archive-libmix-v/archive-libmix-v.eval1
-rw-r--r--test/ar/tc/archive-libmix-v/archive-libmix-v.out4
-rwxr-xr-xtest/ar/tc/archive-libmix-v/archive-libmix-v.sh8
-rw-r--r--test/ar/tc/archive-libmix-v/in/archive-libmix-v.in.shar77
-rw-r--r--test/ar/tc/archive-libmix-v/out/archive-libmix-v.out.shar133
-rw-r--r--test/ar/tc/archive-libnonelf-v/archive-libnonelf-v.err0
-rw-r--r--test/ar/tc/archive-libnonelf-v/archive-libnonelf-v.eval1
-rw-r--r--test/ar/tc/archive-libnonelf-v/archive-libnonelf-v.out3
-rwxr-xr-xtest/ar/tc/archive-libnonelf-v/archive-libnonelf-v.sh7
-rw-r--r--test/ar/tc/archive-libnonelf-v/in/archive-libnonelf-v.in.shar36
-rw-r--r--test/ar/tc/archive-libnonelf-v/out/archive-libnonelf-v.out.shar53
-rw-r--r--test/ar/tc/arscript-1/arscript-1.err0
-rw-r--r--test/ar/tc/arscript-1/arscript-1.eval1
-rw-r--r--test/ar/tc/arscript-1/arscript-1.out0
-rwxr-xr-xtest/ar/tc/arscript-1/arscript-1.sh8
-rw-r--r--test/ar/tc/arscript-1/in/arscript-1.in.shar492
-rw-r--r--test/ar/tc/arscript-1/out/arscript-1.out.shar971
-rw-r--r--test/ar/tc/arscript-2/arscript-2.err0
-rw-r--r--test/ar/tc/arscript-2/arscript-2.eval1
-rw-r--r--test/ar/tc/arscript-2/arscript-2.out0
-rwxr-xr-xtest/ar/tc/arscript-2/arscript-2.sh8
-rw-r--r--test/ar/tc/arscript-2/in/arscript-2.in.shar429
-rw-r--r--test/ar/tc/arscript-2/out/arscript-2.out.shar825
-rw-r--r--test/ar/tc/arscript-3/arscript-3.err0
-rw-r--r--test/ar/tc/arscript-3/arscript-3.eval1
-rw-r--r--test/ar/tc/arscript-3/arscript-3.out0
-rwxr-xr-xtest/ar/tc/arscript-3/arscript-3.sh8
-rw-r--r--test/ar/tc/arscript-3/in/arscript-3.in.shar4013
-rw-r--r--test/ar/tc/arscript-3/out/arscript-3.out.shar7940
-rw-r--r--test/ar/tc/arscript-4/arscript-4.err0
-rw-r--r--test/ar/tc/arscript-4/arscript-4.eval1
-rw-r--r--test/ar/tc/arscript-4/arscript-4.out10
-rwxr-xr-xtest/ar/tc/arscript-4/arscript-4.sh6
-rw-r--r--test/ar/tc/arscript-4/in/arscript-4.in.shar123
-rw-r--r--test/ar/tc/arscript-4/out/arscript-4.out.shar209
-rw-r--r--test/ar/tc/arscript-5/arscript-5.err0
-rw-r--r--test/ar/tc/arscript-5/arscript-5.eval1
-rw-r--r--test/ar/tc/arscript-5/arscript-5.out0
-rwxr-xr-xtest/ar/tc/arscript-5/arscript-5.sh10
-rw-r--r--test/ar/tc/arscript-5/in/arscript-5.in.shar121
-rw-r--r--test/ar/tc/arscript-5/out/arscript-5.out.shar160
-rw-r--r--test/ar/tc/arscript-6/arscript-6.err0
-rw-r--r--test/ar/tc/arscript-6/arscript-6.eval1
-rw-r--r--test/ar/tc/arscript-6/arscript-6.out0
-rwxr-xr-xtest/ar/tc/arscript-6/arscript-6.sh10
-rw-r--r--test/ar/tc/arscript-6/in/arscript-6.in.shar211
-rw-r--r--test/ar/tc/arscript-6/out/arscript-6.out.shar350
-rw-r--r--test/ar/tc/arscript-7/arscript-7.err0
-rw-r--r--test/ar/tc/arscript-7/arscript-7.eval1
-rw-r--r--test/ar/tc/arscript-7/arscript-7.out0
-rwxr-xr-xtest/ar/tc/arscript-7/arscript-7.sh10
-rw-r--r--test/ar/tc/arscript-7/in/arscript-7.in.shar215
-rw-r--r--test/ar/tc/arscript-7/out/arscript-7.out.shar277
-rw-r--r--test/ar/tc/arscript-8/arscript-8.err0
-rw-r--r--test/ar/tc/arscript-8/arscript-8.eval1
-rw-r--r--test/ar/tc/arscript-8/arscript-8.out0
-rwxr-xr-xtest/ar/tc/arscript-8/arscript-8.sh8
-rw-r--r--test/ar/tc/arscript-8/in/arscript-8.in.shar248
-rw-r--r--test/ar/tc/arscript-8/out/arscript-8.out.shar329
-rw-r--r--test/ar/tc/bsd-archive-liba32/bsd-archive-liba32.err0
-rw-r--r--test/ar/tc/bsd-archive-liba32/bsd-archive-liba32.eval1
-rw-r--r--test/ar/tc/bsd-archive-liba32/bsd-archive-liba32.out0
-rwxr-xr-xtest/ar/tc/bsd-archive-liba32/bsd-archive-liba32.sh10
-rw-r--r--test/ar/tc/bsd-archive-liba32/in/bsd-archive-liba32.in.shar114
-rw-r--r--test/ar/tc/bsd-archive-liba32/out/bsd-archive-liba32.out.shar203
-rw-r--r--test/ar/tc/bsd-archive-liblong/bsd-archive-liblong.err0
-rw-r--r--test/ar/tc/bsd-archive-liblong/bsd-archive-liblong.eval1
-rw-r--r--test/ar/tc/bsd-archive-liblong/bsd-archive-liblong.out0
-rwxr-xr-xtest/ar/tc/bsd-archive-liblong/bsd-archive-liblong.sh8
-rw-r--r--test/ar/tc/bsd-archive-liblong/in/bsd-archive-liblong.in.shar46
-rw-r--r--test/ar/tc/bsd-archive-liblong/out/bsd-archive-liblong.out.shar62
-rw-r--r--test/ar/tc/bsd-archive-libnonelf/bsd-archive-libnonelf.err0
-rw-r--r--test/ar/tc/bsd-archive-libnonelf/bsd-archive-libnonelf.eval1
-rw-r--r--test/ar/tc/bsd-archive-libnonelf/bsd-archive-libnonelf.out0
-rwxr-xr-xtest/ar/tc/bsd-archive-libnonelf/bsd-archive-libnonelf.sh8
-rw-r--r--test/ar/tc/bsd-archive-libnonelf/in/bsd-archive-libnonelf.in.shar46
-rw-r--r--test/ar/tc/bsd-archive-libnonelf/out/bsd-archive-libnonelf.out.shar61
-rw-r--r--test/ar/tc/bsd-extract-liba32-v/bsd-extract-liba32-v.err0
-rw-r--r--test/ar/tc/bsd-extract-liba32-v/bsd-extract-liba32-v.eval1
-rw-r--r--test/ar/tc/bsd-extract-liba32-v/bsd-extract-liba32-v.out4
-rwxr-xr-xtest/ar/tc/bsd-extract-liba32-v/bsd-extract-liba32-v.sh6
-rw-r--r--test/ar/tc/bsd-extract-liba32-v/in/bsd-extract-liba32-v.in.shar102
-rw-r--r--test/ar/tc/bsd-extract-liba32-v/out/bsd-extract-liba32-v.out.shar203
-rw-r--r--test/ar/tc/bsd-extract-liblong-v/bsd-extract-liblong-v.err0
-rw-r--r--test/ar/tc/bsd-extract-liblong-v/bsd-extract-liblong-v.eval1
-rw-r--r--test/ar/tc/bsd-extract-liblong-v/bsd-extract-liblong-v.out4
-rwxr-xr-xtest/ar/tc/bsd-extract-liblong-v/bsd-extract-liblong-v.sh6
-rw-r--r--test/ar/tc/bsd-extract-liblong-v/in/bsd-extract-liblong-v.in.shar29
-rw-r--r--test/ar/tc/bsd-extract-liblong-v/out/bsd-extract-liblong-v.out.shar62
-rw-r--r--test/ar/tc/compbase-liba-v/compbase-liba-v.err0
-rw-r--r--test/ar/tc/compbase-liba-v/compbase-liba-v.eval1
-rw-r--r--test/ar/tc/compbase-liba-v/compbase-liba-v.out1
-rwxr-xr-xtest/ar/tc/compbase-liba-v/compbase-liba-v.sh8
-rw-r--r--test/ar/tc/compbase-liba-v/in/compbase-liba-v.in.shar98
-rw-r--r--test/ar/tc/compbase-liba-v/out/compbase-liba-v.out.shar98
-rw-r--r--test/ar/tc/compbase_read-liba/compbase_read-liba.err0
-rw-r--r--test/ar/tc/compbase_read-liba/compbase_read-liba.eval1
-rw-r--r--test/ar/tc/compbase_read-liba/compbase_read-liba.out1
-rwxr-xr-xtest/ar/tc/compbase_read-liba/compbase_read-liba.sh6
-rw-r--r--test/ar/tc/compbase_read-liba/in/compbase_read-liba.in.shar98
-rw-r--r--test/ar/tc/compbase_read-liba/out/compbase_read-liba.out.shar98
-rw-r--r--test/ar/tc/delete-liba-v/delete-liba-v.err0
-rw-r--r--test/ar/tc/delete-liba-v/delete-liba-v.eval1
-rw-r--r--test/ar/tc/delete-liba-v/delete-liba-v.out2
-rwxr-xr-xtest/ar/tc/delete-liba-v/delete-liba-v.sh8
-rw-r--r--test/ar/tc/delete-liba-v/in/delete-liba-v.in.shar98
-rw-r--r--test/ar/tc/delete-liba-v/out/delete-liba-v.out.shar61
-rw-r--r--test/ar/tc/delete-liblong/delete-liblong.err0
-rw-r--r--test/ar/tc/delete-liblong/delete-liblong.eval1
-rw-r--r--test/ar/tc/delete-liblong/delete-liblong.out0
-rwxr-xr-xtest/ar/tc/delete-liblong/delete-liblong.sh8
-rw-r--r--test/ar/tc/delete-liblong/in/delete-liblong.in.shar100
-rw-r--r--test/ar/tc/delete-liblong/out/delete-liblong.out.shar58
-rw-r--r--test/ar/tc/delete-libmix-v/delete-libmix-v.err0
-rw-r--r--test/ar/tc/delete-libmix-v/delete-libmix-v.eval1
-rw-r--r--test/ar/tc/delete-libmix-v/delete-libmix-v.out1
-rwxr-xr-xtest/ar/tc/delete-libmix-v/delete-libmix-v.sh8
-rw-r--r--test/ar/tc/delete-libmix-v/in/delete-libmix-v.in.shar66
-rw-r--r--test/ar/tc/delete-libmix-v/out/delete-libmix-v.out.shar64
-rw-r--r--test/ar/tc/delete_all-liba-v/delete_all-liba-v.err0
-rw-r--r--test/ar/tc/delete_all-liba-v/delete_all-liba-v.eval1
-rw-r--r--test/ar/tc/delete_all-liba-v/delete_all-liba-v.out4
-rwxr-xr-xtest/ar/tc/delete_all-liba-v/delete_all-liba-v.sh6
-rw-r--r--test/ar/tc/delete_all-liba-v/in/delete_all-liba-v.in.shar98
-rw-r--r--test/ar/tc/delete_all-liba-v/out/delete_all-liba-v.out.shar18
-rw-r--r--test/ar/tc/extract-liba-v/extract-liba-v.err0
-rw-r--r--test/ar/tc/extract-liba-v/extract-liba-v.eval1
-rw-r--r--test/ar/tc/extract-liba-v/extract-liba-v.out4
-rwxr-xr-xtest/ar/tc/extract-liba-v/extract-liba-v.sh6
-rw-r--r--test/ar/tc/extract-liba-v/in/extract-liba-v.in.shar98
-rw-r--r--test/ar/tc/extract-liba-v/out/extract-liba-v.out.shar199
-rw-r--r--test/ar/tc/extract-liba/extract-liba.err0
-rw-r--r--test/ar/tc/extract-liba/extract-liba.eval1
-rw-r--r--test/ar/tc/extract-liba/extract-liba.out0
-rwxr-xr-xtest/ar/tc/extract-liba/extract-liba.sh6
-rw-r--r--test/ar/tc/extract-liba/in/extract-liba.in.shar98
-rw-r--r--test/ar/tc/extract-liba/out/extract-liba.out.shar199
-rw-r--r--test/ar/tc/extract-liblong/extract-liblong.err0
-rw-r--r--test/ar/tc/extract-liblong/extract-liblong.eval1
-rw-r--r--test/ar/tc/extract-liblong/extract-liblong.out0
-rwxr-xr-xtest/ar/tc/extract-liblong/extract-liblong.sh6
-rw-r--r--test/ar/tc/extract-liblong/in/extract-liblong.in.shar100
-rw-r--r--test/ar/tc/extract-liblong/out/extract-liblong.out.shar201
-rw-r--r--test/ar/tc/extract-libmix-v/extract-libmix-v.err0
-rw-r--r--test/ar/tc/extract-libmix-v/extract-libmix-v.eval1
-rw-r--r--test/ar/tc/extract-libmix-v/extract-libmix-v.out4
-rwxr-xr-xtest/ar/tc/extract-libmix-v/extract-libmix-v.sh6
-rw-r--r--test/ar/tc/extract-libmix-v/in/extract-libmix-v.in.shar66
-rw-r--r--test/ar/tc/extract-libmix-v/out/extract-libmix-v.out.shar133
-rw-r--r--test/ar/tc/extract-libnonelf-v/extract-libnonelf-v.err0
-rw-r--r--test/ar/tc/extract-libnonelf-v/extract-libnonelf-v.eval1
-rw-r--r--test/ar/tc/extract-libnonelf-v/extract-libnonelf-v.out3
-rwxr-xr-xtest/ar/tc/extract-libnonelf-v/extract-libnonelf-v.sh6
-rw-r--r--test/ar/tc/extract-libnonelf-v/in/extract-libnonelf-v.in.shar27
-rw-r--r--test/ar/tc/extract-libnonelf-v/out/extract-libnonelf-v.out.shar53
-rw-r--r--test/ar/tc/list-lib65536/in/list-lib65536.in.shar2669
-rw-r--r--test/ar/tc/list-lib65536/list-lib65536.err0
-rw-r--r--test/ar/tc/list-lib65536/list-lib65536.eval1
-rw-r--r--test/ar/tc/list-lib65536/list-lib65536.out746
-rwxr-xr-xtest/ar/tc/list-lib65536/list-lib65536.sh6
-rw-r--r--test/ar/tc/list-lib65536/out/list-lib65536.out.shar2669
-rw-r--r--test/ar/tc/list-liblong/in/list-liblong.in.shar100
-rw-r--r--test/ar/tc/list-liblong/list-liblong.err0
-rw-r--r--test/ar/tc/list-liblong/list-liblong.eval1
-rw-r--r--test/ar/tc/list-liblong/list-liblong.out4
-rwxr-xr-xtest/ar/tc/list-liblong/list-liblong.sh6
-rw-r--r--test/ar/tc/list-liblong/out/list-liblong.out.shar100
-rw-r--r--test/ar/tc/list_s-libaS/in/list_s-libaS.in.shar94
-rw-r--r--test/ar/tc/list_s-libaS/list_s-libaS.err0
-rw-r--r--test/ar/tc/list_s-libaS/list_s-libaS.eval1
-rw-r--r--test/ar/tc/list_s-libaS/list_s-libaS.out4
-rwxr-xr-xtest/ar/tc/list_s-libaS/list_s-libaS.sh8
-rw-r--r--test/ar/tc/list_s-libaS/out/list_s-libaS.out.shar98
-rw-r--r--test/ar/tc/moveafter-liba-v/in/moveafter-liba-v.in.shar98
-rw-r--r--test/ar/tc/moveafter-liba-v/moveafter-liba-v.err0
-rw-r--r--test/ar/tc/moveafter-liba-v/moveafter-liba-v.eval1
-rw-r--r--test/ar/tc/moveafter-liba-v/moveafter-liba-v.out2
-rwxr-xr-xtest/ar/tc/moveafter-liba-v/moveafter-liba-v.sh8
-rw-r--r--test/ar/tc/moveafter-liba-v/out/moveafter-liba-v.out.shar98
-rw-r--r--test/ar/tc/moveafter-libmix-v/in/moveafter-libmix-v.in.shar66
-rw-r--r--test/ar/tc/moveafter-libmix-v/moveafter-libmix-v.err0
-rw-r--r--test/ar/tc/moveafter-libmix-v/moveafter-libmix-v.eval1
-rw-r--r--test/ar/tc/moveafter-libmix-v/moveafter-libmix-v.out1
-rwxr-xr-xtest/ar/tc/moveafter-libmix-v/moveafter-libmix-v.sh8
-rw-r--r--test/ar/tc/moveafter-libmix-v/out/moveafter-libmix-v.out.shar66
-rw-r--r--test/ar/tc/moveafter_movepos-liba-v/in/moveafter_movepos-liba-v.in.shar98
-rw-r--r--test/ar/tc/moveafter_movepos-liba-v/moveafter_movepos-liba-v.err0
-rw-r--r--test/ar/tc/moveafter_movepos-liba-v/moveafter_movepos-liba-v.eval1
-rw-r--r--test/ar/tc/moveafter_movepos-liba-v/moveafter_movepos-liba-v.out1
-rwxr-xr-xtest/ar/tc/moveafter_movepos-liba-v/moveafter_movepos-liba-v.sh8
-rw-r--r--test/ar/tc/moveafter_movepos-liba-v/out/moveafter_movepos-liba-v.out.shar98
-rw-r--r--test/ar/tc/movebefore-liba-v/in/movebefore-liba-v.in.shar98
-rw-r--r--test/ar/tc/movebefore-liba-v/movebefore-liba-v.err0
-rw-r--r--test/ar/tc/movebefore-liba-v/movebefore-liba-v.eval1
-rw-r--r--test/ar/tc/movebefore-liba-v/movebefore-liba-v.out2
-rwxr-xr-xtest/ar/tc/movebefore-liba-v/movebefore-liba-v.sh8
-rw-r--r--test/ar/tc/movebefore-liba-v/out/movebefore-liba-v.out.shar98
-rw-r--r--test/ar/tc/movebefore-libmix/in/movebefore-libmix.in.shar66
-rw-r--r--test/ar/tc/movebefore-libmix/movebefore-libmix.err0
-rw-r--r--test/ar/tc/movebefore-libmix/movebefore-libmix.eval1
-rw-r--r--test/ar/tc/movebefore-libmix/movebefore-libmix.out0
-rwxr-xr-xtest/ar/tc/movebefore-libmix/movebefore-libmix.sh8
-rw-r--r--test/ar/tc/movebefore-libmix/out/movebefore-libmix.out.shar66
-rw-r--r--test/ar/tc/movebefore_movepos-liba-v/in/movebefore_movepos-liba-v.in.shar98
-rw-r--r--test/ar/tc/movebefore_movepos-liba-v/movebefore_movepos-liba-v.err0
-rw-r--r--test/ar/tc/movebefore_movepos-liba-v/movebefore_movepos-liba-v.eval1
-rw-r--r--test/ar/tc/movebefore_movepos-liba-v/movebefore_movepos-liba-v.out3
-rwxr-xr-xtest/ar/tc/movebefore_movepos-liba-v/movebefore_movepos-liba-v.sh8
-rw-r--r--test/ar/tc/movebefore_movepos-liba-v/out/movebefore_movepos-liba-v.out.shar98
-rw-r--r--test/ar/tc/movetail-libmix/in/movetail-libmix.in.shar66
-rw-r--r--test/ar/tc/movetail-libmix/movetail-libmix.err0
-rw-r--r--test/ar/tc/movetail-libmix/movetail-libmix.eval1
-rw-r--r--test/ar/tc/movetail-libmix/movetail-libmix.out0
-rwxr-xr-xtest/ar/tc/movetail-libmix/movetail-libmix.sh8
-rw-r--r--test/ar/tc/movetail-libmix/out/movetail-libmix.out.shar66
-rw-r--r--test/ar/tc/optionl-liba/in/optionl-liba.in.shar111
-rw-r--r--test/ar/tc/optionl-liba/optionl-liba.err0
-rw-r--r--test/ar/tc/optionl-liba/optionl-liba.eval1
-rw-r--r--test/ar/tc/optionl-liba/optionl-liba.out0
-rwxr-xr-xtest/ar/tc/optionl-liba/optionl-liba.sh8
-rw-r--r--test/ar/tc/optionl-liba/out/optionl-liba.out.shar199
-rw-r--r--test/ar/tc/print-liblong-v/in/print-liblong-v.in.shar100
-rw-r--r--test/ar/tc/print-liblong-v/out/print-liblong-v.out.shar100
-rw-r--r--test/ar/tc/print-liblong-v/print-liblong-v.err0
-rw-r--r--test/ar/tc/print-liblong-v/print-liblong-v.eval1
-rw-r--r--test/ar/tc/print-liblong-v/print-liblong-v.outbin0 -> 3287 bytes
-rwxr-xr-xtest/ar/tc/print-liblong-v/print-liblong-v.sh6
-rw-r--r--test/ar/tc/print-liblong/in/print-liblong.in.shar100
-rw-r--r--test/ar/tc/print-liblong/out/print-liblong.out.shar100
-rw-r--r--test/ar/tc/print-liblong/print-liblong.err0
-rw-r--r--test/ar/tc/print-liblong/print-liblong.eval1
-rw-r--r--test/ar/tc/print-liblong/print-liblong.outbin0 -> 3200 bytes
-rwxr-xr-xtest/ar/tc/print-liblong/print-liblong.sh6
-rw-r--r--test/ar/tc/print-libmix-v/in/print-libmix-v.in.shar66
-rw-r--r--test/ar/tc/print-libmix-v/out/print-libmix-v.out.shar66
-rw-r--r--test/ar/tc/print-libmix-v/print-libmix-v.err0
-rw-r--r--test/ar/tc/print-libmix-v/print-libmix-v.eval1
-rw-r--r--test/ar/tc/print-libmix-v/print-libmix-v.outbin0 -> 1798 bytes
-rwxr-xr-xtest/ar/tc/print-libmix-v/print-libmix-v.sh6
-rw-r--r--test/ar/tc/print-libmix/in/print-libmix.in.shar66
-rw-r--r--test/ar/tc/print-libmix/out/print-libmix.out.shar66
-rw-r--r--test/ar/tc/print-libmix/print-libmix.err0
-rw-r--r--test/ar/tc/print-libmix/print-libmix.eval1
-rw-r--r--test/ar/tc/print-libmix/print-libmix.outbin0 -> 1691 bytes
-rwxr-xr-xtest/ar/tc/print-libmix/print-libmix.sh6
-rw-r--r--test/ar/tc/quickadd-liba-v/in/quickadd-liba-v.in.shar111
-rw-r--r--test/ar/tc/quickadd-liba-v/out/quickadd-liba-v.out.shar199
-rw-r--r--test/ar/tc/quickadd-liba-v/quickadd-liba-v.err0
-rw-r--r--test/ar/tc/quickadd-liba-v/quickadd-liba-v.eval1
-rw-r--r--test/ar/tc/quickadd-liba-v/quickadd-liba-v.out4
-rwxr-xr-xtest/ar/tc/quickadd-liba-v/quickadd-liba-v.sh8
-rw-r--r--test/ar/tc/undefined-libsbrk/in/undefined-libsbrk.in.shar47
-rw-r--r--test/ar/tc/undefined-libsbrk/out/undefined-libsbrk.out.shar88
-rw-r--r--test/ar/tc/undefined-libsbrk/undefined-libsbrk.err0
-rw-r--r--test/ar/tc/undefined-libsbrk/undefined-libsbrk.eval1
-rw-r--r--test/ar/tc/undefined-libsbrk/undefined-libsbrk.out0
-rwxr-xr-xtest/ar/tc/undefined-libsbrk/undefined-libsbrk.sh8
-rw-r--r--test/ar/tc/usage-ab/usage-ab.err1
-rw-r--r--test/ar/tc/usage-ab/usage-ab.eval1
-rw-r--r--test/ar/tc/usage-ab/usage-ab.out0
-rwxr-xr-xtest/ar/tc/usage-ab/usage-ab.sh4
-rw-r--r--test/ar/tc/usage-bi/usage-bi.err32
-rw-r--r--test/ar/tc/usage-bi/usage-bi.eval1
-rw-r--r--test/ar/tc/usage-bi/usage-bi.out0
-rwxr-xr-xtest/ar/tc/usage-bi/usage-bi.sh4
-rw-r--r--test/ar/tc/usage-tx/usage-tx.err1
-rw-r--r--test/ar/tc/usage-tx/usage-tx.eval1
-rw-r--r--test/ar/tc/usage-tx/usage-tx.out0
-rwxr-xr-xtest/ar/tc/usage-tx/usage-tx.sh4
-rw-r--r--test/ar/tc/weaksymbol-libweak/in/weaksymbol-libweak.in.shar40
-rw-r--r--test/ar/tc/weaksymbol-libweak/out/weaksymbol-libweak.out.shar74
-rw-r--r--test/ar/tc/weaksymbol-libweak/weaksymbol-libweak.err0
-rw-r--r--test/ar/tc/weaksymbol-libweak/weaksymbol-libweak.eval1
-rw-r--r--test/ar/tc/weaksymbol-libweak/weaksymbol-libweak.out0
-rwxr-xr-xtest/ar/tc/weaksymbol-libweak/weaksymbol-libweak.sh8
-rwxr-xr-xtest/ar/tcgen.sh182
-rw-r--r--test/elfcopy/Makefile21
-rwxr-xr-xtest/elfcopy/func.sh210
-rw-r--r--test/elfcopy/plugin/Makefile15
-rw-r--r--test/elfcopy/plugin/Makefile.ardiff16
-rw-r--r--test/elfcopy/plugin/Makefile.teraser11
-rw-r--r--test/elfcopy/plugin/ardiff.c254
-rw-r--r--test/elfcopy/plugin/teraser.c145
-rwxr-xr-xtest/elfcopy/run.sh29
-rw-r--r--test/elfcopy/tc/elfcopy-L-1/elfcopy-L-1.err0
-rw-r--r--test/elfcopy/tc/elfcopy-L-1/elfcopy-L-1.eval1
-rw-r--r--test/elfcopy/tc/elfcopy-L-1/elfcopy-L-1.out0
-rwxr-xr-xtest/elfcopy/tc/elfcopy-L-1/elfcopy-L-1.sh6
-rw-r--r--test/elfcopy/tc/elfcopy-L-1/in/elfcopy-L-1.in.shar34
-rw-r--r--test/elfcopy/tc/elfcopy-L-1/out/elfcopy-L-1.out.shar58
-rw-r--r--test/elfcopy/tc/elfcopy-L-2/elfcopy-L-2.err0
-rw-r--r--test/elfcopy/tc/elfcopy-L-2/elfcopy-L-2.eval1
-rw-r--r--test/elfcopy/tc/elfcopy-L-2/elfcopy-L-2.out0
-rwxr-xr-xtest/elfcopy/tc/elfcopy-L-2/elfcopy-L-2.sh6
-rw-r--r--test/elfcopy/tc/elfcopy-L-2/in/elfcopy-L-2.in.shar170
-rw-r--r--test/elfcopy/tc/elfcopy-L-2/out/elfcopy-L-2.out.shar330
-rw-r--r--test/elfcopy/tc/elfcopy-N-1/elfcopy-N-1.err0
-rw-r--r--test/elfcopy/tc/elfcopy-N-1/elfcopy-N-1.eval1
-rw-r--r--test/elfcopy/tc/elfcopy-N-1/elfcopy-N-1.out0
-rwxr-xr-xtest/elfcopy/tc/elfcopy-N-1/elfcopy-N-1.sh6
-rw-r--r--test/elfcopy/tc/elfcopy-N-1/in/elfcopy-N-1.in.shar34
-rw-r--r--test/elfcopy/tc/elfcopy-N-1/out/elfcopy-N-1.out.shar57
-rw-r--r--test/elfcopy/tc/elfcopy-N-2/elfcopy-N-2.err0
-rw-r--r--test/elfcopy/tc/elfcopy-N-2/elfcopy-N-2.eval1
-rw-r--r--test/elfcopy/tc/elfcopy-N-2/elfcopy-N-2.out0
-rwxr-xr-xtest/elfcopy/tc/elfcopy-N-2/elfcopy-N-2.sh6
-rw-r--r--test/elfcopy/tc/elfcopy-N-2/in/elfcopy-N-2.in.shar34
-rw-r--r--test/elfcopy/tc/elfcopy-N-2/out/elfcopy-N-2.out.shar57
-rw-r--r--test/elfcopy/tc/elfcopy-noops-1/elfcopy-noops-1.err0
-rw-r--r--test/elfcopy/tc/elfcopy-noops-1/elfcopy-noops-1.eval1
-rw-r--r--test/elfcopy/tc/elfcopy-noops-1/elfcopy-noops-1.out0
-rwxr-xr-xtest/elfcopy/tc/elfcopy-noops-1/elfcopy-noops-1.sh6
-rw-r--r--test/elfcopy/tc/elfcopy-noops-1/in/elfcopy-noops-1.in.shar398
-rw-r--r--test/elfcopy/tc/elfcopy-noops-1/out/elfcopy-noops-1.out.shar786
-rw-r--r--test/elfcopy/tc/elfcopy-noops-2/elfcopy-noops-2.err0
-rw-r--r--test/elfcopy/tc/elfcopy-noops-2/elfcopy-noops-2.eval1
-rw-r--r--test/elfcopy/tc/elfcopy-noops-2/elfcopy-noops-2.out0
-rwxr-xr-xtest/elfcopy/tc/elfcopy-noops-2/elfcopy-noops-2.sh6
-rw-r--r--test/elfcopy/tc/elfcopy-noops-2/in/elfcopy-noops-2.in.shar578
-rw-r--r--test/elfcopy/tc/elfcopy-noops-2/out/elfcopy-noops-2.out.shar1146
-rw-r--r--test/elfcopy/tc/elfcopy-noops-3/elfcopy-noops-3.err0
-rw-r--r--test/elfcopy/tc/elfcopy-noops-3/elfcopy-noops-3.eval1
-rw-r--r--test/elfcopy/tc/elfcopy-noops-3/elfcopy-noops-3.out0
-rwxr-xr-xtest/elfcopy/tc/elfcopy-noops-3/elfcopy-noops-3.sh6
-rw-r--r--test/elfcopy/tc/elfcopy-noops-3/in/elfcopy-noops-3.in.shar723
-rw-r--r--test/elfcopy/tc/elfcopy-noops-3/out/elfcopy-noops-3.out.shar1436
-rw-r--r--test/elfcopy/tc/elfcopy-noops-4/elfcopy-noops-4.err0
-rw-r--r--test/elfcopy/tc/elfcopy-noops-4/elfcopy-noops-4.eval1
-rw-r--r--test/elfcopy/tc/elfcopy-noops-4/elfcopy-noops-4.out0
-rwxr-xr-xtest/elfcopy/tc/elfcopy-noops-4/elfcopy-noops-4.sh6
-rw-r--r--test/elfcopy/tc/elfcopy-noops-4/in/elfcopy-noops-4.in.shar6817
-rw-r--r--test/elfcopy/tc/elfcopy-noops-4/out/elfcopy-noops-4.out.shar13624
-rw-r--r--test/elfcopy/tc/elfcopy-noops-5/elfcopy-noops-5.err0
-rw-r--r--test/elfcopy/tc/elfcopy-noops-5/elfcopy-noops-5.eval1
-rw-r--r--test/elfcopy/tc/elfcopy-noops-5/elfcopy-noops-5.out0
-rwxr-xr-xtest/elfcopy/tc/elfcopy-noops-5/elfcopy-noops-5.sh6
-rw-r--r--test/elfcopy/tc/elfcopy-noops-5/in/elfcopy-noops-5.in.shar7116
-rw-r--r--test/elfcopy/tc/elfcopy-noops-5/out/elfcopy-noops-5.out.shar14222
-rw-r--r--test/elfcopy/tc/elfcopy-noops-6/elfcopy-noops-6.err0
-rw-r--r--test/elfcopy/tc/elfcopy-noops-6/elfcopy-noops-6.eval1
-rw-r--r--test/elfcopy/tc/elfcopy-noops-6/elfcopy-noops-6.out0
-rwxr-xr-xtest/elfcopy/tc/elfcopy-noops-6/elfcopy-noops-6.sh6
-rw-r--r--test/elfcopy/tc/elfcopy-noops-6/in/elfcopy-noops-6.in.shar107
-rw-r--r--test/elfcopy/tc/elfcopy-noops-6/out/elfcopy-noops-6.out.shar204
-rw-r--r--test/elfcopy/tc/elfcopy-noops-7/elfcopy-noops-7.err0
-rw-r--r--test/elfcopy/tc/elfcopy-noops-7/elfcopy-noops-7.eval1
-rw-r--r--test/elfcopy/tc/elfcopy-noops-7/elfcopy-noops-7.out0
-rwxr-xr-xtest/elfcopy/tc/elfcopy-noops-7/elfcopy-noops-7.sh6
-rw-r--r--test/elfcopy/tc/elfcopy-noops-7/in/elfcopy-noops-7.in.shar708
-rw-r--r--test/elfcopy/tc/elfcopy-noops-7/out/elfcopy-noops-7.out.shar1406
-rw-r--r--test/elfcopy/tc/elfcopy-noops-archive-1/elfcopy-noops-archive-1.err0
-rw-r--r--test/elfcopy/tc/elfcopy-noops-archive-1/elfcopy-noops-archive-1.eval1
-rw-r--r--test/elfcopy/tc/elfcopy-noops-archive-1/elfcopy-noops-archive-1.out0
-rwxr-xr-xtest/elfcopy/tc/elfcopy-noops-archive-1/elfcopy-noops-archive-1.sh8
-rw-r--r--test/elfcopy/tc/elfcopy-noops-archive-1/in/elfcopy-noops-archive-1.in.shar98
-rw-r--r--test/elfcopy/tc/elfcopy-noops-archive-1/out/elfcopy-noops-archive-1.out.shar186
-rw-r--r--test/elfcopy/tc/elfcopy-noops-archive-2/elfcopy-noops-archive-2.err0
-rw-r--r--test/elfcopy/tc/elfcopy-noops-archive-2/elfcopy-noops-archive-2.eval1
-rw-r--r--test/elfcopy/tc/elfcopy-noops-archive-2/elfcopy-noops-archive-2.out0
-rwxr-xr-xtest/elfcopy/tc/elfcopy-noops-archive-2/elfcopy-noops-archive-2.sh8
-rw-r--r--test/elfcopy/tc/elfcopy-noops-archive-2/in/elfcopy-noops-archive-2.in.shar100
-rw-r--r--test/elfcopy/tc/elfcopy-noops-archive-2/out/elfcopy-noops-archive-2.out.shar190
-rw-r--r--test/elfcopy/tc/elfcopy-rename-1/elfcopy-rename-1.err0
-rw-r--r--test/elfcopy/tc/elfcopy-rename-1/elfcopy-rename-1.eval1
-rw-r--r--test/elfcopy/tc/elfcopy-rename-1/elfcopy-rename-1.out0
-rwxr-xr-xtest/elfcopy/tc/elfcopy-rename-1/elfcopy-rename-1.sh6
-rw-r--r--test/elfcopy/tc/elfcopy-rename-1/in/elfcopy-rename-1.in.shar34
-rw-r--r--test/elfcopy/tc/elfcopy-rename-1/out/elfcopy-rename-1.out.shar34
-rw-r--r--test/elfcopy/tc/elfcopy-to-ihex-1/elfcopy-to-ihex-1.err0
-rw-r--r--test/elfcopy/tc/elfcopy-to-ihex-1/elfcopy-to-ihex-1.eval1
-rw-r--r--test/elfcopy/tc/elfcopy-to-ihex-1/elfcopy-to-ihex-1.out0
-rwxr-xr-xtest/elfcopy/tc/elfcopy-to-ihex-1/elfcopy-to-ihex-1.sh6
-rw-r--r--test/elfcopy/tc/elfcopy-to-ihex-1/in/elfcopy-to-ihex-1.in.shar169
-rw-r--r--test/elfcopy/tc/elfcopy-to-ihex-1/out/elfcopy-to-ihex-1.out.shar299
-rw-r--r--test/elfcopy/tc/elfcopy-to-srec-1/elfcopy-to-srec-1.err0
-rw-r--r--test/elfcopy/tc/elfcopy-to-srec-1/elfcopy-to-srec-1.eval1
-rw-r--r--test/elfcopy/tc/elfcopy-to-srec-1/elfcopy-to-srec-1.out0
-rwxr-xr-xtest/elfcopy/tc/elfcopy-to-srec-1/elfcopy-to-srec-1.sh6
-rw-r--r--test/elfcopy/tc/elfcopy-to-srec-1/in/elfcopy-to-srec-1.in.shar169
-rw-r--r--test/elfcopy/tc/elfcopy-to-srec-1/out/elfcopy-to-srec-1.out.shar301
-rw-r--r--test/elfcopy/tc/elfcopy-to-srec-2/elfcopy-to-srec-2.err0
-rw-r--r--test/elfcopy/tc/elfcopy-to-srec-2/elfcopy-to-srec-2.eval1
-rw-r--r--test/elfcopy/tc/elfcopy-to-srec-2/elfcopy-to-srec-2.out0
-rwxr-xr-xtest/elfcopy/tc/elfcopy-to-srec-2/elfcopy-to-srec-2.sh6
-rw-r--r--test/elfcopy/tc/elfcopy-to-srec-2/in/elfcopy-to-srec-2.in.shar169
-rw-r--r--test/elfcopy/tc/elfcopy-to-srec-2/out/elfcopy-to-srec-2.out.shar306
-rw-r--r--test/elfcopy/tc/elfcopy-to-srec-3/elfcopy-to-srec-3.err0
-rw-r--r--test/elfcopy/tc/elfcopy-to-srec-3/elfcopy-to-srec-3.eval1
-rw-r--r--test/elfcopy/tc/elfcopy-to-srec-3/elfcopy-to-srec-3.out0
-rwxr-xr-xtest/elfcopy/tc/elfcopy-to-srec-3/elfcopy-to-srec-3.sh6
-rw-r--r--test/elfcopy/tc/elfcopy-to-srec-3/in/elfcopy-to-srec-3.in.shar169
-rw-r--r--test/elfcopy/tc/elfcopy-to-srec-3/out/elfcopy-to-srec-3.out.shar279
-rw-r--r--test/elfcopy/tc/elfcopy-to-symbolsrec-1/elfcopy-to-symbolsrec-1.err0
-rw-r--r--test/elfcopy/tc/elfcopy-to-symbolsrec-1/elfcopy-to-symbolsrec-1.eval1
-rw-r--r--test/elfcopy/tc/elfcopy-to-symbolsrec-1/elfcopy-to-symbolsrec-1.out0
-rwxr-xr-xtest/elfcopy/tc/elfcopy-to-symbolsrec-1/elfcopy-to-symbolsrec-1.sh6
-rw-r--r--test/elfcopy/tc/elfcopy-to-symbolsrec-1/in/elfcopy-to-symbolsrec-1.in.shar169
-rw-r--r--test/elfcopy/tc/elfcopy-to-symbolsrec-1/out/elfcopy-to-symbolsrec-1.out.shar317
-rw-r--r--test/elfcopy/tc/strip-K-1/in/strip-K-1.in.shar34
-rw-r--r--test/elfcopy/tc/strip-K-1/out/strip-K-1.out.shar51
-rw-r--r--test/elfcopy/tc/strip-K-1/strip-K-1.err0
-rw-r--r--test/elfcopy/tc/strip-K-1/strip-K-1.eval1
-rw-r--r--test/elfcopy/tc/strip-K-1/strip-K-1.out0
-rwxr-xr-xtest/elfcopy/tc/strip-K-1/strip-K-1.sh6
-rw-r--r--test/elfcopy/tc/strip-K-2/in/strip-K-2.in.shar34
-rw-r--r--test/elfcopy/tc/strip-K-2/out/strip-K-2.out.shar56
-rw-r--r--test/elfcopy/tc/strip-K-2/strip-K-2.err0
-rw-r--r--test/elfcopy/tc/strip-K-2/strip-K-2.eval1
-rw-r--r--test/elfcopy/tc/strip-K-2/strip-K-2.out0
-rwxr-xr-xtest/elfcopy/tc/strip-K-2/strip-K-2.sh6
-rw-r--r--test/elfcopy/tc/strip-all-1/in/strip-all-1.in.shar578
-rw-r--r--test/elfcopy/tc/strip-all-1/out/strip-all-1.out.shar578
-rw-r--r--test/elfcopy/tc/strip-all-1/strip-all-1.err0
-rw-r--r--test/elfcopy/tc/strip-all-1/strip-all-1.eval1
-rw-r--r--test/elfcopy/tc/strip-all-1/strip-all-1.out0
-rwxr-xr-xtest/elfcopy/tc/strip-all-1/strip-all-1.sh6
-rw-r--r--test/elfcopy/tc/strip-all-10/in/strip-all-10.in.shar3069
-rw-r--r--test/elfcopy/tc/strip-all-10/out/strip-all-10.out.shar5623
-rw-r--r--test/elfcopy/tc/strip-all-10/strip-all-10.err0
-rw-r--r--test/elfcopy/tc/strip-all-10/strip-all-10.eval1
-rw-r--r--test/elfcopy/tc/strip-all-10/strip-all-10.out0
-rwxr-xr-xtest/elfcopy/tc/strip-all-10/strip-all-10.sh6
-rw-r--r--test/elfcopy/tc/strip-all-2/in/strip-all-2.in.shar723
-rw-r--r--test/elfcopy/tc/strip-all-2/out/strip-all-2.out.shar723
-rw-r--r--test/elfcopy/tc/strip-all-2/strip-all-2.err0
-rw-r--r--test/elfcopy/tc/strip-all-2/strip-all-2.eval1
-rw-r--r--test/elfcopy/tc/strip-all-2/strip-all-2.out0
-rwxr-xr-xtest/elfcopy/tc/strip-all-2/strip-all-2.sh6
-rw-r--r--test/elfcopy/tc/strip-all-3/in/strip-all-3.in.shar7116
-rw-r--r--test/elfcopy/tc/strip-all-3/out/strip-all-3.out.shar7116
-rw-r--r--test/elfcopy/tc/strip-all-3/strip-all-3.err0
-rw-r--r--test/elfcopy/tc/strip-all-3/strip-all-3.eval1
-rw-r--r--test/elfcopy/tc/strip-all-3/strip-all-3.out0
-rwxr-xr-xtest/elfcopy/tc/strip-all-3/strip-all-3.sh6
-rw-r--r--test/elfcopy/tc/strip-all-4/in/strip-all-4.in.shar6817
-rw-r--r--test/elfcopy/tc/strip-all-4/out/strip-all-4.out.shar6817
-rw-r--r--test/elfcopy/tc/strip-all-4/strip-all-4.err0
-rw-r--r--test/elfcopy/tc/strip-all-4/strip-all-4.eval1
-rw-r--r--test/elfcopy/tc/strip-all-4/strip-all-4.out0
-rwxr-xr-xtest/elfcopy/tc/strip-all-4/strip-all-4.sh6
-rw-r--r--test/elfcopy/tc/strip-all-5/in/strip-all-5.in.shar398
-rw-r--r--test/elfcopy/tc/strip-all-5/out/strip-all-5.out.shar306
-rw-r--r--test/elfcopy/tc/strip-all-5/strip-all-5.err0
-rw-r--r--test/elfcopy/tc/strip-all-5/strip-all-5.eval1
-rw-r--r--test/elfcopy/tc/strip-all-5/strip-all-5.out0
-rwxr-xr-xtest/elfcopy/tc/strip-all-5/strip-all-5.sh6
-rw-r--r--test/elfcopy/tc/strip-all-6/in/strip-all-6.in.shar107
-rw-r--r--test/elfcopy/tc/strip-all-6/out/strip-all-6.out.shar175
-rw-r--r--test/elfcopy/tc/strip-all-6/strip-all-6.err0
-rw-r--r--test/elfcopy/tc/strip-all-6/strip-all-6.eval1
-rw-r--r--test/elfcopy/tc/strip-all-6/strip-all-6.out0
-rwxr-xr-xtest/elfcopy/tc/strip-all-6/strip-all-6.sh6
-rw-r--r--test/elfcopy/tc/strip-all-7/in/strip-all-7.in.shar262
-rw-r--r--test/elfcopy/tc/strip-all-7/out/strip-all-7.out.shar439
-rw-r--r--test/elfcopy/tc/strip-all-7/strip-all-7.err0
-rw-r--r--test/elfcopy/tc/strip-all-7/strip-all-7.eval1
-rw-r--r--test/elfcopy/tc/strip-all-7/strip-all-7.out0
-rwxr-xr-xtest/elfcopy/tc/strip-all-7/strip-all-7.sh6
-rw-r--r--test/elfcopy/tc/strip-all-8/in/strip-all-8.in.shar708
-rw-r--r--test/elfcopy/tc/strip-all-8/out/strip-all-8.out.shar885
-rw-r--r--test/elfcopy/tc/strip-all-8/strip-all-8.err0
-rw-r--r--test/elfcopy/tc/strip-all-8/strip-all-8.eval1
-rw-r--r--test/elfcopy/tc/strip-all-8/strip-all-8.out0
-rwxr-xr-xtest/elfcopy/tc/strip-all-8/strip-all-8.sh6
-rw-r--r--test/elfcopy/tc/strip-all-9/in/strip-all-9.in.shar2302
-rw-r--r--test/elfcopy/tc/strip-all-9/out/strip-all-9.out.shar3083
-rw-r--r--test/elfcopy/tc/strip-all-9/strip-all-9.err0
-rw-r--r--test/elfcopy/tc/strip-all-9/strip-all-9.eval1
-rw-r--r--test/elfcopy/tc/strip-all-9/strip-all-9.out0
-rwxr-xr-xtest/elfcopy/tc/strip-all-9/strip-all-9.sh6
-rw-r--r--test/elfcopy/tc/strip-all-archive-1/in/strip-all-archive-1.in.shar98
-rw-r--r--test/elfcopy/tc/strip-all-archive-1/out/strip-all-archive-1.out.shar157
-rw-r--r--test/elfcopy/tc/strip-all-archive-1/strip-all-archive-1.err0
-rw-r--r--test/elfcopy/tc/strip-all-archive-1/strip-all-archive-1.eval1
-rw-r--r--test/elfcopy/tc/strip-all-archive-1/strip-all-archive-1.out0
-rwxr-xr-xtest/elfcopy/tc/strip-all-archive-1/strip-all-archive-1.sh8
-rw-r--r--test/elfcopy/tc/strip-all-archive-2/in/strip-all-archive-2.in.shar100
-rw-r--r--test/elfcopy/tc/strip-all-archive-2/out/strip-all-archive-2.out.shar161
-rw-r--r--test/elfcopy/tc/strip-all-archive-2/strip-all-archive-2.err0
-rw-r--r--test/elfcopy/tc/strip-all-archive-2/strip-all-archive-2.eval1
-rw-r--r--test/elfcopy/tc/strip-all-archive-2/strip-all-archive-2.out0
-rwxr-xr-xtest/elfcopy/tc/strip-all-archive-2/strip-all-archive-2.sh8
-rw-r--r--test/elfcopy/tc/strip-debug-1/in/strip-debug-1.in.shar1129
-rw-r--r--test/elfcopy/tc/strip-debug-1/out/strip-debug-1.out.shar1503
-rw-r--r--test/elfcopy/tc/strip-debug-1/strip-debug-1.err0
-rw-r--r--test/elfcopy/tc/strip-debug-1/strip-debug-1.eval1
-rw-r--r--test/elfcopy/tc/strip-debug-1/strip-debug-1.out0
-rwxr-xr-xtest/elfcopy/tc/strip-debug-1/strip-debug-1.sh6
-rw-r--r--test/elfcopy/tc/strip-debug-2/in/strip-debug-2.in.shar913
-rw-r--r--test/elfcopy/tc/strip-debug-2/out/strip-debug-2.out.shar1207
-rw-r--r--test/elfcopy/tc/strip-debug-2/strip-debug-2.err0
-rw-r--r--test/elfcopy/tc/strip-debug-2/strip-debug-2.eval1
-rw-r--r--test/elfcopy/tc/strip-debug-2/strip-debug-2.out0
-rwxr-xr-xtest/elfcopy/tc/strip-debug-2/strip-debug-2.sh6
-rw-r--r--test/elfcopy/tc/strip-debug-3/in/strip-debug-3.in.shar676
-rw-r--r--test/elfcopy/tc/strip-debug-3/out/strip-debug-3.out.shar1342
-rw-r--r--test/elfcopy/tc/strip-debug-3/strip-debug-3.err0
-rw-r--r--test/elfcopy/tc/strip-debug-3/strip-debug-3.eval1
-rw-r--r--test/elfcopy/tc/strip-debug-3/strip-debug-3.out0
-rwxr-xr-xtest/elfcopy/tc/strip-debug-3/strip-debug-3.sh6
-rw-r--r--test/elfcopy/tc/strip-debug-4/in/strip-debug-4.in.shar2302
-rw-r--r--test/elfcopy/tc/strip-debug-4/out/strip-debug-4.out.shar3222
-rw-r--r--test/elfcopy/tc/strip-debug-4/strip-debug-4.err0
-rw-r--r--test/elfcopy/tc/strip-debug-4/strip-debug-4.eval1
-rw-r--r--test/elfcopy/tc/strip-debug-4/strip-debug-4.out0
-rwxr-xr-xtest/elfcopy/tc/strip-debug-4/strip-debug-4.sh6
-rw-r--r--test/elfcopy/tc/strip-onlydebug-1/in/strip-onlydebug-1.in.shar1129
-rw-r--r--test/elfcopy/tc/strip-onlydebug-1/out/strip-onlydebug-1.out.shar2082
-rw-r--r--test/elfcopy/tc/strip-onlydebug-1/strip-onlydebug-1.err0
-rw-r--r--test/elfcopy/tc/strip-onlydebug-1/strip-onlydebug-1.eval1
-rw-r--r--test/elfcopy/tc/strip-onlydebug-1/strip-onlydebug-1.out0
-rwxr-xr-xtest/elfcopy/tc/strip-onlydebug-1/strip-onlydebug-1.sh6
-rw-r--r--test/elfcopy/tc/strip-unneeded-1/in/strip-unneeded-1.in.shar1129
-rw-r--r--test/elfcopy/tc/strip-unneeded-1/out/strip-unneeded-1.out.shar1498
-rw-r--r--test/elfcopy/tc/strip-unneeded-1/strip-unneeded-1.err0
-rw-r--r--test/elfcopy/tc/strip-unneeded-1/strip-unneeded-1.eval1
-rw-r--r--test/elfcopy/tc/strip-unneeded-1/strip-unneeded-1.out0
-rwxr-xr-xtest/elfcopy/tc/strip-unneeded-1/strip-unneeded-1.sh6
-rw-r--r--test/elfcopy/tc/strip-unneeded-2/in/strip-unneeded-2.in.shar2302
-rw-r--r--test/elfcopy/tc/strip-unneeded-2/out/strip-unneeded-2.out.shar3083
-rw-r--r--test/elfcopy/tc/strip-unneeded-2/strip-unneeded-2.err0
-rw-r--r--test/elfcopy/tc/strip-unneeded-2/strip-unneeded-2.eval1
-rw-r--r--test/elfcopy/tc/strip-unneeded-2/strip-unneeded-2.out0
-rwxr-xr-xtest/elfcopy/tc/strip-unneeded-2/strip-unneeded-2.sh6
-rwxr-xr-xtest/elfcopy/tcgen.sh173
-rw-r--r--test/elfdump/Makefile21
-rw-r--r--test/elfdump/tet_scen41
-rw-r--r--test/elfdump/tetexec.cfg5
-rw-r--r--test/elfdump/ts/archive1/@G%liba.a.err0
-rw-r--r--test/elfdump/ts/archive1/@G%liba.a.out8
-rw-r--r--test/elfdump/ts/archive1/@S@G%liba.a.err0
-rw-r--r--test/elfdump/ts/archive1/@S@G%liba.a.out8
-rw-r--r--test/elfdump/ts/archive1/@S@c%liba.a.err0
-rw-r--r--test/elfdump/ts/archive1/@S@c%liba.a.out246
-rw-r--r--test/elfdump/ts/archive1/@S@d%liba.a.err0
-rw-r--r--test/elfdump/ts/archive1/@S@d%liba.a.out8
-rw-r--r--test/elfdump/ts/archive1/@S@e%liba.a.err0
-rw-r--r--test/elfdump/ts/archive1/@S@e%liba.a.out48
-rw-r--r--test/elfdump/ts/archive1/@S@h%liba.a.err0
-rw-r--r--test/elfdump/ts/archive1/@S@h%liba.a.out8
-rw-r--r--test/elfdump/ts/archive1/@S@k%liba.a.err0
-rw-r--r--test/elfdump/ts/archive1/@S@k%liba.a.out16
-rw-r--r--test/elfdump/ts/archive1/@S@n%liba.a.err0
-rw-r--r--test/elfdump/ts/archive1/@S@n%liba.a.out8
-rw-r--r--test/elfdump/ts/archive1/@S@p%liba.a.err0
-rw-r--r--test/elfdump/ts/archive1/@S@p%liba.a.out8
-rw-r--r--test/elfdump/ts/archive1/@S@r%liba.a.err0
-rw-r--r--test/elfdump/ts/archive1/@S@r%liba.a.out33
-rw-r--r--test/elfdump/ts/archive1/@S@s%liba.a.err0
-rw-r--r--test/elfdump/ts/archive1/@S@s%liba.a.out71
-rw-r--r--test/elfdump/ts/archive1/@S@s@N%.symtab%liba.a.err0
-rw-r--r--test/elfdump/ts/archive1/@S@s@N%.symtab%liba.a.out58
-rw-r--r--test/elfdump/ts/archive1/@S@s@N%ARSYM%liba.a.err0
-rw-r--r--test/elfdump/ts/archive1/@S@s@N%ARSYM%liba.a.out13
-rw-r--r--test/elfdump/ts/archive1/@S@v%liba.a.err0
-rw-r--r--test/elfdump/ts/archive1/@S@v%liba.a.out8
-rw-r--r--test/elfdump/ts/archive1/@c%liba.a.err0
-rw-r--r--test/elfdump/ts/archive1/@c%liba.a.out472
-rw-r--r--test/elfdump/ts/archive1/@c@p@n%liba.a.err0
-rw-r--r--test/elfdump/ts/archive1/@c@p@n%liba.a.out472
-rw-r--r--test/elfdump/ts/archive1/@c@s%liba.a.err0
-rw-r--r--test/elfdump/ts/archive1/@c@s%liba.a.out798
-rw-r--r--test/elfdump/ts/archive1/@d%liba.a.err0
-rw-r--r--test/elfdump/ts/archive1/@d%liba.a.out8
-rw-r--r--test/elfdump/ts/archive1/@e%liba.a.err0
-rw-r--r--test/elfdump/ts/archive1/@e%liba.a.out76
-rw-r--r--test/elfdump/ts/archive1/@e@i%liba.a.err0
-rw-r--r--test/elfdump/ts/archive1/@e@i%liba.a.out76
-rw-r--r--test/elfdump/ts/archive1/@e@p@c%liba.a.err0
-rw-r--r--test/elfdump/ts/archive1/@e@p@c%liba.a.out540
-rw-r--r--test/elfdump/ts/archive1/@h%liba.a.err0
-rw-r--r--test/elfdump/ts/archive1/@h%liba.a.out8
-rw-r--r--test/elfdump/ts/archive1/@n%liba.a.err0
-rw-r--r--test/elfdump/ts/archive1/@n%liba.a.out8
-rw-r--r--test/elfdump/ts/archive1/@p%liba.a.err0
-rw-r--r--test/elfdump/ts/archive1/@p%liba.a.out8
-rw-r--r--test/elfdump/ts/archive1/@p@s%liba.a.err0
-rw-r--r--test/elfdump/ts/archive1/@p@s%liba.a.out334
-rw-r--r--test/elfdump/ts/archive1/@r%liba.a.err0
-rw-r--r--test/elfdump/ts/archive1/@r%liba.a.out68
-rw-r--r--test/elfdump/ts/archive1/liba.abin0 -> 3608 bytes
-rwxr-xr-xtest/elfdump/ts/archive1/tc168
-rw-r--r--test/elfdump/ts/archive2/@G%libdwarf.a.err0
-rw-r--r--test/elfdump/ts/archive2/@G%libdwarf.a.out26
-rw-r--r--test/elfdump/ts/archive2/@S@G%libdwarf.a.err0
-rw-r--r--test/elfdump/ts/archive2/@S@G%libdwarf.a.out26
-rw-r--r--test/elfdump/ts/archive2/@S@c%libdwarf.a.err0
-rw-r--r--test/elfdump/ts/archive2/@S@c%libdwarf.a.out1090
-rw-r--r--test/elfdump/ts/archive2/@S@d%libdwarf.a.err0
-rw-r--r--test/elfdump/ts/archive2/@S@d%libdwarf.a.out26
-rw-r--r--test/elfdump/ts/archive2/@S@e%libdwarf.a.err0
-rw-r--r--test/elfdump/ts/archive2/@S@e%libdwarf.a.out156
-rw-r--r--test/elfdump/ts/archive2/@S@h%libdwarf.a.err0
-rw-r--r--test/elfdump/ts/archive2/@S@h%libdwarf.a.out26
-rw-r--r--test/elfdump/ts/archive2/@S@k%libdwarf.a.err0
-rw-r--r--test/elfdump/ts/archive2/@S@k%libdwarf.a.out52
-rw-r--r--test/elfdump/ts/archive2/@S@n%libdwarf.a.err0
-rw-r--r--test/elfdump/ts/archive2/@S@n%libdwarf.a.out26
-rw-r--r--test/elfdump/ts/archive2/@S@p%libdwarf.a.err0
-rw-r--r--test/elfdump/ts/archive2/@S@p%libdwarf.a.out26
-rw-r--r--test/elfdump/ts/archive2/@S@r%libdwarf.a.err0
-rw-r--r--test/elfdump/ts/archive2/@S@r%libdwarf.a.out1181
-rw-r--r--test/elfdump/ts/archive2/@S@s%libdwarf.a.err0
-rw-r--r--test/elfdump/ts/archive2/@S@s%libdwarf.a.out356
-rw-r--r--test/elfdump/ts/archive2/@S@s@N%.symtab%libdwarf.a.err0
-rw-r--r--test/elfdump/ts/archive2/@S@s@N%.symtab%libdwarf.a.out309
-rw-r--r--test/elfdump/ts/archive2/@S@s@N%ARSYM%libdwarf.a.err0
-rw-r--r--test/elfdump/ts/archive2/@S@s@N%ARSYM%libdwarf.a.out47
-rw-r--r--test/elfdump/ts/archive2/@S@v%libdwarf.a.err0
-rw-r--r--test/elfdump/ts/archive2/@S@v%libdwarf.a.out26
-rw-r--r--test/elfdump/ts/archive2/@c%libdwarf.a.err0
-rw-r--r--test/elfdump/ts/archive2/@c%libdwarf.a.out2032
-rw-r--r--test/elfdump/ts/archive2/@d%libdwarf.a.err0
-rw-r--r--test/elfdump/ts/archive2/@d%libdwarf.a.out26
-rw-r--r--test/elfdump/ts/archive2/@e%libdwarf.a.err0
-rw-r--r--test/elfdump/ts/archive2/@e%libdwarf.a.out247
-rw-r--r--test/elfdump/ts/archive2/@h%libdwarf.a.err0
-rw-r--r--test/elfdump/ts/archive2/@h%libdwarf.a.out26
-rw-r--r--test/elfdump/ts/archive2/@i%libdwarf.a.err0
-rw-r--r--test/elfdump/ts/archive2/@i%libdwarf.a.out26
-rw-r--r--test/elfdump/ts/archive2/@k%libdwarf.a.err0
-rw-r--r--test/elfdump/ts/archive2/@k%libdwarf.a.out52
-rw-r--r--test/elfdump/ts/archive2/@n%libdwarf.a.err0
-rw-r--r--test/elfdump/ts/archive2/@n%libdwarf.a.out26
-rw-r--r--test/elfdump/ts/archive2/@p%libdwarf.a.err0
-rw-r--r--test/elfdump/ts/archive2/@p%libdwarf.a.out26
-rw-r--r--test/elfdump/ts/archive2/@r%libdwarf.a.err0
-rw-r--r--test/elfdump/ts/archive2/@r%libdwarf.a.out5424
-rw-r--r--test/elfdump/ts/archive2/@s%libdwarf.a.err0
-rw-r--r--test/elfdump/ts/archive2/@s%libdwarf.a.out1982
-rw-r--r--test/elfdump/ts/archive2/@v%libdwarf.a.err0
-rw-r--r--test/elfdump/ts/archive2/@v%libdwarf.a.out26
-rw-r--r--test/elfdump/ts/archive2/libdwarf.abin0 -> 73632 bytes
-rwxr-xr-xtest/elfdump/ts/archive2/tc162
-rwxr-xr-xtest/elfdump/ts/bin/tcgen.sh71
-rwxr-xr-xtest/elfdump/ts/common/func.sh127
-rw-r--r--test/elfdump/ts/dso1/@G%libelf.so.err0
-rw-r--r--test/elfdump/ts/dso1/@G%libelf.so.out143
-rw-r--r--test/elfdump/ts/dso1/@S@G%libelf.so.err0
-rw-r--r--test/elfdump/ts/dso1/@S@G%libelf.so.out50
-rw-r--r--test/elfdump/ts/dso1/@S@c@s%libelf.so.err0
-rw-r--r--test/elfdump/ts/dso1/@S@c@s%libelf.so.out315
-rw-r--r--test/elfdump/ts/dso1/@S@d%libelf.so.err0
-rw-r--r--test/elfdump/ts/dso1/@S@d%libelf.so.out29
-rw-r--r--test/elfdump/ts/dso1/@S@e%libelf.so.err0
-rw-r--r--test/elfdump/ts/dso1/@S@e%libelf.so.out10
-rw-r--r--test/elfdump/ts/dso1/@S@h%libelf.so.err0
-rw-r--r--test/elfdump/ts/dso1/@S@h%libelf.so.out122
-rw-r--r--test/elfdump/ts/dso1/@S@k%libelf.so.err0
-rw-r--r--test/elfdump/ts/dso1/@S@k%libelf.so.out2
-rw-r--r--test/elfdump/ts/dso1/@S@n%libelf.so.err0
-rw-r--r--test/elfdump/ts/dso1/@S@n%libelf.so.out0
-rw-r--r--test/elfdump/ts/dso1/@S@p%libelf.so.err0
-rw-r--r--test/elfdump/ts/dso1/@S@p%libelf.so.out24
-rw-r--r--test/elfdump/ts/dso1/@S@r%libelf.so.err0
-rw-r--r--test/elfdump/ts/dso1/@S@r%libelf.so.out154
-rw-r--r--test/elfdump/ts/dso1/@S@s@N%.dynsym%libelf.so.err0
-rw-r--r--test/elfdump/ts/dso1/@S@s@N%.dynsym%libelf.so.out147
-rw-r--r--test/elfdump/ts/dso1/@S@v%libelf.so.err0
-rw-r--r--test/elfdump/ts/dso1/@S@v%libelf.so.out9
-rw-r--r--test/elfdump/ts/dso1/@c%libelf.so.err0
-rw-r--r--test/elfdump/ts/dso1/@c%libelf.so.out302
-rw-r--r--test/elfdump/ts/dso1/@c@p@n%libelf.so.err0
-rw-r--r--test/elfdump/ts/dso1/@c@p@n%libelf.so.out344
-rw-r--r--test/elfdump/ts/dso1/@c@s%libelf.so.err0
-rw-r--r--test/elfdump/ts/dso1/@c@s%libelf.so.out1312
-rw-r--r--test/elfdump/ts/dso1/@d%libelf.so.err0
-rw-r--r--test/elfdump/ts/dso1/@d%libelf.so.out105
-rw-r--r--test/elfdump/ts/dso1/@e%libelf.so.err0
-rw-r--r--test/elfdump/ts/dso1/@e%libelf.so.out17
-rw-r--r--test/elfdump/ts/dso1/@e@i%libelf.so.err0
-rw-r--r--test/elfdump/ts/dso1/@e@i%libelf.so.out17
-rw-r--r--test/elfdump/ts/dso1/@e@p@c%libelf.so.err0
-rw-r--r--test/elfdump/ts/dso1/@e@p@c%libelf.so.out361
-rw-r--r--test/elfdump/ts/dso1/@h%libelf.so.err0
-rw-r--r--test/elfdump/ts/dso1/@h%libelf.so.out831
-rw-r--r--test/elfdump/ts/dso1/@n%libelf.so.err0
-rw-r--r--test/elfdump/ts/dso1/@n%libelf.so.out0
-rw-r--r--test/elfdump/ts/dso1/@p%libelf.so.err0
-rw-r--r--test/elfdump/ts/dso1/@p%libelf.so.out42
-rw-r--r--test/elfdump/ts/dso1/@p@s%libelf.so.err0
-rw-r--r--test/elfdump/ts/dso1/@p@s%libelf.so.out1052
-rw-r--r--test/elfdump/ts/dso1/@r%libelf.so.err0
-rw-r--r--test/elfdump/ts/dso1/@r%libelf.so.out744
-rw-r--r--test/elfdump/ts/dso1/libelf.sobin0 -> 106416 bytes
-rwxr-xr-xtest/elfdump/ts/dso1/tc157
-rw-r--r--test/elfdump/ts/dso2/@G%test.so.err0
-rw-r--r--test/elfdump/ts/dso2/@G%test.so.out11
-rw-r--r--test/elfdump/ts/dso2/@S@G%test.so.err0
-rw-r--r--test/elfdump/ts/dso2/@S@G%test.so.out6
-rw-r--r--test/elfdump/ts/dso2/@S@c%test.so.err0
-rw-r--r--test/elfdump/ts/dso2/@S@c%test.so.out210
-rw-r--r--test/elfdump/ts/dso2/@S@d%test.so.err0
-rw-r--r--test/elfdump/ts/dso2/@S@d%test.so.out27
-rw-r--r--test/elfdump/ts/dso2/@S@e%test.so.err0
-rw-r--r--test/elfdump/ts/dso2/@S@e%test.so.out10
-rw-r--r--test/elfdump/ts/dso2/@S@h%test.so.err0
-rw-r--r--test/elfdump/ts/dso2/@S@h%test.so.out22
-rw-r--r--test/elfdump/ts/dso2/@S@k%test.so.err0
-rw-r--r--test/elfdump/ts/dso2/@S@k%test.so.out2
-rw-r--r--test/elfdump/ts/dso2/@S@n%test.so.err0
-rw-r--r--test/elfdump/ts/dso2/@S@n%test.so.out0
-rw-r--r--test/elfdump/ts/dso2/@S@p%test.so.err0
-rw-r--r--test/elfdump/ts/dso2/@S@p%test.so.out30
-rw-r--r--test/elfdump/ts/dso2/@S@r%test.so.err0
-rw-r--r--test/elfdump/ts/dso2/@S@r%test.so.out20
-rw-r--r--test/elfdump/ts/dso2/@S@s%test.so.err0
-rw-r--r--test/elfdump/ts/dso2/@S@s%test.so.out103
-rw-r--r--test/elfdump/ts/dso2/@S@v%test.so.err0
-rw-r--r--test/elfdump/ts/dso2/@S@v%test.so.out5
-rw-r--r--test/elfdump/ts/dso2/@c%test.so.err0
-rw-r--r--test/elfdump/ts/dso2/@c%test.so.out374
-rw-r--r--test/elfdump/ts/dso2/@c@p@n%test.so.err0
-rw-r--r--test/elfdump/ts/dso2/@c@p@n%test.so.out426
-rw-r--r--test/elfdump/ts/dso2/@c@s%test.so.err0
-rw-r--r--test/elfdump/ts/dso2/@c@s%test.so.out1057
-rw-r--r--test/elfdump/ts/dso2/@d%test.so.err0
-rw-r--r--test/elfdump/ts/dso2/@d%test.so.out97
-rw-r--r--test/elfdump/ts/dso2/@e%test.so.err0
-rw-r--r--test/elfdump/ts/dso2/@e%test.so.out17
-rw-r--r--test/elfdump/ts/dso2/@e@i%test.so.err0
-rw-r--r--test/elfdump/ts/dso2/@e@i%test.so.out17
-rw-r--r--test/elfdump/ts/dso2/@e@p@c%test.so.err0
-rw-r--r--test/elfdump/ts/dso2/@e@p@c%test.so.out443
-rw-r--r--test/elfdump/ts/dso2/@h%test.so.err0
-rw-r--r--test/elfdump/ts/dso2/@h%test.so.out51
-rw-r--r--test/elfdump/ts/dso2/@n%test.so.err0
-rw-r--r--test/elfdump/ts/dso2/@n%test.so.out0
-rw-r--r--test/elfdump/ts/dso2/@p%test.so.err0
-rw-r--r--test/elfdump/ts/dso2/@p%test.so.out52
-rw-r--r--test/elfdump/ts/dso2/@p@s%test.so.err0
-rw-r--r--test/elfdump/ts/dso2/@p@s%test.so.out735
-rw-r--r--test/elfdump/ts/dso2/@r%test.so.err0
-rw-r--r--test/elfdump/ts/dso2/@r%test.so.out74
-rwxr-xr-xtest/elfdump/ts/dso2/tc156
-rw-r--r--test/elfdump/ts/dso2/test.sobin0 -> 9684 bytes
-rw-r--r--test/elfdump/ts/exec1/@G%ls.err0
-rw-r--r--test/elfdump/ts/exec1/@G%ls.out221
-rw-r--r--test/elfdump/ts/exec1/@G@e%ls.err0
-rw-r--r--test/elfdump/ts/exec1/@G@e%ls.out238
-rw-r--r--test/elfdump/ts/exec1/@S@G%ls.err0
-rw-r--r--test/elfdump/ts/exec1/@S@G%ls.out76
-rw-r--r--test/elfdump/ts/exec1/@S@c@s%ls.err0
-rw-r--r--test/elfdump/ts/exec1/@S@c@s%ls.out267
-rw-r--r--test/elfdump/ts/exec1/@S@d%ls.err0
-rw-r--r--test/elfdump/ts/exec1/@S@d%ls.out29
-rw-r--r--test/elfdump/ts/exec1/@S@e%ls.err0
-rw-r--r--test/elfdump/ts/exec1/@S@e%ls.out10
-rw-r--r--test/elfdump/ts/exec1/@S@e@k%ls.err0
-rw-r--r--test/elfdump/ts/exec1/@S@e@k%ls.out12
-rw-r--r--test/elfdump/ts/exec1/@S@e@p%ls.err0
-rw-r--r--test/elfdump/ts/exec1/@S@e@p%ls.out52
-rw-r--r--test/elfdump/ts/exec1/@S@h%ls.err0
-rw-r--r--test/elfdump/ts/exec1/@S@h%ls.out99
-rw-r--r--test/elfdump/ts/exec1/@S@n%ls.err0
-rw-r--r--test/elfdump/ts/exec1/@S@n%ls.out8
-rw-r--r--test/elfdump/ts/exec1/@S@r%ls.err0
-rw-r--r--test/elfdump/ts/exec1/@S@r%ls.out84
-rw-r--r--test/elfdump/ts/exec1/@S@r@N%.rela.dyn%ls.err0
-rw-r--r--test/elfdump/ts/exec1/@S@r@N%.rela.dyn%ls.out11
-rw-r--r--test/elfdump/ts/exec1/@S@r@N%.rela.dyn@N%.rela.plt%ls.err0
-rw-r--r--test/elfdump/ts/exec1/@S@r@N%.rela.dyn@N%.rela.plt%ls.out84
-rw-r--r--test/elfdump/ts/exec1/@S@s@N%.dynsym%ls.err0
-rw-r--r--test/elfdump/ts/exec1/@S@s@N%.dynsym%ls.out92
-rw-r--r--test/elfdump/ts/exec1/@S@v%ls.err0
-rw-r--r--test/elfdump/ts/exec1/@S@v%ls.out5
-rw-r--r--test/elfdump/ts/exec1/@c%ls.err0
-rw-r--r--test/elfdump/ts/exec1/@c%ls.out314
-rw-r--r--test/elfdump/ts/exec1/@c@d%ls.err0
-rw-r--r--test/elfdump/ts/exec1/@c@d%ls.out418
-rw-r--r--test/elfdump/ts/exec1/@c@p@n%ls.err0
-rw-r--r--test/elfdump/ts/exec1/@c@p@n%ls.out389
-rw-r--r--test/elfdump/ts/exec1/@c@s%ls.err0
-rw-r--r--test/elfdump/ts/exec1/@c@s%ls.out939
-rw-r--r--test/elfdump/ts/exec1/@e%ls.err0
-rw-r--r--test/elfdump/ts/exec1/@e%ls.out17
-rw-r--r--test/elfdump/ts/exec1/@e@d%ls.err0
-rw-r--r--test/elfdump/ts/exec1/@e@d%ls.out121
-rw-r--r--test/elfdump/ts/exec1/@e@p%ls.err0
-rw-r--r--test/elfdump/ts/exec1/@e@p%ls.out89
-rw-r--r--test/elfdump/ts/exec1/@e@p@c@d%ls.err0
-rw-r--r--test/elfdump/ts/exec1/@e@p@c@d%ls.out507
-rw-r--r--test/elfdump/ts/exec1/@n%ls.err0
-rw-r--r--test/elfdump/ts/exec1/@n%ls.out3
-rw-r--r--test/elfdump/ts/exec1/@p@e%ls.err0
-rw-r--r--test/elfdump/ts/exec1/@p@e%ls.out89
-rw-r--r--test/elfdump/ts/exec1/@p@n%ls.err0
-rw-r--r--test/elfdump/ts/exec1/@p@n%ls.out75
-rw-r--r--test/elfdump/ts/exec1/@p@s%ls.err0
-rw-r--r--test/elfdump/ts/exec1/@p@s%ls.out697
-rw-r--r--test/elfdump/ts/exec1/lsbin0 -> 30000 bytes
-rwxr-xr-xtest/elfdump/ts/exec1/tc174
-rw-r--r--test/elfdump/ts/exec2/@G%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@G%cp.out185
-rw-r--r--test/elfdump/ts/exec2/@G@e%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@G@e%cp.out202
-rw-r--r--test/elfdump/ts/exec2/@S@G%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@S@G%cp.out64
-rw-r--r--test/elfdump/ts/exec2/@S@c@s%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@S@c@s%cp.out238
-rw-r--r--test/elfdump/ts/exec2/@S@d%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@S@d%cp.out27
-rw-r--r--test/elfdump/ts/exec2/@S@e%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@S@e%cp.out10
-rw-r--r--test/elfdump/ts/exec2/@S@e@p%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@S@e@p%cp.out46
-rw-r--r--test/elfdump/ts/exec2/@S@h%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@S@h%cp.out76
-rw-r--r--test/elfdump/ts/exec2/@S@k%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@S@k%cp.out2
-rw-r--r--test/elfdump/ts/exec2/@S@n%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@S@n%cp.out8
-rw-r--r--test/elfdump/ts/exec2/@S@r%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@S@r%cp.out68
-rw-r--r--test/elfdump/ts/exec2/@S@r@N%.rela.dyn%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@S@r@N%.rela.dyn%cp.out0
-rw-r--r--test/elfdump/ts/exec2/@S@s@N%.dynsym%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@S@s@N%.dynsym%cp.out70
-rw-r--r--test/elfdump/ts/exec2/@S@v%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@S@v%cp.out4
-rw-r--r--test/elfdump/ts/exec2/@c%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@c%cp.out302
-rw-r--r--test/elfdump/ts/exec2/@c@d%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@c@d%cp.out398
-rw-r--r--test/elfdump/ts/exec2/@c@p@n%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@c@p@n%cp.out367
-rw-r--r--test/elfdump/ts/exec2/@c@s%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@c@s%cp.out773
-rw-r--r--test/elfdump/ts/exec2/@e%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@e%cp.out17
-rw-r--r--test/elfdump/ts/exec2/@e@d%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@e@d%cp.out113
-rw-r--r--test/elfdump/ts/exec2/@e@i%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@e@i%cp.out20
-rw-r--r--test/elfdump/ts/exec2/@e@p%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@e@p%cp.out79
-rw-r--r--test/elfdump/ts/exec2/@e@p@c@d%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@e@p@c@d%cp.out477
-rw-r--r--test/elfdump/ts/exec2/@h%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@h%cp.out408
-rw-r--r--test/elfdump/ts/exec2/@n%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@n%cp.out3
-rw-r--r--test/elfdump/ts/exec2/@p@e%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@p@e%cp.out79
-rw-r--r--test/elfdump/ts/exec2/@p@n%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@p@n%cp.out65
-rw-r--r--test/elfdump/ts/exec2/@p@s%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@p@s%cp.out533
-rw-r--r--test/elfdump/ts/exec2/@r%cp.err0
-rw-r--r--test/elfdump/ts/exec2/@r%cp.out252
-rw-r--r--test/elfdump/ts/exec2/cpbin0 -> 15692 bytes
-rwxr-xr-xtest/elfdump/ts/exec2/tc184
-rw-r--r--test/libdwarf/Makefile34
-rw-r--r--test/libdwarf/tet_scen119
-rw-r--r--test/libdwarf/tetbuild.cfg5
-rw-r--r--test/libdwarf/tetclean.cfg7
-rw-r--r--test/libdwarf/tetexec.cfg3
-rw-r--r--test/libdwarf/ts/Makefile25
-rw-r--r--test/libdwarf/ts/Makefile.tset56
-rw-r--r--test/libdwarf/ts/README34
-rwxr-xr-xtest/libdwarf/ts/bin/count-ic38
-rw-r--r--test/libdwarf/ts/common/die_traverse.c104
-rw-r--r--test/libdwarf/ts/common/driver.c890
-rw-r--r--test/libdwarf/ts/common/driver.h172
-rwxr-xr-xtest/libdwarf/ts/common/object/dt32-g1.gzbin0 -> 9724 bytes
-rwxr-xr-xtest/libdwarf/ts/common/object/dt64-g1.gzbin0 -> 9841 bytes
-rwxr-xr-xtest/libdwarf/ts/common/object/dt64-g3.gzbin0 -> 30254 bytes
-rw-r--r--test/libdwarf/ts/common/object/dto64-g1.gzbin0 -> 7880 bytes
-rwxr-xr-xtest/libdwarf/ts/common/object/ec32-g1.gzbin0 -> 277478 bytes
-rwxr-xr-xtest/libdwarf/ts/common/object/ec64-g1.gzbin0 -> 301342 bytes
-rwxr-xr-xtest/libdwarf/ts/common/object/ec64-g3.gzbin0 -> 323788 bytes
-rw-r--r--test/libdwarf/ts/dwarf_abbrev/Makefile8
-rw-r--r--test/libdwarf/ts/dwarf_abbrev/dt32-g1.xml.gzbin0 -> 1328 bytes
-rw-r--r--test/libdwarf/ts/dwarf_abbrev/dto64-g1.xml.gzbin0 -> 1334 bytes
-rw-r--r--test/libdwarf/ts/dwarf_abbrev/dwarf_abbrev.c125
-rw-r--r--test/libdwarf/ts/dwarf_abbrev/ec64-g1.xml.gzbin0 -> 8447 bytes
-rw-r--r--test/libdwarf/ts/dwarf_arange/Makefile8
-rw-r--r--test/libdwarf/ts/dwarf_arange/dt32-g1.xml.gzbin0 -> 198 bytes
-rw-r--r--test/libdwarf/ts/dwarf_arange/dt64-g1.xml.gzbin0 -> 197 bytes
-rw-r--r--test/libdwarf/ts/dwarf_arange/dwarf_arange.c127
-rw-r--r--test/libdwarf/ts/dwarf_arange/ec32-g1.xml.gzbin0 -> 328 bytes
-rw-r--r--test/libdwarf/ts/dwarf_arange/ec64-g1.xml.gzbin0 -> 316 bytes
-rw-r--r--test/libdwarf/ts/dwarf_attr/Makefile8
-rw-r--r--test/libdwarf/ts/dwarf_attr/dt32-g1.xml.gzbin0 -> 1463 bytes
-rw-r--r--test/libdwarf/ts/dwarf_attr/dt64-g1.xml.gzbin0 -> 1468 bytes
-rw-r--r--test/libdwarf/ts/dwarf_attr/dto64-g1.xml.gzbin0 -> 1470 bytes
-rw-r--r--test/libdwarf/ts/dwarf_attr/dwarf_attr.c198
-rw-r--r--test/libdwarf/ts/dwarf_attr/ec32-g1.xml.gzbin0 -> 14221 bytes
-rw-r--r--test/libdwarf/ts/dwarf_attr/ec64-g1.xml.gzbin0 -> 14231 bytes
-rw-r--r--test/libdwarf/ts/dwarf_attrlist/Makefile8
-rw-r--r--test/libdwarf/ts/dwarf_attrlist/dt32-g1.xml.gzbin0 -> 750 bytes
-rw-r--r--test/libdwarf/ts/dwarf_attrlist/dt64-g1.xml.gzbin0 -> 753 bytes
-rw-r--r--test/libdwarf/ts/dwarf_attrlist/dwarf_attrlist.c129
-rw-r--r--test/libdwarf/ts/dwarf_attrlist/ec32-g1.xml.gzbin0 -> 5465 bytes
-rw-r--r--test/libdwarf/ts/dwarf_attrlist/ec64-g1.xml.gzbin0 -> 5475 bytes
-rw-r--r--test/libdwarf/ts/dwarf_child/Makefile8
-rw-r--r--test/libdwarf/ts/dwarf_child/dt32-g1.xml.gzbin0 -> 135 bytes
-rw-r--r--test/libdwarf/ts/dwarf_child/dt64-g1.xml.gzbin0 -> 136 bytes
-rw-r--r--test/libdwarf/ts/dwarf_child/dwarf_child.c138
-rw-r--r--test/libdwarf/ts/dwarf_child/ec32-g1.xml.gzbin0 -> 138 bytes
-rw-r--r--test/libdwarf/ts/dwarf_child/ec64-g1.xml.gzbin0 -> 138 bytes
-rw-r--r--test/libdwarf/ts/dwarf_die_convenience/Makefile8
-rw-r--r--test/libdwarf/ts/dwarf_die_convenience/dt32-g1.xml.gzbin0 -> 822 bytes
-rw-r--r--test/libdwarf/ts/dwarf_die_convenience/dt64-g1.xml.gzbin0 -> 819 bytes
-rw-r--r--test/libdwarf/ts/dwarf_die_convenience/dwarf_die_convenience.c242
-rw-r--r--test/libdwarf/ts/dwarf_die_convenience/ec32-g1.xml.gzbin0 -> 5960 bytes
-rw-r--r--test/libdwarf/ts/dwarf_die_convenience/ec64-g1.xml.gzbin0 -> 5935 bytes
-rw-r--r--test/libdwarf/ts/dwarf_die_offset/Makefile8
-rw-r--r--test/libdwarf/ts/dwarf_die_offset/dt32-g1.xml.gzbin0 -> 1791 bytes
-rw-r--r--test/libdwarf/ts/dwarf_die_offset/dt64-g1.xml.gzbin0 -> 1797 bytes
-rw-r--r--test/libdwarf/ts/dwarf_die_offset/dwarf_die_offset.c190
-rw-r--r--test/libdwarf/ts/dwarf_die_offset/ec32-g1.xml.gzbin0 -> 19169 bytes
-rw-r--r--test/libdwarf/ts/dwarf_die_offset/ec64-g1.xml.gzbin0 -> 19118 bytes
-rw-r--r--test/libdwarf/ts/dwarf_die_query/Makefile8
-rw-r--r--test/libdwarf/ts/dwarf_die_query/dt32-g1.xml.gzbin0 -> 1461 bytes
-rw-r--r--test/libdwarf/ts/dwarf_die_query/dt64-g1.xml.gzbin0 -> 1459 bytes
-rw-r--r--test/libdwarf/ts/dwarf_die_query/dto64-g1.xml.gzbin0 -> 1458 bytes
-rw-r--r--test/libdwarf/ts/dwarf_die_query/dwarf_die_query.c154
-rw-r--r--test/libdwarf/ts/dwarf_die_query/ec32-g1.xml.gzbin0 -> 12687 bytes
-rw-r--r--test/libdwarf/ts/dwarf_die_query/ec64-g1.xml.gzbin0 -> 12685 bytes
-rw-r--r--test/libdwarf/ts/dwarf_form/Makefile8
-rw-r--r--test/libdwarf/ts/dwarf_form/dt32-g1.xml.gzbin0 -> 8114 bytes
-rw-r--r--test/libdwarf/ts/dwarf_form/dt64-g1.xml.gzbin0 -> 8140 bytes
-rw-r--r--test/libdwarf/ts/dwarf_form/dwarf_form.c270
-rw-r--r--test/libdwarf/ts/dwarf_form/ec32-g1.xml.gzbin0 -> 89574 bytes
-rw-r--r--test/libdwarf/ts/dwarf_form/ec64-g1.xml.gzbin0 -> 89610 bytes
-rw-r--r--test/libdwarf/ts/dwarf_frame/Makefile8
-rw-r--r--test/libdwarf/ts/dwarf_frame/dt64-g1.xml.gzbin0 -> 10646 bytes
-rw-r--r--test/libdwarf/ts/dwarf_frame/dto64-g1.xml.gzbin0 -> 5059 bytes
-rw-r--r--test/libdwarf/ts/dwarf_frame/dwarf_frame.c498
-rw-r--r--test/libdwarf/ts/dwarf_frame/ec32-g1.xml.gzbin0 -> 104318 bytes
-rw-r--r--test/libdwarf/ts/dwarf_get_address_size/Makefile8
-rw-r--r--test/libdwarf/ts/dwarf_get_address_size/dt32-g1.xml.gzbin0 -> 127 bytes
-rw-r--r--test/libdwarf/ts/dwarf_get_address_size/dt64-g1.xml.gzbin0 -> 128 bytes
-rw-r--r--test/libdwarf/ts/dwarf_get_address_size/dwarf_get_address_size.c87
-rw-r--r--test/libdwarf/ts/dwarf_init/Makefile8
-rw-r--r--test/libdwarf/ts/dwarf_init/dt32-g1.xml.gzbin0 -> 90 bytes
-rw-r--r--test/libdwarf/ts/dwarf_init/dt64-g1.xml.gzbin0 -> 90 bytes
-rw-r--r--test/libdwarf/ts/dwarf_init/dwarf_init.c82
-rw-r--r--test/libdwarf/ts/dwarf_init/ec32-g1.xml.gzbin0 -> 90 bytes
-rw-r--r--test/libdwarf/ts/dwarf_init/ec64-g1.xml.gzbin0 -> 90 bytes
-rw-r--r--test/libdwarf/ts/dwarf_lineno/Makefile8
-rw-r--r--test/libdwarf/ts/dwarf_lineno/dt32-g1.xml.gzbin0 -> 1478 bytes
-rw-r--r--test/libdwarf/ts/dwarf_lineno/dt64-g1.xml.gzbin0 -> 1470 bytes
-rw-r--r--test/libdwarf/ts/dwarf_lineno/dto64-g1.xml.gzbin0 -> 1446 bytes
-rw-r--r--test/libdwarf/ts/dwarf_lineno/dwarf_lineno.c278
-rw-r--r--test/libdwarf/ts/dwarf_lineno/ec32-g1.xml.gzbin0 -> 17688 bytes
-rw-r--r--test/libdwarf/ts/dwarf_lineno/ec64-g1.xml.gzbin0 -> 17539 bytes
-rw-r--r--test/libdwarf/ts/dwarf_loclist/Makefile8
-rw-r--r--test/libdwarf/ts/dwarf_loclist/dt32-g1.xml.gzbin0 -> 3672 bytes
-rw-r--r--test/libdwarf/ts/dwarf_loclist/dt64-g1.xml.gzbin0 -> 3298 bytes
-rw-r--r--test/libdwarf/ts/dwarf_loclist/dwarf_loclist.c234
-rw-r--r--test/libdwarf/ts/dwarf_loclist/ec32-g1.xml.gzbin0 -> 30295 bytes
-rw-r--r--test/libdwarf/ts/dwarf_loclist/ec64-g1.xml.gzbin0 -> 32586 bytes
-rw-r--r--test/libdwarf/ts/dwarf_macinfo/Makefile8
-rw-r--r--test/libdwarf/ts/dwarf_macinfo/dt64-g1.xml.gzbin0 -> 129 bytes
-rw-r--r--test/libdwarf/ts/dwarf_macinfo/dt64-g3.xml.gzbin0 -> 94883 bytes
-rw-r--r--test/libdwarf/ts/dwarf_macinfo/dwarf_macinfo.c137
-rw-r--r--test/libdwarf/ts/dwarf_macinfo/ec64-g3.xml.gzbin0 -> 263347 bytes
-rw-r--r--test/libdwarf/ts/dwarf_next_cu_header/Makefile8
-rw-r--r--test/libdwarf/ts/dwarf_next_cu_header/dt32-g1.xml.gzbin0 -> 244 bytes
-rw-r--r--test/libdwarf/ts/dwarf_next_cu_header/dt64-g1.xml.gzbin0 -> 246 bytes
-rw-r--r--test/libdwarf/ts/dwarf_next_cu_header/dwarf_next_cu_header.c149
-rw-r--r--test/libdwarf/ts/dwarf_next_cu_header/ec32-g1.xml.gzbin0 -> 352 bytes
-rw-r--r--test/libdwarf/ts/dwarf_next_cu_header/ec64-g1.xml.gzbin0 -> 358 bytes
-rw-r--r--test/libdwarf/ts/dwarf_pubnames/Makefile8
-rw-r--r--test/libdwarf/ts/dwarf_pubnames/dt32-g1.xml.gzbin0 -> 177 bytes
-rw-r--r--test/libdwarf/ts/dwarf_pubnames/dwarf_pubnames.c114
-rw-r--r--test/libdwarf/ts/dwarf_pubnames/ec64-g1.xml.gzbin0 -> 604 bytes
-rw-r--r--test/libdwarf/ts/dwarf_ranges/Makefile8
-rw-r--r--test/libdwarf/ts/dwarf_ranges/dt32-g1.xml.gzbin0 -> 759 bytes
-rw-r--r--test/libdwarf/ts/dwarf_ranges/dwarf_ranges.c102
-rw-r--r--test/libdwarf/ts/dwarf_ranges/ec64-g1.xml.gzbin0 -> 4492 bytes
-rw-r--r--test/libdwarf/ts/dwarf_siblingof/Makefile8
-rw-r--r--test/libdwarf/ts/dwarf_siblingof/dt32-g1.xml.gzbin0 -> 137 bytes
-rw-r--r--test/libdwarf/ts/dwarf_siblingof/dt64-g1.xml.gzbin0 -> 138 bytes
-rw-r--r--test/libdwarf/ts/dwarf_siblingof/dwarf_siblingof.c160
-rw-r--r--test/libdwarf/ts/dwarf_siblingof/ec32-g1.xml.gzbin0 -> 140 bytes
-rw-r--r--test/libdwarf/ts/dwarf_siblingof/ec64-g1.xml.gzbin0 -> 140 bytes
-rw-r--r--test/libelf/Makefile36
-rw-r--r--test/libelf/README96
-rw-r--r--test/libelf/tet_code17
-rw-r--r--test/libelf/tet_scen116
-rw-r--r--test/libelf/tetbuild.cfg7
-rw-r--r--test/libelf/tetclean.cfg9
-rw-r--r--test/libelf/tetexec.cfg5
-rw-r--r--test/libelf/tset/Makefile58
-rw-r--r--test/libelf/tset/Makefile.tset36
-rw-r--r--test/libelf/tset/abi/Makefile7
-rw-r--r--test/libelf/tset/abi/abi.m4296
-rwxr-xr-xtest/libelf/tset/bin/elf-hash39
-rwxr-xr-xtest/libelf/tset/bin/elfc1615
-rw-r--r--test/libelf/tset/common/Makefile36
-rw-r--r--test/libelf/tset/common/check_elf.yaml16
-rw-r--r--test/libelf/tset/common/ehdr.yaml23
-rw-r--r--test/libelf/tset/common/ehdr_template.m4371
-rw-r--r--test/libelf/tset/common/elf_flag.m4184
-rw-r--r--test/libelf/tset/common/elfts-compare-files.c125
-rw-r--r--test/libelf/tset/common/elfts-copy-file.c107
-rw-r--r--test/libelf/tset/common/elfts-initversion.c48
-rw-r--r--test/libelf/tset/common/elfts-openfile.c80
-rw-r--r--test/libelf/tset/common/elfts.h118
-rw-r--r--test/libelf/tset/common/fsize.yaml16
-rw-r--r--test/libelf/tset/common/gelf_ehdr_template.h167
-rw-r--r--test/libelf/tset/common/getclass.yaml16
-rw-r--r--test/libelf/tset/common/getshdr.m4171
-rw-r--r--test/libelf/tset/common/newehdr.yaml7
-rw-r--r--test/libelf/tset/common/newehdr_template.m4243
-rw-r--r--test/libelf/tset/common/newscn.yaml27
-rw-r--r--test/libelf/tset/common/newscn2.yaml28
-rw-r--r--test/libelf/tset/common/phdr.yaml38
-rw-r--r--test/libelf/tset/common/phdr_template.c418
-rw-r--r--test/libelf/tset/common/rdwr.yaml27
-rw-r--r--test/libelf/tset/common/rdwr1.yaml27
-rw-r--r--test/libelf/tset/common/rdwr2.yaml28
-rw-r--r--test/libelf/tset/common/shdr.yaml42
-rw-r--r--test/libelf/tset/common/u1.yaml29
-rw-r--r--test/libelf/tset/common/versioning.yaml55
-rw-r--r--test/libelf/tset/common/xlate.yaml23
-rw-r--r--test/libelf/tset/common/xlate_template.c1825
-rw-r--r--test/libelf/tset/common/xlate_template.m41436
-rw-r--r--test/libelf/tset/common/xscn-1.yaml23
-rw-r--r--test/libelf/tset/common/xscn-2.yaml22
-rw-r--r--test/libelf/tset/common/xscn-3.yaml26
-rw-r--r--test/libelf/tset/common/zerosection.yaml27
-rw-r--r--test/libelf/tset/elf32_getehdr/Makefile8
-rw-r--r--test/libelf/tset/elf32_getehdr/ehdr.m441
-rw-r--r--test/libelf/tset/elf32_getphdr/Makefile9
-rw-r--r--test/libelf/tset/elf32_getphdr/phdr.m441
-rw-r--r--test/libelf/tset/elf32_getshdr/Makefile8
-rw-r--r--test/libelf/tset/elf32_getshdr/shdr.m454
-rw-r--r--test/libelf/tset/elf32_newehdr/Makefile9
-rw-r--r--test/libelf/tset/elf32_newehdr/ehdr.m445
-rw-r--r--test/libelf/tset/elf32_xlatetof/Makefile7
-rw-r--r--test/libelf/tset/elf32_xlatetof/xlate.m451
-rw-r--r--test/libelf/tset/elf32_xlatetom/Makefile7
-rw-r--r--test/libelf/tset/elf32_xlatetom/xlate.m452
-rw-r--r--test/libelf/tset/elf64_getehdr/Makefile8
-rw-r--r--test/libelf/tset/elf64_getehdr/ehdr.m441
-rw-r--r--test/libelf/tset/elf64_getphdr/Makefile9
-rw-r--r--test/libelf/tset/elf64_getphdr/phdr.m441
-rw-r--r--test/libelf/tset/elf64_getshdr/Makefile8
-rw-r--r--test/libelf/tset/elf64_getshdr/shdr.m454
-rw-r--r--test/libelf/tset/elf64_newehdr/Makefile9
-rw-r--r--test/libelf/tset/elf64_newehdr/ehdr.m445
-rw-r--r--test/libelf/tset/elf64_xlatetof/Makefile7
-rw-r--r--test/libelf/tset/elf64_xlatetof/xlate.m451
-rw-r--r--test/libelf/tset/elf64_xlatetom/Makefile7
-rw-r--r--test/libelf/tset/elf64_xlatetom/xlate.m452
-rw-r--r--test/libelf/tset/elf_begin/Makefile23
-rw-r--r--test/libelf/tset/elf_begin/begin.m4636
-rw-r--r--test/libelf/tset/elf_cntl/Makefile16
-rw-r--r--test/libelf/tset/elf_cntl/cntl.m4217
-rw-r--r--test/libelf/tset/elf_end/Makefile7
-rw-r--r--test/libelf/tset/elf_end/end.m4100
-rw-r--r--test/libelf/tset/elf_errmsg/Makefile7
-rw-r--r--test/libelf/tset/elf_errmsg/errmsg.m4153
-rw-r--r--test/libelf/tset/elf_errno/Makefile7
-rw-r--r--test/libelf/tset/elf_errno/errno.m4185
-rw-r--r--test/libelf/tset/elf_fill/Makefile7
-rw-r--r--test/libelf/tset/elf_fill/fill.m4558
-rw-r--r--test/libelf/tset/elf_flagarhdr/Makefile16
-rw-r--r--test/libelf/tset/elf_flagarhdr/flagarhdr.m498
-rw-r--r--test/libelf/tset/elf_flagdata/Makefile7
-rw-r--r--test/libelf/tset/elf_flagdata/data.m4110
-rw-r--r--test/libelf/tset/elf_flagehdr/Makefile8
-rw-r--r--test/libelf/tset/elf_flagehdr/ehdr.m4115
-rw-r--r--test/libelf/tset/elf_flagelf/Makefile17
-rw-r--r--test/libelf/tset/elf_flagelf/elf.m4133
-rw-r--r--test/libelf/tset/elf_flagphdr/Makefile8
-rw-r--r--test/libelf/tset/elf_flagphdr/phdr.m4117
-rw-r--r--test/libelf/tset/elf_flagscn/Makefile7
-rw-r--r--test/libelf/tset/elf_flagscn/scn.m491
-rw-r--r--test/libelf/tset/elf_flagshdr/Makefile7
-rw-r--r--test/libelf/tset/elf_flagshdr/shdr.m491
-rw-r--r--test/libelf/tset/elf_fsize/Makefile8
-rw-r--r--test/libelf/tset/elf_fsize/fsize.m4273
-rw-r--r--test/libelf/tset/elf_getarhdr/Makefile29
-rw-r--r--test/libelf/tset/elf_getarhdr/getarhdr.m4471
-rw-r--r--test/libelf/tset/elf_getarsym/Makefile40
-rw-r--r--test/libelf/tset/elf_getarsym/getarsym.m4363
-rw-r--r--test/libelf/tset/elf_getbase/Makefile7
-rw-r--r--test/libelf/tset/elf_getbase/getbase.m4100
-rw-r--r--test/libelf/tset/elf_getdata/Makefile8
-rw-r--r--test/libelf/tset/elf_getdata/getdata.m4203
-rw-r--r--test/libelf/tset/elf_getident/Makefile7
-rw-r--r--test/libelf/tset/elf_getident/getident.m4168
-rw-r--r--test/libelf/tset/elf_getscn/Makefile8
-rw-r--r--test/libelf/tset/elf_getscn/getscn.m4313
-rw-r--r--test/libelf/tset/elf_getshnum/Makefile8
-rw-r--r--test/libelf/tset/elf_getshnum/getshnum.m4177
-rw-r--r--test/libelf/tset/elf_getshstrndx/Makefile8
-rw-r--r--test/libelf/tset/elf_getshstrndx/getshstrndx.m4180
-rw-r--r--test/libelf/tset/elf_hash/Makefile7
-rw-r--r--test/libelf/tset/elf_hash/hash.m4101
-rw-r--r--test/libelf/tset/elf_kind/Makefile7
-rw-r--r--test/libelf/tset/elf_kind/kind.m4122
-rw-r--r--test/libelf/tset/elf_memory/Makefile7
-rw-r--r--test/libelf/tset/elf_memory/memory.m4240
-rw-r--r--test/libelf/tset/elf_ndxscn/Makefile8
-rw-r--r--test/libelf/tset/elf_ndxscn/ndxscn.m4119
-rw-r--r--test/libelf/tset/elf_newscn/Makefile8
-rw-r--r--test/libelf/tset/elf_newscn/newscn.m4290
-rw-r--r--test/libelf/tset/elf_next/Makefile36
-rw-r--r--test/libelf/tset/elf_next/next.m4151
-rw-r--r--test/libelf/tset/elf_nextscn/Makefile8
-rw-r--r--test/libelf/tset/elf_nextscn/nextscn.m4378
-rw-r--r--test/libelf/tset/elf_rawfile/Makefile7
-rw-r--r--test/libelf/tset/elf_rawfile/rawfile.m4154
-rw-r--r--test/libelf/tset/elf_strptr/Makefile8
-rw-r--r--test/libelf/tset/elf_strptr/strptr.m4363
-rw-r--r--test/libelf/tset/elf_update/Makefile8
-rw-r--r--test/libelf/tset/elf_update/update.m42308
-rw-r--r--test/libelf/tset/elf_version/Makefile7
-rw-r--r--test/libelf/tset/elf_version/version.m4185
-rw-r--r--test/libelf/tset/gelf_getclass/Makefile8
-rw-r--r--test/libelf/tset/gelf_getclass/getclass.m487
-rw-r--r--test/libelf/tset/gelf_getehdr/Makefile8
-rw-r--r--test/libelf/tset/gelf_getehdr/ehdr.m4282
-rw-r--r--test/libelf/tset/gelf_newehdr/Makefile8
-rw-r--r--test/libelf/tset/gelf_newehdr/ehdr.m4470
-rw-r--r--test/libelf/tset/gelf_xlate/Makefile8
-rw-r--r--test/libelf/tset/gelf_xlate/xlate.m41356
-rw-r--r--test/libelftc/Makefile36
-rw-r--r--test/libelftc/tet_scen8
-rw-r--r--test/libelftc/tetbuild.cfg5
-rw-r--r--test/libelftc/tetclean.cfg7
-rw-r--r--test/libelftc/tetexec.cfg3
-rw-r--r--test/libelftc/tset/Makefile7
-rw-r--r--test/libelftc/tset/Makefile.tset10
-rw-r--r--test/libelftc/tset/elftc_string_table/Makefile9
-rw-r--r--test/libelftc/tset/elftc_string_table/string_table.m4983
-rw-r--r--test/libelftc/tset/elftc_version/Makefile7
-rw-r--r--test/libelftc/tset/elftc_version/elftc_version.m4142
-rw-r--r--test/nm/Makefile36
-rw-r--r--test/nm/tet_code15
-rw-r--r--test/nm/tet_scen55
-rw-r--r--test/nm/tetbuild.cfg4
-rw-r--r--test/nm/tetclean.cfg6
-rw-r--r--test/nm/tetexec.cfg2
-rw-r--r--test/nm/ts/Makefile12
-rw-r--r--test/nm/ts/Makefile.tset24
-rwxr-xr-xtest/nm/ts/common/func.sh304
-rw-r--r--test/nm/ts/common/test_nm.c343
-rw-r--r--test/nm/ts/cpp_demangle/Makefile25
-rw-r--r--test/nm/ts/cpp_demangle/cpp_demangle-tc.c170
-rw-r--r--test/nm/ts/cpp_demangle_ARM/Makefile24
-rw-r--r--test/nm/ts/cpp_demangle_ARM/cpp_demangle_ARM-tc.c151
-rw-r--r--test/nm/ts/cpp_demangle_gnu2/Makefile24
-rw-r--r--test/nm/ts/cpp_demangle_gnu2/cpp_demangle_gnu2-tc.c172
-rw-r--r--test/nm/ts/nm_archive1/Makefile7
-rwxr-xr-xtest/nm/ts/nm_archive1/tc.sh198
-rw-r--r--test/nm/ts/nm_archive1/test_ar-dynamic.txt8
-rw-r--r--test/nm/ts/nm_archive1/test_ar-external.txt48
-rw-r--r--test/nm/ts/nm_archive1/test_ar-format-bsd.txt54
-rw-r--r--test/nm/ts/nm_archive1/test_ar-format-posix.txt50
-rw-r--r--test/nm/ts/nm_archive1/test_ar-print-file-name.txt46
-rw-r--r--test/nm/ts/nm_archive1/test_ar-print-size.txt54
-rw-r--r--test/nm/ts/nm_archive1/test_ar-radix-hexa.txt54
-rw-r--r--test/nm/ts/nm_archive1/test_ar-radix-octal.txt54
-rw-r--r--test/nm/ts/nm_archive1/test_ar-size-sort.txt29
-rw-r--r--test/nm/ts/nm_archive1/test_ar-sort-no.txt54
-rw-r--r--test/nm/ts/nm_archive1/test_ar-sort-num.txt54
-rw-r--r--test/nm/ts/nm_archive1/test_ar-sort-reverse-no.txt54
-rw-r--r--test/nm/ts/nm_archive1/test_ar-sort-reverse-num.txt54
-rw-r--r--test/nm/ts/nm_archive1/test_ar-sort-reverse-size.txt29
-rw-r--r--test/nm/ts/nm_archive1/test_ar-sort-reverse.txt54
-rw-r--r--test/nm/ts/nm_archive1/test_ar-sysv.txt70
-rw-r--r--test/nm/ts/nm_archive1/test_ar-undef.txt33
-rw-r--r--test/nm/ts/nm_archive1/test_ar.uu356
-rw-r--r--test/nm/ts/nm_archive2/Makefile7
-rwxr-xr-xtest/nm/ts/nm_archive2/tc.sh198
-rw-r--r--test/nm/ts/nm_archive2/test_ar-dynamic.txt8
-rw-r--r--test/nm/ts/nm_archive2/test_ar-external.txt83
-rw-r--r--test/nm/ts/nm_archive2/test_ar-format-bsd.txt89
-rw-r--r--test/nm/ts/nm_archive2/test_ar-format-posix.txt85
-rw-r--r--test/nm/ts/nm_archive2/test_ar-format-sysv.txt105
-rw-r--r--test/nm/ts/nm_archive2/test_ar-print-file-name.txt81
-rw-r--r--test/nm/ts/nm_archive2/test_ar-print-size.txt89
-rw-r--r--test/nm/ts/nm_archive2/test_ar-radix-hexa.txt89
-rw-r--r--test/nm/ts/nm_archive2/test_ar-radix-octal.txt89
-rw-r--r--test/nm/ts/nm_archive2/test_ar-reverse.txt89
-rw-r--r--test/nm/ts/nm_archive2/test_ar-sort-no.txt89
-rw-r--r--test/nm/ts/nm_archive2/test_ar-sort-num.txt89
-rw-r--r--test/nm/ts/nm_archive2/test_ar-sort-reverse-no.txt89
-rw-r--r--test/nm/ts/nm_archive2/test_ar-sort-reverse-num.txt89
-rw-r--r--test/nm/ts/nm_archive2/test_ar-sort-reverse-size.txt60
-rw-r--r--test/nm/ts/nm_archive2/test_ar-sort-size.txt60
-rw-r--r--test/nm/ts/nm_archive2/test_ar-undef.txt37
-rw-r--r--test/nm/ts/nm_archive2/test_ar.uu484
-rw-r--r--test/nm/ts/nm_debug/Makefile7
-rwxr-xr-xtest/nm/ts/nm_debug/tc.sh36
-rw-r--r--test/nm/ts/nm_debug/test_obj-debug-syms.txt69
-rw-r--r--test/nm/ts/nm_debug/test_obj.uu1115
-rw-r--r--test/nm/ts/nm_object1/Makefile7
-rwxr-xr-xtest/nm/ts/nm_object1/tc.sh198
-rw-r--r--test/nm/ts/nm_object1/test_obj-dynamic.txt43
-rw-r--r--test/nm/ts/nm_object1/test_obj-external.txt60
-rw-r--r--test/nm/ts/nm_object1/test_obj-format-bsd.txt77
-rw-r--r--test/nm/ts/nm_object1/test_obj-format-posix.txt77
-rw-r--r--test/nm/ts/nm_object1/test_obj-format-sysv.txt83
-rw-r--r--test/nm/ts/nm_object1/test_obj-print-file-name.txt77
-rw-r--r--test/nm/ts/nm_object1/test_obj-print-size.txt77
-rw-r--r--test/nm/ts/nm_object1/test_obj-radix-hexa.txt77
-rw-r--r--test/nm/ts/nm_object1/test_obj-radix-octal.txt77
-rw-r--r--test/nm/ts/nm_object1/test_obj-sort-no.txt77
-rw-r--r--test/nm/ts/nm_object1/test_obj-sort-num.txt77
-rw-r--r--test/nm/ts/nm_object1/test_obj-sort-reverse-no.txt77
-rw-r--r--test/nm/ts/nm_object1/test_obj-sort-reverse-num.txt77
-rw-r--r--test/nm/ts/nm_object1/test_obj-sort-reverse-size.txt25
-rw-r--r--test/nm/ts/nm_object1/test_obj-sort-reverse.txt77
-rw-r--r--test/nm/ts/nm_object1/test_obj-sort-size.txt25
-rw-r--r--test/nm/ts/nm_object1/test_obj-undef.txt33
-rw-r--r--test/nm/ts/nm_object1/test_obj.uu351
-rw-r--r--test/nm/ts/nm_object2/Makefile7
-rwxr-xr-xtest/nm/ts/nm_object2/tc.sh198
-rw-r--r--test/nm/ts/nm_object2/test_obj-dynamic.txt17
-rw-r--r--test/nm/ts/nm_object2/test_obj-external.txt27
-rw-r--r--test/nm/ts/nm_object2/test_obj-format-bsd.txt45
-rw-r--r--test/nm/ts/nm_object2/test_obj-format-posix.txt45
-rw-r--r--test/nm/ts/nm_object2/test_obj-format-sysv.txt51
-rw-r--r--test/nm/ts/nm_object2/test_obj-print-file-name.txt45
-rw-r--r--test/nm/ts/nm_object2/test_obj-print-size.txt45
-rw-r--r--test/nm/ts/nm_object2/test_obj-radix-hexa.txt45
-rw-r--r--test/nm/ts/nm_object2/test_obj-radix-octal.txt45
-rw-r--r--test/nm/ts/nm_object2/test_obj-sort-no.txt45
-rw-r--r--test/nm/ts/nm_object2/test_obj-sort-num.txt45
-rw-r--r--test/nm/ts/nm_object2/test_obj-sort-reverse-no.txt45
-rw-r--r--test/nm/ts/nm_object2/test_obj-sort-reverse-num.txt45
-rw-r--r--test/nm/ts/nm_object2/test_obj-sort-reverse-size.txt13
-rw-r--r--test/nm/ts/nm_object2/test_obj-sort-reverse.txt45
-rw-r--r--test/nm/ts/nm_object2/test_obj-sort-size.txt13
-rw-r--r--test/nm/ts/nm_object2/test_obj-undef.txt13
-rw-r--r--test/nm/ts/nm_object2/test_obj.uu235
-rw-r--r--test/nm/ts/nm_option/Makefile5
-rwxr-xr-xtest/nm/ts/nm_option/tc.sh57
-rw-r--r--test/nm/ts/nm_shared_object1/Makefile7
-rwxr-xr-xtest/nm/ts/nm_shared_object1/tc.sh198
-rw-r--r--test/nm/ts/nm_shared_object1/test_so-dynamic.txt38
-rw-r--r--test/nm/ts/nm_shared_object1/test_so-external.txt38
-rw-r--r--test/nm/ts/nm_shared_object1/test_so-format-bsd.txt39
-rw-r--r--test/nm/ts/nm_shared_object1/test_so-format-posix.txt39
-rw-r--r--test/nm/ts/nm_shared_object1/test_so-format-sysv.txt45
-rw-r--r--test/nm/ts/nm_shared_object1/test_so-print-file-name.txt39
-rw-r--r--test/nm/ts/nm_shared_object1/test_so-print-size.txt39
-rw-r--r--test/nm/ts/nm_shared_object1/test_so-radix-hexa.txt39
-rw-r--r--test/nm/ts/nm_shared_object1/test_so-radix-octal.txt39
-rw-r--r--test/nm/ts/nm_shared_object1/test_so-sort-no.txt39
-rw-r--r--test/nm/ts/nm_shared_object1/test_so-sort-num.txt39
-rw-r--r--test/nm/ts/nm_shared_object1/test_so-sort-reverse-no.txt39
-rw-r--r--test/nm/ts/nm_shared_object1/test_so-sort-reverse-num.txt39
-rw-r--r--test/nm/ts/nm_shared_object1/test_so-sort-reverse-size.txt13
-rw-r--r--test/nm/ts/nm_shared_object1/test_so-sort-reverse.txt39
-rw-r--r--test/nm/ts/nm_shared_object1/test_so-sort-size.txt13
-rw-r--r--test/nm/ts/nm_shared_object1/test_so-undef.txt18
-rw-r--r--test/nm/ts/nm_shared_object1/test_so.uu315
-rw-r--r--test/nm/ts/nm_shared_object2/Makefile7
-rwxr-xr-xtest/nm/ts/nm_shared_object2/tc.sh198
-rw-r--r--test/nm/ts/nm_shared_object2/test_ko-dynamic.txt0
-rw-r--r--test/nm/ts/nm_shared_object2/test_ko-external.txt30
-rw-r--r--test/nm/ts/nm_shared_object2/test_ko-format-bsd.txt81
-rw-r--r--test/nm/ts/nm_shared_object2/test_ko-format-posix.txt81
-rw-r--r--test/nm/ts/nm_shared_object2/test_ko-format-sysv.txt87
-rw-r--r--test/nm/ts/nm_shared_object2/test_ko-print-file-name.txt81
-rw-r--r--test/nm/ts/nm_shared_object2/test_ko-print-size.txt81
-rw-r--r--test/nm/ts/nm_shared_object2/test_ko-radix-hexa.txt81
-rw-r--r--test/nm/ts/nm_shared_object2/test_ko-radix-octal.txt81
-rw-r--r--test/nm/ts/nm_shared_object2/test_ko-sort-no.txt81
-rw-r--r--test/nm/ts/nm_shared_object2/test_ko-sort-num.txt81
-rw-r--r--test/nm/ts/nm_shared_object2/test_ko-sort-reverse-no.txt81
-rw-r--r--test/nm/ts/nm_shared_object2/test_ko-sort-reverse-num.txt81
-rw-r--r--test/nm/ts/nm_shared_object2/test_ko-sort-reverse-size.txt51
-rw-r--r--test/nm/ts/nm_shared_object2/test_ko-sort-reverse.txt81
-rw-r--r--test/nm/ts/nm_shared_object2/test_ko-sort-size.txt51
-rw-r--r--test/nm/ts/nm_shared_object2/test_ko-undef.txt30
-rw-r--r--test/nm/ts/nm_shared_object2/test_ko.uu330
-rw-r--r--test/nm/ts/vector_str/Makefile20
-rw-r--r--test/nm/ts/vector_str/vector_str-tc.c392
-rw-r--r--test/tet/Makefile64
-rwxr-xr-xtest/tet/bin/munge-ts168
-rw-r--r--test/tet/common/elfts.m480
-rw-r--r--test/tet/patches/configure.patch13
-rw-r--r--test/tet/patches/defines.linux.patch13
-rw-r--r--test/tet/patches/guessos.patch15
-rw-r--r--tools/Makefile14
-rw-r--r--tools/build-automation/Makefile82
-rw-r--r--tools/build-automation/Makefile.documentation12
-rw-r--r--tools/build-automation/Makefile.manuals7
-rw-r--r--tools/build-automation/Makefile.program18
-rw-r--r--tools/build-automation/README13
-rw-r--r--tools/build-automation/build-system.post.nw19
-rw-r--r--tools/build-automation/build-system.pre.nw189
-rw-r--r--tools/build-automation/implementation.nw89
-rw-r--r--tools/build-automation/introduction.nw82
-rw-r--r--tools/build-automation/master.nw13
-rw-r--r--tools/build-automation/slave.nw340
-rw-r--r--tools/build-automation/userguide.nw80
-rw-r--r--tools/build-automation/utilities.nw38
-rw-r--r--tools/build-automation/yabs-slave.1102
-rw-r--r--tools/build-automation/yabs.1117
1811 files changed, 352024 insertions, 0 deletions
diff --git a/GNUmakefile b/GNUmakefile
new file mode 100644
index 000000000000..b6c1472aa830
--- /dev/null
+++ b/GNUmakefile
@@ -0,0 +1,22 @@
+# -*- mode: makefile; -*-
+#
+# Issue a useful error message if a user tries to build the project
+# using GNU make.
+
+all:
+ $(error ERROR: This source tree needs to be built with BSD 'make'.)
+
+# Some GNU/Linux distributions offer pre-built packages of BSD 'make':
+#
+# - On Debian-derived distributions, the "pmake" package provides an
+# older version of BSD 'make' that should suffice.
+# - On Fedora, the 'bmake' package seems appropriate (untested).
+#
+# Portable source code for NetBSD 'make' may be found at:
+# http://www.crufty.net/help/sjg/bmake.html
+#
+#
+# Please also read the file "INSTALL" for additional information about
+# building the project from source.
+#
+# $Id: GNUmakefile 2568 2012-09-04 12:13:21Z jkoshy $
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 000000000000..bd8d294d00af
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,283 @@
+Installation Instructions
+=========================
+
+This file contains instructions on building and installing the
+libraries and utilities in the elftoolchain project's sources.
+
+Supported Operating Systems
+---------------------------
+
+The source tree is currently built and tested on the following
+operating systems.
+
+ ================= ======== =======================
+ Operating System Version Supported Architectures
+ ----------------- -------- -----------------------
+ `DragonFly BSD`_ 2.10.1 i386
+ FreeBSD_ v8.2 amd64 & i386
+ Minix_ 3.0.2 i386
+ NetBSD_ v5.0.2 i386
+ OpenBSD_ v5.0 i386
+ Ubuntu_ GNU/Linux 10.04LTS i386 & x86_64
+ ================= ======== =======================
+
+.. _DragonFly BSD: http://www.dragonflybsd.org/
+.. _FreeBSD: http://www.freebsd.org/
+.. _Minix: http://www.minix3.org/
+.. _NetBSD: http://www.netbsd.org/
+.. _OpenBSD: http://www.openbsd.org/
+.. _Ubuntu: http://www.ubuntu.com/
+
+Building the Source Tree
+========================
+
+The core libraries and utilities that make up the software release are
+always built by default. Builds of the project's test suites (in the
+``test/`` subdirectory), and of additional documentation (in the
+directory ``documentation/``) are optional and will only be attempted
+if these directories are present.
+
+Prerequisites
+-------------
+
+:DragonFly BSD 2.10.1:
+ - The core libraries and utilities should build out of the box on
+ a stock install of DragonFly BSD.
+
+ - To build and run the test suite:
+
+ #. The current release of the `Test Execution Toolkit`_ needs to
+ be downloaded and unpacked into the ``test/tet/`` directory.
+
+ #. The ``py26-yaml`` package needs to be installed::
+
+ % sudo pkgin install py26-yaml
+
+ - Building additional documentation is not currently supported
+ under DragonFly BSD.
+
+:FreeBSD 8.2:
+ - The core libraries and utilities should build out of the box on
+ a stock install of FreeBSD.
+
+ - To build and run the test suite:
+
+ #. The current release of the `Test Execution Toolkit`_ needs to
+ be downloaded and unpacked into the ``test/tet/`` directory.
+
+ #. The ``py-yaml`` package needs to be installed::
+
+ % sudo pkg_add -r py-yaml
+
+ - To build additional documentation, the ``latex-pgf`` package is
+ needed::
+
+ % sudo pkg_add -r latex-pgf
+
+:Minix 3.2.0:
+ - The following packages are pre-requisites for building the
+ sources on Minix 3.2.0:
+
+ =================== =====================================
+ **Package** **Description**
+ =================== =====================================
+ ``gcc44`` The GNU C compiler.
+ =================== =====================================
+
+ The following command line may be used to install the necessary
+ pre-requisites::
+
+ # pkgin install gcc44
+
+ - The test suites cannot currently be built under Minix.
+
+ - Building additional documentation is not currently supported
+ under Minix.
+
+:OpenBSD 5.0:
+ - The following packages are pre-requisites for building the
+ sources on OpenBSD 5.0:
+
+ =================== =====================================
+ **Package** **Description**
+ =================== =====================================
+ ``libarchive`` An archive access library.
+ =================== =====================================
+
+ The following command line may be used to install the necessary
+ pre-requisites::
+
+ # pkg_add libarchive-2.8.4p0
+
+ - The test suites cannot currently be built under OpenBSD.
+
+ - Building additional documentation is not currently supported
+ under OpenBSD.
+
+:NetBSD 5.0.2:
+ - The core libraries and utilities should build out of the box
+ on a stock install of NetBSD.
+
+ - To build and run the test suite:
+
+ #. The current release of the `Test Execution Toolkit`_, needs
+ to be downloaded and unpacked into the ``test/tet/``
+ directory.
+
+ #. The following additional package needs to be installed, as
+ listed in the example command line below ::
+
+ % sudo pkg_add py26-yaml
+
+ - Building additional documentation is not currently supported
+ under NetBSD.
+
+:Ubuntu GNU/Linux 10.04:
+ - The following packages are pre-requisites for building the
+ sources on Ubuntu GNU/Linux 10.04:
+
+ =================== =====================================
+ **Package** **Description**
+ =================== =====================================
+ ``binutils`` Needed for the build.
+ ``bison`` Parser generator.
+ ``flex`` Lexical analyser.
+ ``gcc`` C compiler.
+ ``libarchive-dev`` Archive access library.
+ ``libc6-dev`` Files for C language development.
+ ``libexpat1-dev`` An XML processing library.
+ ``m4`` Macro processor.
+ ``pmake`` A ``make`` that uses BSD-make syntax.
+ ``python-yaml`` A YAML library for Python.
+ ``sharutils`` For ``uudecode``.
+ =================== =====================================
+
+ The following command line may be used to install the necessary
+ pre-requisites::
+
+ % sudo apt-get install binutils bison flex gcc libarchive-dev \
+ libc6-dev m4 pmake
+
+ - To build and run the test suite:
+
+ #. The current release of the `Test Execution Toolkit`_, needs
+ to be downloaded and unpacked into the ``test/tet/``
+ directory.
+
+ #. The following additional packages need to be installed, as
+ listed in the example command line below::
+
+ % sudo apt-get install libexpat1-dev python-yaml sharutils
+
+ - To build additional documentation, the ``pgf`` package is
+ needed::
+
+ % sudo apt-get install pgf
+
+:Ubuntu GNU/Linux 11.10:
+ - The following packages are pre-requisites for building the
+ sources on Ubuntu GNU/Linux 11.10:
+
+ =================== =====================================
+ **Package** **Description**
+ =================== =====================================
+ ``bison`` Parser generator.
+ ``flex`` Lexical analyser.
+ ``gcc`` C compiler.
+ ``libarchive-dev`` Archive access library.
+ ``libexpat1-dev`` An XML processing library.
+ ``m4`` Macro processor.
+ ``pmake`` A ``make`` that uses BSD-make syntax.
+ ``python-yaml`` A YAML library for Python.
+ ``sharutils`` For ``uudecode``.
+ =================== =====================================
+
+ The following command line may be used to install the necessary
+ pre-requisites::
+
+ % sudo apt-get install bison flex gcc libarchive-dev \
+ m4 pmake
+
+ - To build and run the test suite:
+
+ #. The current release of the `Test Execution Toolkit`_, needs
+ to be downloaded and unpacked into the ``test/tet/``
+ directory.
+
+ #. The following additional packages need to be installed, as
+ listed in the example command line below::
+
+ % sudo apt-get install libexpat1-dev python-yaml sharutils
+
+ - Builds of additional documentation are not currently supported
+ under Ubuntu GNU/Linux 11.10.
+
+.. _Test Execution Toolkit: http://tetworks.opengroup.org/
+.. _OpenGroup: http://www.opengroup.org/
+
+
+Building the software
+---------------------
+
+The software may be built by running **make**.
+
+On `DragonFly BSD`_, FreeBSD_, Minix_, NetBSD_ and OpenBSD_, use::
+
+ % make
+
+On Ubuntu GNU/Linux with the **pmake** package installed, use::
+
+ % pmake
+
+
+Testing the software
+---------------------
+
+The ``run-tests`` target in the top-level Makefile will build and
+execute the test suites that are part of this software.
+
+On `DragonFly BSD`_, FreeBSD_ and NetBSD_, use::
+
+ % make run-tests
+
+On Ubuntu GNU/Linux with the **pmake** package installed, use::
+
+ % pmake run-tests
+
+Installing the Software
+=======================
+
+The software may be installed using the ``install`` target.
+
+On `DragonFly BSD`_, FreeBSD_, Minix_, NetBSD_ and OpenBSD_ use::
+
+ % make install
+
+On Ubuntu GNU/Linux with the **pmake** package installed, use::
+
+ % pmake install
+
+
+By default the ``install`` target will install utilities into
+``/usr/bin/``, libraries into ``/usr/lib/`` and manual pages into
+``/usr/share/man/man[0-9]/``.
+
+The installation directory may be changed using the ``DESTDIR``
+variable. For example::
+
+ % pmake DESTDIR=$HOME/local install
+
+
+Additional Information
+======================
+
+Additional information about the project may be found on the `project
+website`_.
+
+.. _project website: http://elftoolchain.sourceforge.net/
+
+.. $Id: INSTALL 2777 2012-12-12 17:21:36Z jkoshy $
+
+.. Local Variables:
+.. mode: rst
+.. End:
diff --git a/Makefile b/Makefile
new file mode 100644
index 000000000000..64d2a444fc62
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,54 @@
+# $Id: Makefile 2872 2013-01-07 13:57:54Z jkoshy $
+
+TOP= .
+
+.include "${TOP}/mk/elftoolchain.os.mk"
+
+# Build configuration information first.
+SUBDIR += common
+
+# Build the base libraries next.
+SUBDIR += libelf
+SUBDIR += libdwarf
+
+# Build additional APIs.
+SUBDIR += libelftc
+
+# Build the tools needed for the rest of the build.
+SUBDIR += isa
+
+# Build tools after the libraries.
+SUBDIR += addr2line
+SUBDIR += ar
+SUBDIR += brandelf
+SUBDIR += cxxfilt
+SUBDIR += elfcopy
+SUBDIR += elfdump
+SUBDIR += findtextrel
+SUBDIR += nm
+SUBDIR += readelf
+SUBDIR += size
+SUBDIR += strings
+SUBDIR += tools
+
+# Build the test suites.
+.if exists(${.CURDIR}/test) && defined(MKTESTS) && ${MKTESTS} == "yes"
+SUBDIR += test
+.endif
+
+# Build documentation at the end.
+.if exists(${.CURDIR}/documentation) && defined(MKDOC) && ${MKDOC} == "yes"
+SUBDIR += documentation
+.endif
+
+.include "${TOP}/mk/elftoolchain.subdir.mk"
+
+#
+# Special top-level targets.
+#
+
+# Run the test suites.
+.if exists(${.CURDIR}/test) && defined(MKTESTS) && ${MKTESTS} == "yes"
+run-tests: all .PHONY
+ (cd ${.CURDIR}/test; ${MAKE} test)
+.endif
diff --git a/README b/README
new file mode 100644
index 000000000000..c9ab072b76ad
--- /dev/null
+++ b/README
@@ -0,0 +1,127 @@
+The Elftoolchain Project
+========================
+
+.. contents::
+..
+
+Description
+-----------
+
+This software implements essential compilation tools and libraries for:
+
+- managing program objects conforming to the ELF_ object format, and
+- for managing DWARF_ debugging information in ELF objects.
+
+The project currently implements the following utilities and
+libraries:
+
+ =========== ============================================
+ Name Description
+ =========== ============================================
+ ar Archive manager.
+ addr2line Debug tool.
+ brandelf Manage the ELF brand on executables.
+ c++filt Translate encoded symbols.
+ elfcopy Copy and translate between object formats.
+ elfdump Diagnostic tool.
+ findtextrel Find undesired text relocations.
+ libdwarf DWARF access library.
+ libelf ELF access library.
+ mcs Manage comment sections.
+ nm List symbols in an ELF object.
+ ranlib Add archive symbol tables to an archive.
+ readelf Display ELF information.
+ size List object sizes.
+ strings Extract printable strings.
+ strip Discard information from ELF objects.
+ =========== ============================================
+
+.. _ELF: http://en.wikipedia.org/wiki/Executable_and_Linkable_Format
+.. _DWARF: http://www.dwarfstd.org/
+
+
+Project Documentation
+---------------------
+
+- Release notes for released versions of this software are present in
+ the file ``RELEASE-NOTES`` in the current directory.
+- The file ``INSTALL`` in the current directory contains instructions
+ on building and installing this software.
+- Reference documentation in the form of manual pages is provided for
+ the utilities and libraries developed by the project.
+- Additional tutorial documentation is present in the
+ ``documentation`` directory.
+
+
+Tracking Ongoing Development
+----------------------------
+
+The project uses subversion_ for its version control system.
+
+The subversion branch for the current set of sources may be accessed
+at the following URL:
+
+ https://elftoolchain.svn.sourceforge.net/svnroot/elftoolchain/trunk
+
+The project's source tree may be checked out from its repository by
+using the ``svn checkout`` command::
+
+ % svn checkout https://elftoolchain.svn.sourceforge.net/svnroot/elftoolchain/trunk
+
+Checked-out sources may be kept upto-date by running ``svn update``
+inside the source directory::
+
+ % svn update
+
+
+Instructions on building and installing the software are given in the
+file ``INSTALL`` in the current directory.
+
+.. _Subversion:
+
+Downloading Released Software
+-----------------------------
+
+Released versions of the project's software may also be downloaded
+from SourceForge's `file release system`_.
+
+.. _file release system: http://sourceforge.net/projects/elftoolchain/files/
+
+Copyright and License
+---------------------
+
+This code is copyright its authors, and is distributed under the `BSD
+License`_.
+
+.. _BSD License: http://www.opensource.org/licenses/bsd-license.php
+
+
+Developer Community
+-------------------
+
+The project's developers may be contacted using the mailing list:
+``<elftoolchain-developers@lists.sourceforge.net>``.
+
+
+Reporting Bugs
+--------------
+
+Please use our `Trac instance`_ for viewing existing bug reports and
+for submitting new bug reports.
+
+.. _`Trac instance`: http://sourceforge.net/apps/trac/elftoolchain/report
+
+
+Additional Information
+----------------------
+
+Additional information about the project may be found on the `project
+website`_.
+
+.. _project website: http://elftoolchain.sourceforge.net/
+
+.. $Id: README 2146 2011-11-11 09:39:00Z jkoshy $
+
+.. Local Variables:
+.. mode: rst
+.. End:
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
new file mode 100644
index 000000000000..37e45bdfe303
--- /dev/null
+++ b/RELEASE-NOTES
@@ -0,0 +1,206 @@
+.. $Id: RELEASE-NOTES 2599 2012-09-25 06:25:51Z jkoshy $
+
+.. This file contains a template for use when writing release notes.
+.. It needs to be updated with release-specific content prior to
+.. cutting a release. RST comments (such as this one) also need to be
+.. removed prior to the release.
+
+.. The tokens '%.*%' need be replaced with actual content.
+
+Release Notes for Elftoolchain Software Version %.%.%
+=====================================================
+
+About The Project
+-----------------
+
+The `Elftoolchain project`_ develops BSD-licensed implementations of
+essential compilation tools and libraries for handling ELF based program
+objects.
+
+About The Release
+-----------------
+
+.. Describe the rationale for the release (e.g. new features,
+.. significant bug fixes, etc.).
+
+Libraries and Utilities
+~~~~~~~~~~~~~~~~~~~~~~~
+
+This release comprises the following libraries and utilities.
+
+ ================= ==========================================
+ **Name** **Description**
+ ================= ==========================================
+ **ar** Archive manager.
+ **addr2line** Debug tool.
+ **brandelf** Manage the ELF brand on executables.
+ **c++filt** Translate encoded symbols.
+ **elfcopy** Copy and translate between object formats.
+ **elfdump** Diagnostic tool.
+ **findtextrel** Find undesired text relocations.
+ **libdwarf** DWARF access library.
+ **libelf** ELF access library.
+ **mcs** Manage comment sections.
+ **nm** List symbols in an ELF object.
+ **ranlib** Add archive symbol tables to an archive.
+ **readelf** Display ELF information.
+ **size** List object sizes.
+ **strings** Extract printable strings.
+ **strip** Discard information from ELF objects.
+ ================= ==========================================
+
+Documentation
+~~~~~~~~~~~~~
+
+Each public API and invocable utility has a reference manual entry.
+We currently offer %NENTRIES% manual entries, documented in %NFILES%
+manual pages.
+
+Additionally, this release contains the following documentation:
+
+ ================= ==========================================
+ **Name** **Description**
+ ================= ==========================================
+ libelf-by-example A tutorial introduction to **libelf**.
+ ================= ==========================================
+
+Test Suites
+~~~~~~~~~~~
+
+The release contains the following test suites:
+
+ ================= ==========================================
+ **Name** **Description**
+ ================= ==========================================
+ ar Test the **ar** utility.
+ elfcopy Test the **elfcopy** utility.
+ elfdump Test the **elfdump** utility.
+ libdwarf Test the **libdwarf** library.
+ libelf Test the **libelf** library.
+ nm Test the **nm** utility.
+ ================= ==========================================
+
+
+System Requirements
+-------------------
+
+.. Hardware and software requirements for using this software.
+
+This software is designed to run on Unix(TM)-like operating systems
+such as the BSD-family of operating systems and GNU/Linux.
+
+This release has been built and tested on the following operating
+systems:
+
+ ==================== =========== ===========================
+ **Operating System** **Version** **Supported Architectures**
+ -------------------- ----------- ---------------------------
+ `DragonFly BSD`_ 2.10.1 i386
+ FreeBSD_ v8.2 amd64 & i386
+ Minix_ 3.2.0 i386
+ NetBSD_ v5.0.2 i386
+ OpenBSD_ v5.0 i386
+ Ubuntu_ GNU/Linux 10.04LTS i386 & x86_64
+ ==================== =========== ===========================
+
+
+Installation and Upgrades
+=========================
+
+Installation
+------------
+
+Instructions for building and installing this software from source are
+described in the file "INSTALL".
+
+Upgrading
+---------
+
+.. Special notes about upgrading this software from a prior release.
+.. For example, if we introduce any backwards-incompatible behaviour,
+.. or if we deprecate existing behaviour.
+
+
+Release Information
+===================
+
+Changes in this release
+-----------------------
+
+.. A list of significant changes in the release.
+
+Outstanding Issues
+------------------
+
+.. Problems discovered when testing the release.
+
+Known Limitations
+-----------------
+
+.. Known limitations.
+
+Test Statistics
+---------------
+
+The test summary for this release is presented below:
+
+ ========= ========= ================ =============== ================ ===================
+ **Suite** **Tests** **DragonFlyBSD** **FreeBSD** **NetBSD** **Ubuntu 10.04LTS**
+ ========= ========= ================ =============== ================ ===================
+ ar
+ elfcopy
+ elfdump
+ libdwarf
+ libelf
+ nm
+ ========= ========= ================ =============== ================ ===================
+
+Key:
+
+ :P:
+ Test successes.
+ :F:
+ Test failures.
+ :U:
+ Unresolved tests.
+
+Notes
+~~~~~
+
+More Information
+================
+
+The project's website is at http://elftoolchain.sourceforge.net/.
+
+Developer Community
+-------------------
+
+The project's developers may be contacted using the mailing list:
+``<elftoolchain-developers@lists.sourceforge.net>``.
+
+Reporting Bugs
+--------------
+
+Please use our `Trac instance`_ for viewing existing bug reports and
+for submitting new bug reports.
+
+
+Copyright and License
+=====================
+
+This software is copyright its authors, and is distributed under the
+`BSD License`_.
+
+.. _BSD License: http://www.opensource.org/licenses/bsd-license.php
+.. _DragonFly BSD: http://www.dragonflybsd.org/
+.. _Elftoolchain project: http://elftoolchain.sourceforge.net/
+.. _FreeBSD: http://www.freebsd.org/
+.. _Minix: http://www.minix3.org/
+.. _NetBSD: http://www.netbsd.org/
+.. _OpenBSD: http://www.openbsd.org/
+.. _`Trac instance`: http://sourceforge.net/apps/trac/elftoolchain/report
+.. _Ubuntu: http://www.ubuntu.com/
+
+.. Local Variables:
+.. mode: rst
+.. End:
diff --git a/addr2line/Makefile b/addr2line/Makefile
new file mode 100644
index 000000000000..e388bc0a6edb
--- /dev/null
+++ b/addr2line/Makefile
@@ -0,0 +1,15 @@
+# $Id: Makefile 2066 2011-10-26 15:40:28Z jkoshy $
+
+TOP= ..
+
+PROG= addr2line
+SRCS= addr2line.c
+
+WARNS?= 6
+
+DPADD= ${LIBELF} ${LIBELFTC} ${LIBDWARF}
+LDADD= -lelftc -ldwarf -lelf
+
+MAN1= addr2line.1
+
+.include "${TOP}/mk/elftoolchain.prog.mk"
diff --git a/addr2line/addr2line.1 b/addr2line/addr2line.1
new file mode 100644
index 000000000000..98edda50fb13
--- /dev/null
+++ b/addr2line/addr2line.1
@@ -0,0 +1,159 @@
+.\" Copyright (c) 2009,2010 Joseph Koshy <jkoshy@users.sourceforge.net>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer
+.\" in this position and unchanged.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $Id: addr2line.1 2066 2011-10-26 15:40:28Z jkoshy $
+.\"
+.Dd July 25, 2010
+.Os
+.Dt ADDR2LINE 1
+.Sh NAME
+.Nm addr2line
+.Nd translate program addresses to source file names and line numbers
+.Sh SYNOPSIS
+.Nm
+.Op Fl b Ar target | Fl -target Ns = Ns Ar target
+.Op Fl e Ar pathname | Fl -exe Ns = Ns Ar pathname
+.Op Fl f | Fl -functions
+.Op Fl j Ar sectionname | Fl -section Ns = Ns Ar sectionname
+.Op Fl s | Fl -basename
+.Op Fl C | Fl -demangle
+.Op Fl H | Fl -help
+.Op Fl V | Fl -version
+.Op Ar hexaddress Ns ...
+.Sh DESCRIPTION
+The
+.Nm
+utility translates program addresses specified by the command line
+arguments
+.Ar hexaddress
+to their corresponding source file names and line numbers.
+If no arguments are given to
+.Nm ,
+it will read these addresses from standard input.
+.Pp
+Program addresses specified by arguments
+.Ar hexaddress
+are encoded using the conventions accepted by
+.Xr strtoull 3 .
+.Pp
+By default,
+.Nm
+will use the executable
+.Dq Pa a.out .
+The
+.Fl e
+option may be used to specified a different ELF object.
+.Pp
+The
+.Nm
+utility recognizes the following options:
+.Bl -tag -width indent
+.It Fl b Ar target | Fl -target Ns = Ns Ar target
+This option is recognized by
+.Nm
+but is ignored.
+It is supported for compatibility with GNU binutils.
+.It Fl e Ar pathname | Fl -exe Ns = Ns Ar pathname
+Use the ELF object specified by argument
+.Ar pathname
+to translate addresses.
+If this option is not specified,
+.Nm
+will use the file
+.Dq Pa a.out .
+.It Fl f | Fl -functions
+Display function names in addition to file and line number information.
+.It Fl j Ar sectionname | Fl -section Ns = Ns Ar sectionname
+The values specified by arguments
+.Ar hexaddress
+are to be treated as offsets into the section named
+.Ar sectionname .
+.It Fl s | -basename
+Display only the base name for each file name.
+.It Fl C | Fl -demangle
+Demangle C++ names.
+.It Fl H | Fl -help
+Print a help message.
+.It Fl V | Fl -version
+Print a version identifier and exit.
+.El
+.Sh OUTPUT FORMAT
+If the
+.Fl f
+option was not specified,
+.Nm
+will print the file name and line number for each address specified
+on a separate line.
+.Pp
+If the
+.Fl f
+option was specified,
+.Nm
+will print a line containing the name of the function corresponding
+to program address
+.Ar hexaddress ,
+followed by a line with the file name and line number.
+.Pp
+The
+.Nm
+utility prints the file name and line number using the format
+.Dq FILENAME:LINENUMBER .
+.Pp
+If a file or function name could not be determined,
+.Nm
+will print a question mark in their place.
+If the line number could not be determined,
+.Nm
+will print a zero in its place.
+.Sh EXAMPLES
+To map address 080483c4 in the default executable
+.Pa a.out
+to a source file name and line number use:
+.D1 "% addr2line 080483c4"
+.Pp
+To map address 080483c4 in executable
+.Pa helloworld ,
+use:
+.D1 "% addr2line -e helloworld 080483c4"
+.Pp
+To have
+.Nm
+act as a filter reading addresses from its standard input use:
+.D1 "% addr2line"
+.Pp
+To print the function name corresponding to an address in addition to
+its source file and line number use:
+.D1 "% addr2line -f 080483c4"
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr nm 1 ,
+.Xr elfdump 1 ,
+.Xr elfcopy 1 ,
+.Xr strtoull 3
+.Sh AUTHORS
+The
+.Nm
+utility was written by
+.An "Kai Wang" Aq kaiwang27@users.sourceforge.net .
diff --git a/addr2line/addr2line.c b/addr2line/addr2line.c
new file mode 100644
index 000000000000..b58b4b352a47
--- /dev/null
+++ b/addr2line/addr2line.c
@@ -0,0 +1,410 @@
+/*-
+ * Copyright (c) 2009 Kai Wang
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+#include <sys/param.h>
+#include <dwarf.h>
+#include <err.h>
+#include <fcntl.h>
+#include <gelf.h>
+#include <getopt.h>
+#include <libdwarf.h>
+#include <libelftc.h>
+#include <libgen.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "_elftc.h"
+
+ELFTC_VCSID("$Id: addr2line.c 2185 2011-11-19 16:07:16Z jkoshy $");
+
+static struct option longopts[] = {
+ {"target" , required_argument, NULL, 'b'},
+ {"demangle", no_argument, NULL, 'C'},
+ {"exe", required_argument, NULL, 'e'},
+ {"functions", no_argument, NULL, 'f'},
+ {"section", required_argument, NULL, 'j'},
+ {"basename", no_argument, NULL, 's'},
+ {"help", no_argument, NULL, 'H'},
+ {"version", no_argument, NULL, 'V'},
+ {NULL, 0, NULL, 0}
+};
+static int demangle, func, base;
+static char unknown[] = { '?', '?', '\0' };
+static Dwarf_Addr section_base;
+
+#define USAGE_MESSAGE "\
+Usage: %s [options] hexaddress...\n\
+ Map program addresses to source file names and line numbers.\n\n\
+ Options:\n\
+ -b TGT | --target=TGT (Accepted but ignored).\n\
+ -e EXE | --exec=EXE Use program \"EXE\" to translate addresses.\n\
+ -f | --functions Display function names.\n\
+ -j NAME | --section=NAME Values are offsets into section \"NAME\".\n\
+ -s | --basename Only show the base name for each file name.\n\
+ -C | --demangle Demangle C++ names.\n\
+ -H | --help Print a help message.\n\
+ -V | --version Print a version identifier and exit.\n"
+
+static void
+usage(void)
+{
+ (void) fprintf(stderr, USAGE_MESSAGE, ELFTC_GETPROGNAME());
+ exit(1);
+}
+
+static void
+version(void)
+{
+
+ fprintf(stderr, "%s (%s)\n", ELFTC_GETPROGNAME(), elftc_version());
+ exit(0);
+}
+
+static void
+search_func(Dwarf_Debug dbg, Dwarf_Die die, Dwarf_Addr addr,
+ const char **rlt_func)
+{
+ Dwarf_Die ret_die, spec_die;
+ Dwarf_Error de;
+ Dwarf_Half tag;
+ Dwarf_Unsigned lopc, hipc;
+ Dwarf_Off ref;
+ Dwarf_Attribute sub_at, spec_at;
+ char *func0;
+ int ret;
+
+ if (*rlt_func != NULL)
+ return;
+
+ if (dwarf_tag(die, &tag, &de)) {
+ warnx("dwarf_tag: %s", dwarf_errmsg(de));
+ goto cont_search;
+ }
+ if (tag == DW_TAG_subprogram) {
+ if (dwarf_attrval_unsigned(die, DW_AT_low_pc, &lopc, &de) ||
+ dwarf_attrval_unsigned(die, DW_AT_high_pc, &hipc, &de))
+ goto cont_search;
+ if (addr < lopc || addr >= hipc)
+ goto cont_search;
+
+ /* Found it! */
+
+ *rlt_func = unknown;
+ ret = dwarf_attr(die, DW_AT_name, &sub_at, &de);
+ if (ret == DW_DLV_ERROR)
+ return;
+ if (ret == DW_DLV_OK) {
+ if (dwarf_formstring(sub_at, &func0, &de))
+ *rlt_func = unknown;
+ else
+ *rlt_func = func0;
+ return;
+ }
+
+ /*
+ * If DW_AT_name is not present, but DW_AT_specification is
+ * present, then probably the actual name is in the DIE
+ * referenced by DW_AT_specification.
+ */
+ if (dwarf_attr(die, DW_AT_specification, &spec_at, &de))
+ return;
+ if (dwarf_global_formref(spec_at, &ref, &de))
+ return;
+ if (dwarf_offdie(dbg, ref, &spec_die, &de))
+ return;
+ if (dwarf_attrval_string(spec_die, DW_AT_name, rlt_func, &de))
+ *rlt_func = unknown;
+
+ return;
+ }
+
+cont_search:
+
+ /* Search children. */
+ ret = dwarf_child(die, &ret_die, &de);
+ if (ret == DW_DLV_ERROR)
+ errx(EXIT_FAILURE, "dwarf_child: %s", dwarf_errmsg(de));
+ else if (ret == DW_DLV_OK)
+ search_func(dbg, ret_die, addr, rlt_func);
+
+ /* Search sibling. */
+ ret = dwarf_siblingof(dbg, die, &ret_die, &de);
+ if (ret == DW_DLV_ERROR)
+ errx(EXIT_FAILURE, "dwarf_siblingof: %s", dwarf_errmsg(de));
+ else if (ret == DW_DLV_OK)
+ search_func(dbg, ret_die, addr, rlt_func);
+}
+
+static void
+translate(Dwarf_Debug dbg, const char* addrstr)
+{
+ Dwarf_Die die;
+ Dwarf_Line *lbuf;
+ Dwarf_Error de;
+ Dwarf_Half tag;
+ Dwarf_Unsigned lopc, hipc, addr, lineno, plineno;
+ Dwarf_Signed lcount;
+ Dwarf_Addr lineaddr, plineaddr;
+ const char *funcname;
+ char *file, *file0, *pfile;
+ char demangled[1024];
+ int i, ret;
+
+ addr = strtoull(addrstr, NULL, 16);
+ addr += section_base;
+ lineno = 0;
+ file = unknown;
+
+ while ((ret = dwarf_next_cu_header(dbg, NULL, NULL, NULL, NULL, NULL,
+ &de)) == DW_DLV_OK) {
+ die = NULL;
+ while (dwarf_siblingof(dbg, die, &die, &de) == DW_DLV_OK) {
+ if (dwarf_tag(die, &tag, &de) != DW_DLV_OK) {
+ warnx("dwarf_tag failed: %s",
+ dwarf_errmsg(de));
+ goto out;
+ }
+ /* XXX: What about DW_TAG_partial_unit? */
+ if (tag == DW_TAG_compile_unit)
+ break;
+ }
+ if (die == NULL) {
+ warnx("could not find DW_TAG_compile_unit die");
+ goto out;
+ }
+ if (!dwarf_attrval_unsigned(die, DW_AT_low_pc, &lopc, &de) &&
+ !dwarf_attrval_unsigned(die, DW_AT_high_pc, &hipc, &de)) {
+ /*
+ * Check if the address falls into the PC range of
+ * this CU.
+ */
+ if (addr < lopc || addr >= hipc)
+ continue;
+ }
+
+ if (dwarf_srclines(die, &lbuf, &lcount, &de) != DW_DLV_OK) {
+ warnx("dwarf_srclines: %s", dwarf_errmsg(de));
+ goto out;
+ }
+
+ plineaddr = ~0ULL;
+ plineno = 0;
+ pfile = unknown;
+ for (i = 0; i < lcount; i++) {
+ if (dwarf_lineaddr(lbuf[i], &lineaddr, &de)) {
+ warnx("dwarf_lineaddr: %s",
+ dwarf_errmsg(de));
+ goto out;
+ }
+ if (dwarf_lineno(lbuf[i], &lineno, &de)) {
+ warnx("dwarf_lineno: %s",
+ dwarf_errmsg(de));
+ goto out;
+ }
+ if (dwarf_linesrc(lbuf[i], &file0, &de)) {
+ warnx("dwarf_linesrc: %s",
+ dwarf_errmsg(de));
+ } else
+ file = file0;
+ if (addr == lineaddr)
+ goto out;
+ else if (addr < lineaddr && addr > plineaddr) {
+ lineno = plineno;
+ file = pfile;
+ goto out;
+ }
+ plineaddr = lineaddr;
+ plineno = lineno;
+ pfile = file;
+ }
+ }
+
+out:
+ funcname = NULL;
+ if (ret == DW_DLV_OK && func)
+ search_func(dbg, die, addr, &funcname);
+
+ if (func) {
+ if (funcname == NULL)
+ funcname = unknown;
+ if (demangle &&
+ !elftc_demangle(funcname, demangled, sizeof(demangled), 0))
+ printf("%s\n", demangled);
+ else
+ printf("%s\n", funcname);
+ }
+
+ (void) printf("%s:%ju\n", base ? basename(file) : file, lineno);
+
+ /*
+ * Reset internal CU pointer, so we will start from the first CU
+ * next round.
+ */
+ while (ret != DW_DLV_NO_ENTRY) {
+ if (ret == DW_DLV_ERROR)
+ errx(EXIT_FAILURE, "dwarf_next_cu_header: %s",
+ dwarf_errmsg(de));
+ ret = dwarf_next_cu_header(dbg, NULL, NULL, NULL, NULL, NULL,
+ &de);
+ }
+}
+
+static void
+find_section_base(const char *exe, Elf *e, const char *section)
+{
+ Dwarf_Addr off;
+ Elf_Scn *scn;
+ GElf_Ehdr eh;
+ GElf_Shdr sh;
+ size_t shstrndx;
+ int elferr;
+ const char *name;
+
+ if (gelf_getehdr(e, &eh) != &eh) {
+ warnx("gelf_getehdr failed: %s", elf_errmsg(-1));
+ return;
+ }
+
+ if (!elf_getshstrndx(e, &shstrndx)) {
+ warnx("elf_getshstrndx failed: %s", elf_errmsg(-1));
+ return;
+ }
+
+ (void) elf_errno();
+ off = 0;
+ scn = NULL;
+ while ((scn = elf_nextscn(e, scn)) != NULL) {
+ if (gelf_getshdr(scn, &sh) == NULL) {
+ warnx("gelf_getshdr failed: %s", elf_errmsg(-1));
+ continue;
+ }
+ if ((name = elf_strptr(e, shstrndx, sh.sh_name)) == NULL)
+ goto next;
+ if (!strcmp(section, name)) {
+ if (eh.e_type == ET_EXEC || eh.e_type == ET_DYN) {
+ /*
+ * For executables, section base is the virtual
+ * address of the specified section.
+ */
+ section_base = sh.sh_addr;
+ } else if (eh.e_type == ET_REL) {
+ /*
+ * For relocatables, section base is the
+ * relative offset of the specified section
+ * to the start of the first section.
+ */
+ section_base = off;
+ } else
+ warnx("unknown e_type %u", eh.e_type);
+ return;
+ }
+ next:
+ off += sh.sh_size;
+ }
+ elferr = elf_errno();
+ if (elferr != 0)
+ warnx("elf_nextscn failed: %s", elf_errmsg(elferr));
+
+ errx(EXIT_FAILURE, "%s: cannot find section %s", exe, section);
+}
+
+int
+main(int argc, char **argv)
+{
+ Elf *e;
+ Dwarf_Debug dbg;
+ Dwarf_Error de;
+ const char *exe, *section;
+ char line[1024];
+ int fd, i, opt;
+
+ exe = NULL;
+ section = NULL;
+ while ((opt = getopt_long(argc, argv, "b:Ce:fj:sHV", longopts, NULL)) !=
+ -1) {
+ switch (opt) {
+ case 'b':
+ /* ignored */
+ break;
+ case 'C':
+ demangle = 1;
+ break;
+ case 'e':
+ exe = optarg;
+ break;
+ case 'f':
+ func = 1;
+ break;
+ case 'j':
+ section = optarg;
+ break;
+ case 's':
+ base = 1;
+ break;
+ case 'H':
+ usage();
+ case 'V':
+ version();
+ default:
+ usage();
+ }
+ }
+
+ argv += optind;
+ argc -= optind;
+
+ if (exe == NULL)
+ exe = "a.out";
+
+ if ((fd = open(exe, O_RDONLY)) < 0)
+ err(EXIT_FAILURE, "%s", exe);
+
+ if (dwarf_init(fd, DW_DLC_READ, NULL, NULL, &dbg, &de))
+ errx(EXIT_FAILURE, "dwarf_init: %s", dwarf_errmsg(de));
+
+ if (dwarf_get_elf(dbg, &e, &de) != DW_DLV_OK)
+ errx(EXIT_FAILURE, "dwarf_get_elf: %s", dwarf_errmsg(de));
+
+ if (section)
+ find_section_base(exe, e, section);
+ else
+ section_base = 0;
+
+ if (argc > 0)
+ for (i = 0; i < argc; i++)
+ translate(dbg, argv[i]);
+ else
+ while (fgets(line, sizeof(line), stdin) != NULL)
+ translate(dbg, line);
+
+ dwarf_finish(dbg, &de);
+
+ (void) elf_end(e);
+
+ exit(0);
+}
diff --git a/ar/Makefile b/ar/Makefile
new file mode 100644
index 000000000000..c20a9f7ffbd1
--- /dev/null
+++ b/ar/Makefile
@@ -0,0 +1,35 @@
+# $Id: Makefile 2741 2012-12-10 18:47:00Z jkoshy $
+
+TOP= ..
+
+PROG= ar
+SRCS= ar.c read.c util.c write.c
+LSRC= acplex.l
+YSRC= acpyacc.y
+
+WARNS?= 5
+
+DPADD= ${LIBARCHIVE} ${LIBELFTC} ${LIBELF}
+LDADD= -larchive -lelftc -lelf
+
+CFLAGS+=-I. -I${.CURDIR}
+
+LINKS= ${BINDIR}/ar ${BINDIR}/ranlib
+
+EXTRA_TARGETS= ranlib
+
+CLEANFILES+= ${EXTRA_TARGETS}
+
+MAN= ar.1 ranlib.1 ar.5
+
+all: ${EXTRA_TARGETS}
+
+${EXTRA_TARGETS}: ${PROG}
+ ln -s ${PROG} ${.TARGET}
+
+.include "${TOP}/mk/elftoolchain.prog.mk"
+
+.if ${OS_HOST} == "OpenBSD"
+CFLAGS+= -I/usr/local/include
+LDFLAGS+= -L/usr/local/lib
+.endif
diff --git a/ar/acplex.l b/ar/acplex.l
new file mode 100644
index 000000000000..3100009fbb10
--- /dev/null
+++ b/ar/acplex.l
@@ -0,0 +1,84 @@
+%{
+/*-
+ * Copyright (c) 2008 Kai Wang
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+
+#include <err.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "_elftc.h"
+
+ELFTC_VCSID("$Id: acplex.l 2130 2011-11-10 06:56:46Z jkoshy $");
+
+#include "acpyacc.h"
+
+#define YY_NO_UNPUT
+#if !defined(ELFTC_BROKEN_YY_NO_INPUT)
+#define YY_NO_INPUT
+#endif
+
+int lineno = 1;
+
+int yylex(void);
+
+%}
+
+%option noyywrap
+
+%%
+
+ADDLIB|addlib { return (ADDLIB); }
+ADDMOD|addmod { return (ADDMOD); }
+CLEAR|clear { return (CLEAR); }
+CREATE|create { return (CREATE); }
+DELETE|delete { return (DELETE); }
+DIRECTORY|directory { return (DIRECTORY); }
+END|end { return (END); }
+EXTRACT|extract { return (EXTRACT); }
+LIST|list { return (LIST); }
+OPEN|open { return (OPEN); }
+REPLACE|replace { return (REPLACE); }
+VERBOSE|verbose { return (VERBOSE); }
+SAVE|save { return (SAVE); }
+"(" { return (LP); }
+")" { return (RP); }
+"," { return (COMMA); }
+
+[-_A-Za-z0-9/:$.\\]+ {
+ yylval.str = strdup(yytext);
+ if (yylval.str == NULL)
+ err(EXIT_FAILURE, "strdup failed");
+ return (FNAME);
+}
+
+[ \t] /* whitespace */
+"*".* /* comment */
+";".* /* comment */
+"+\n" { lineno++; /* '+' is line continuation char */ }
+"\n" { lineno++; return (EOL); }
diff --git a/ar/acpyacc.y b/ar/acpyacc.y
new file mode 100644
index 000000000000..bbe26e021dbf
--- /dev/null
+++ b/ar/acpyacc.y
@@ -0,0 +1,661 @@
+%{
+/*-
+ * Copyright (c) 2008 Kai Wang
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+
+#include <sys/mman.h>
+#include <sys/param.h>
+#include <sys/queue.h>
+#include <sys/stat.h>
+
+#include <archive.h>
+#include <archive_entry.h>
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "libelftc.h"
+
+#include "ar.h"
+
+ELFTC_VCSID("$Id");
+
+
+#define TEMPLATE "arscp.XXXXXXXX"
+
+struct list {
+ char *str;
+ struct list *next;
+};
+
+
+extern int yylex(void);
+extern int yyparse(void);
+
+static void yyerror(const char *);
+static void arscp_addlib(char *archive, struct list *list);
+static void arscp_addmod(struct list *list);
+static void arscp_clear(void);
+static void arscp_create(char *in, char *out);
+static void arscp_delete(struct list *list);
+static void arscp_dir(char *archive, struct list *list, char *rlt);
+static void arscp_end(int eval);
+static void arscp_extract(struct list *list);
+static void arscp_free_argv(void);
+static void arscp_free_mlist(struct list *list);
+static void arscp_list(void);
+static struct list *arscp_mlist(struct list *list, char *str);
+static void arscp_mlist2argv(struct list *list);
+static int arscp_mlist_len(struct list *list);
+static void arscp_open(char *fname);
+static void arscp_prompt(void);
+static void arscp_replace(struct list *list);
+static void arscp_save(void);
+static int arscp_target_exist(void);
+
+extern int lineno;
+
+static struct bsdar *bsdar;
+static char *target;
+static char *tmpac;
+static int interactive;
+static int verbose;
+
+%}
+
+%token ADDLIB
+%token ADDMOD
+%token CLEAR
+%token CREATE
+%token DELETE
+%token DIRECTORY
+%token END
+%token EXTRACT
+%token LIST
+%token OPEN
+%token REPLACE
+%token VERBOSE
+%token SAVE
+%token LP
+%token RP
+%token COMMA
+%token EOL
+%token <str> FNAME
+%type <list> mod_list
+
+%union {
+ char *str;
+ struct list *list;
+}
+
+%%
+
+begin
+ : { arscp_prompt(); } ar_script
+ ;
+
+ar_script
+ : cmd_list
+ |
+ ;
+
+mod_list
+ : FNAME { $$ = arscp_mlist(NULL, $1); }
+ | mod_list separator FNAME { $$ = arscp_mlist($1, $3); }
+ ;
+
+separator
+ : COMMA
+ |
+ ;
+
+cmd_list
+ : rawcmd
+ | cmd_list rawcmd
+ ;
+
+rawcmd
+ : cmd EOL { arscp_prompt(); }
+ ;
+
+cmd
+ : addlib_cmd
+ | addmod_cmd
+ | clear_cmd
+ | create_cmd
+ | delete_cmd
+ | directory_cmd
+ | end_cmd
+ | extract_cmd
+ | list_cmd
+ | open_cmd
+ | replace_cmd
+ | verbose_cmd
+ | save_cmd
+ | invalid_cmd
+ | empty_cmd
+ | error
+ ;
+
+addlib_cmd
+ : ADDLIB FNAME LP mod_list RP { arscp_addlib($2, $4); }
+ | ADDLIB FNAME { arscp_addlib($2, NULL); }
+ ;
+
+addmod_cmd
+ : ADDMOD mod_list { arscp_addmod($2); }
+ ;
+
+clear_cmd
+ : CLEAR { arscp_clear(); }
+ ;
+
+create_cmd
+ : CREATE FNAME { arscp_create(NULL, $2); }
+ ;
+
+delete_cmd
+ : DELETE mod_list { arscp_delete($2); }
+ ;
+
+directory_cmd
+ : DIRECTORY FNAME { arscp_dir($2, NULL, NULL); }
+ | DIRECTORY FNAME LP mod_list RP { arscp_dir($2, $4, NULL); }
+ | DIRECTORY FNAME LP mod_list RP FNAME { arscp_dir($2, $4, $6); }
+ ;
+
+end_cmd
+ : END { arscp_end(EXIT_SUCCESS); }
+ ;
+
+extract_cmd
+ : EXTRACT mod_list { arscp_extract($2); }
+ ;
+
+list_cmd
+ : LIST { arscp_list(); }
+ ;
+
+open_cmd
+ : OPEN FNAME { arscp_open($2); }
+ ;
+
+replace_cmd
+ : REPLACE mod_list { arscp_replace($2); }
+ ;
+
+save_cmd
+ : SAVE { arscp_save(); }
+ ;
+
+verbose_cmd
+ : VERBOSE { verbose = !verbose; }
+ ;
+
+empty_cmd
+ :
+ ;
+
+invalid_cmd
+ : FNAME { yyerror(NULL); }
+ ;
+
+%%
+
+/* ARGSUSED */
+static void
+yyerror(const char *s)
+{
+
+ (void) s;
+ printf("Syntax error in archive script, line %d\n", lineno);
+}
+
+/*
+ * The arscp_open() function will first open an archive and check its
+ * validity. If the archive format is valid, it will call
+ * arscp_create() to create a temporary copy of the archive.
+ */
+static void
+arscp_open(char *fname)
+{
+ struct archive *a;
+ struct archive_entry *entry;
+ int r;
+
+ if ((a = archive_read_new()) == NULL)
+ bsdar_errc(bsdar, 0, "archive_read_new failed");
+ archive_read_support_compression_none(a);
+ archive_read_support_format_ar(a);
+ AC(archive_read_open_file(a, fname, DEF_BLKSZ));
+ if ((r = archive_read_next_header(a, &entry)))
+ bsdar_warnc(bsdar, 0, "%s", archive_error_string(a));
+ AC(archive_read_close(a));
+ ACV(archive_read_finish(a));
+ if (r != ARCHIVE_OK)
+ return;
+ arscp_create(fname, fname);
+}
+
+/*
+ * Create an archive.
+ *
+ * If the parameter 'in' is NULL (the 'CREATE' command), a new empty
+ * archive will be created. If the parameter 'in' is not NULL (the
+ * 'OPEN' command), the resulting archive will be a modified version
+ * of the existing archive.
+ */
+static void
+arscp_create(char *in, char *out)
+{
+ struct archive *a;
+ int ifd, ofd;
+
+ /* Delete the previously created temporary archive, if any. */
+ if (tmpac) {
+ if (unlink(tmpac) < 0)
+ bsdar_errc(bsdar, errno, "unlink failed");
+ free(tmpac);
+ }
+
+ tmpac = strdup(TEMPLATE);
+ if (tmpac == NULL)
+ bsdar_errc(bsdar, errno, "strdup failed");
+ if ((ofd = mkstemp(tmpac)) < 0)
+ bsdar_errc(bsdar, errno, "mkstemp failed");
+
+ if (in) {
+ /*
+ * The 'OPEN' command creates a temporary copy of the
+ * input archive.
+ */
+ if ((ifd = open(in, O_RDONLY)) < 0 ||
+ elftc_copyfile(ifd, ofd) < 0) {
+ bsdar_warnc(bsdar, errno, "'OPEN' failed");
+ (void) close(ofd);
+ if (ifd != -1)
+ (void) close(ifd);
+ return;
+ }
+ (void) close(ifd);
+ (void) close(ofd);
+ } else {
+ /*
+ * The 'CREATE' command creates an "empty" archive (an
+ * archive consisting only of the archive header).
+ */
+ if ((a = archive_write_new()) == NULL)
+ bsdar_errc(bsdar, 0, "archive_write_new failed");
+ archive_write_set_format_ar_svr4(a);
+ AC(archive_write_open_fd(a, ofd));
+ AC(archive_write_close(a));
+ ACV(archive_write_finish(a));
+ }
+
+ /* Override the previous target, if any. */
+ if (target)
+ free(target);
+
+ target = out;
+ bsdar->filename = tmpac;
+}
+
+/*
+ * Add all modules of an archive to the current archive. If the
+ * parameter 'list' is not NULL, only those modules specified by
+ * 'list' will be added.
+ */
+static void
+arscp_addlib(char *archive, struct list *list)
+{
+
+ if (!arscp_target_exist())
+ return;
+ arscp_mlist2argv(list);
+ bsdar->addlib = archive;
+ ar_write_archive(bsdar, 'A');
+ arscp_free_argv();
+ arscp_free_mlist(list);
+}
+
+/*
+ * Add modules to the current archive.
+ */
+static void
+arscp_addmod(struct list *list)
+{
+
+ if (!arscp_target_exist())
+ return;
+ arscp_mlist2argv(list);
+ ar_write_archive(bsdar, 'q');
+ arscp_free_argv();
+ arscp_free_mlist(list);
+}
+
+/*
+ * Delete modules from the current archive.
+ */
+static void
+arscp_delete(struct list *list)
+{
+
+ if (!arscp_target_exist())
+ return;
+ arscp_mlist2argv(list);
+ ar_write_archive(bsdar, 'd');
+ arscp_free_argv();
+ arscp_free_mlist(list);
+}
+
+/*
+ * Extract modules from the current archive.
+ */
+static void
+arscp_extract(struct list *list)
+{
+
+ if (!arscp_target_exist())
+ return;
+ arscp_mlist2argv(list);
+ ar_read_archive(bsdar, 'x');
+ arscp_free_argv();
+ arscp_free_mlist(list);
+}
+
+/*
+ * List the contents of an archive (simple mode).
+ */
+static void
+arscp_list(void)
+{
+
+ if (!arscp_target_exist())
+ return;
+ bsdar->argc = 0;
+ bsdar->argv = NULL;
+ /* Always verbose. */
+ bsdar->options |= AR_V;
+ ar_read_archive(bsdar, 't');
+ bsdar->options &= ~AR_V;
+}
+
+/*
+ * List the contents of an archive (advanced mode).
+ */
+static void
+arscp_dir(char *archive, struct list *list, char *rlt)
+{
+ FILE *out;
+
+ /* If rlt != NULL, redirect the output to it. */
+ out = NULL;
+ if (rlt) {
+ out = bsdar->output;
+ if ((bsdar->output = fopen(rlt, "w")) == NULL)
+ bsdar_errc(bsdar, errno, "fopen %s failed", rlt);
+ }
+
+ bsdar->filename = archive;
+ if (list)
+ arscp_mlist2argv(list);
+ else {
+ bsdar->argc = 0;
+ bsdar->argv = NULL;
+ }
+ if (verbose)
+ bsdar->options |= AR_V;
+ ar_read_archive(bsdar, 't');
+ bsdar->options &= ~AR_V;
+
+ if (rlt) {
+ if (fclose(bsdar->output) == EOF)
+ bsdar_errc(bsdar, errno, "fclose %s failed", rlt);
+ bsdar->output = out;
+ free(rlt);
+ }
+ free(archive);
+ bsdar->filename = tmpac;
+ arscp_free_argv();
+ arscp_free_mlist(list);
+}
+
+
+/*
+ * Replace modules in the current archive.
+ */
+static void
+arscp_replace(struct list *list)
+{
+
+ if (!arscp_target_exist())
+ return;
+ arscp_mlist2argv(list);
+ ar_write_archive(bsdar, 'r');
+ arscp_free_argv();
+ arscp_free_mlist(list);
+}
+
+/*
+ * Rename the temporary archive to the target archive.
+ */
+static void
+arscp_save(void)
+{
+ mode_t mask;
+
+ if (target) {
+ if (rename(tmpac, target) < 0)
+ bsdar_errc(bsdar, errno, "rename failed");
+ /*
+ * Because mkstemp() creates temporary files with mode
+ * 0600, we set target archive's mode as per the
+ * process umask.
+ */
+ mask = umask(0);
+ umask(mask);
+ if (chmod(target, 0666 & ~mask) < 0)
+ bsdar_errc(bsdar, errno, "chmod failed");
+ free(tmpac);
+ free(target);
+ tmpac = NULL;
+ target= NULL;
+ bsdar->filename = NULL;
+ } else
+ bsdar_warnc(bsdar, 0, "no open output archive");
+}
+
+/*
+ * Discard the contents of the current archive. This is achieved by
+ * invoking the 'CREATE' cmd on the current archive.
+ */
+static void
+arscp_clear(void)
+{
+ char *new_target;
+
+ if (target) {
+ new_target = strdup(target);
+ if (new_target == NULL)
+ bsdar_errc(bsdar, errno, "strdup failed");
+ arscp_create(NULL, new_target);
+ }
+}
+
+/*
+ * Quit ar(1). Note that the 'END' cmd will not 'SAVE' the current
+ * archive before exiting.
+ */
+static void
+arscp_end(int eval)
+{
+
+ if (target)
+ free(target);
+ if (tmpac) {
+ if (unlink(tmpac) == -1)
+ bsdar_errc(bsdar, errno, "unlink %s failed", tmpac);
+ free(tmpac);
+ }
+
+ exit(eval);
+}
+
+/*
+ * Check if a target was specified, i.e, whether an 'OPEN' or 'CREATE'
+ * had been issued by the user.
+ */
+static int
+arscp_target_exist(void)
+{
+
+ if (target)
+ return (1);
+
+ bsdar_warnc(bsdar, 0, "no open output archive");
+ return (0);
+}
+
+/*
+ * Construct the list of modules.
+ */
+static struct list *
+arscp_mlist(struct list *list, char *str)
+{
+ struct list *l;
+
+ l = malloc(sizeof(*l));
+ if (l == NULL)
+ bsdar_errc(bsdar, errno, "malloc failed");
+ l->str = str;
+ l->next = list;
+
+ return (l);
+}
+
+/*
+ * Calculate the length of an mlist.
+ */
+static int
+arscp_mlist_len(struct list *list)
+{
+ int len;
+
+ for(len = 0; list; list = list->next)
+ len++;
+
+ return (len);
+}
+
+/*
+ * Free the space allocated for a module list.
+ */
+static void
+arscp_free_mlist(struct list *list)
+{
+ struct list *l;
+
+ /* Note: list->str was freed in arscp_free_argv(). */
+ for(; list; list = l) {
+ l = list->next;
+ free(list);
+ }
+}
+
+/*
+ * Convert a module list to an 'argv' array.
+ */
+static void
+arscp_mlist2argv(struct list *list)
+{
+ char **argv;
+ int i, n;
+
+ n = arscp_mlist_len(list);
+ argv = malloc(n * sizeof(*argv));
+ if (argv == NULL)
+ bsdar_errc(bsdar, errno, "malloc failed");
+
+ /* Note that module names are stored in reverse order. */
+ for(i = n - 1; i >= 0; i--, list = list->next) {
+ if (list == NULL)
+ bsdar_errc(bsdar, errno, "invalid mlist");
+ argv[i] = list->str;
+ }
+
+ bsdar->argc = n;
+ bsdar->argv = argv;
+}
+
+/*
+ * Free the space allocated for an argv array and its elements.
+ */
+static void
+arscp_free_argv(void)
+{
+ int i;
+
+ for(i = 0; i < bsdar->argc; i++)
+ free(bsdar->argv[i]);
+
+ free(bsdar->argv);
+}
+
+/*
+ * Show a prompt if we are in interactive mode.
+ */
+static void
+arscp_prompt(void)
+{
+
+ if (interactive) {
+ printf("AR >");
+ fflush(stdout);
+ }
+}
+
+/*
+ * The main function implementing script mode.
+ */
+void
+ar_mode_script(struct bsdar *ar)
+{
+
+ bsdar = ar;
+ interactive = isatty(fileno(stdin));
+ while(yyparse()) {
+ if (!interactive)
+ arscp_end(EXIT_FAILURE);
+ }
+
+ /* Script ends without END */
+ arscp_end(EXIT_SUCCESS);
+}
diff --git a/ar/ar.1 b/ar/ar.1
new file mode 100644
index 000000000000..98ba6775a190
--- /dev/null
+++ b/ar/ar.1
@@ -0,0 +1,603 @@
+.\" Copyright (c) 2007,2009-2012 Joseph Koshy. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" This software is provided by Joseph Koshy ``as is'' and
+.\" any express or implied warranties, including, but not limited to, the
+.\" implied warranties of merchantability and fitness for a particular purpose
+.\" are disclaimed. in no event shall Joseph Koshy be liable
+.\" for any direct, indirect, incidental, special, exemplary, or consequential
+.\" damages (including, but not limited to, procurement of substitute goods
+.\" or services; loss of use, data, or profits; or business interruption)
+.\" however caused and on any theory of liability, whether in contract, strict
+.\" liability, or tort (including negligence or otherwise) arising in any way
+.\" out of the use of this software, even if advised of the possibility of
+.\" such damage.
+.\"
+.\" $Id: ar.1 2742 2012-12-10 18:47:36Z jkoshy $
+.\"
+.Dd December 10, 2012
+.Os
+.Dt AR 1
+.Sh NAME
+.Nm ar
+.Nd manage archives
+.Sh SYNOPSIS
+.Nm
+.Fl d
+.Op Fl T
+.Op Fl f
+.Op Fl j
+.Op Fl v
+.Op Fl z
+.Ar archive
+.Ar
+.Nm
+.Fl m
+.Op Fl T
+.Op Fl a Ar position-after
+.Op Fl b Ar position-before
+.Op Fl f
+.Op Fl i Ar position-before
+.Op Fl j
+.Op Fl s | Fl S
+.Op Fl z
+.Ar archive
+.Ar
+.Nm
+.Fl p
+.Op Fl T
+.Op Fl f
+.Op Fl v
+.Ar archive
+.Op Ar
+.Nm
+.Fl q
+.Op Fl T
+.Op Fl c
+.Op Fl D
+.Op Fl f
+.Op Fl F Ar flavor | Fl -flavor Ar flavor
+.Op Fl s | Fl S
+.Op Fl v
+.Op Fl z
+.Ar archive
+.Ar
+.Nm
+.Fl r
+.Op Fl T
+.Op Fl a Ar position-after
+.Op Fl b Ar position-before
+.Op Fl c
+.Op Fl D
+.Op Fl f
+.Op Fl F Ar flavor | Fl -flavor Ar flavor
+.Op Fl i Ar position-before
+.Op Fl j
+.Op Fl s | Fl S
+.Op Fl u
+.Op Fl v
+.Op Fl z
+.Ar archive
+.Ar
+.Nm
+.Fl s
+.Op Fl D
+.Op Fl j
+.Op Fl z
+.Ar archive
+.Nm
+.Fl t
+.Op Fl f
+.Op Fl T
+.Op Fl v
+.Ar archive
+.Op Ar
+.Nm
+.Fl x
+.Op Fl C
+.Op Fl T
+.Op Fl f
+.Op Fl o
+.Op Fl u
+.Op Fl v
+.Ar archive
+.Op Ar
+.Nm
+.Fl M
+.Nm
+.Fl V
+.Sh DESCRIPTION
+The
+.Nm
+utility creates and maintains groups of files combined into an
+archive.
+Once an archive has been created, new files can be added to it, and
+existing files can be extracted, deleted or replaced.
+.Pp
+Files are named in the archive by their last file name component,
+so if a file referenced by a path containing a
+.Dq /
+is archived, it will be named by the last component of the path.
+Similarly when matching paths listed on the command line against
+file names stored in the archive, only the last component of the
+path will be compared.
+.Pp
+The normal use of
+.Nm
+is for the creation and maintenance of libraries suitable for use
+with the link editor
+.Xr ld 1 ,
+although it is not restricted to this purpose.
+The
+.Nm
+utility can create and manage an archive symbol table (see
+.Xr ar 5 )
+used to speed up link editing operations.
+If a symbol table is present in an archive, it will be
+kept up-to-date by subsequent operations on the archive.
+.Sh OPTIONS
+The
+.Nm
+utility supports the following options:
+.Bl -tag -width indent
+.It Fl a Ar member-after
+When used with option
+.Fl m
+this option specifies that the archive members specified by
+arguments
+.Ar
+are moved to after the archive member named by argument
+.Ar member-after .
+When used with option
+.Fl r
+this option specifies that the files specified by arguments
+.Ar
+are added after the archive member named by argument
+.Ar member-after .
+.It Fl b Ar member-before
+When used with option
+.Fl m
+this option specifies that the archive members specified by
+arguments
+.Ar
+are moved to before the archive member named by argument
+.Ar member-before .
+When used with option
+.Fl r
+this option specifies that the files specified by arguments
+.Ar
+are added before the archive member named by argument
+.Ar member-before .
+.It Fl c
+Suppress the informational message printed when a new archive is
+created using the
+.Fl r
+and
+.Fl q
+options.
+.It Fl C
+Prevent extracted files from replacing like-named files
+in the file system.
+.It Fl d
+Delete the members named by arguments
+.Ar
+from the archive specified by argument
+.Ar archive .
+The archive's symbol table, if present, is updated to reflect
+the new contents of the archive.
+.It Fl D
+When used in combination with the
+.Fl r
+or
+.Fl q
+option, insert 0's instead of the real mtime, uid and gid values
+and 0644 instead of file mode from the members named by arguments
+.Ar .
+This ensures that checksums on the resulting archives are reproducible
+when member contents are identical.
+.It Fl f
+Synonymous with option
+.Fl T .
+.It Fl F Ar flavor | Fl -flavor Ar flavor
+Create archives with the specified archive format.
+Legal values for argument
+.Ar flavor
+are:
+.Bl -tag -width indent -compact
+.It Ar bsd
+Create BSD format archives.
+.It Ar gnu
+An alias for
+.Ar svr4 .
+.It Ar svr4
+Create SVR4 format archives.
+.El
+If this option is not specified,
+.Nm
+will create archives using the SVR4 format.
+.It Fl i Ar member-before
+Synonymous with option
+.Fl b .
+.It Fl j
+This option is accepted for compatibility with the
+.Tn FreeBSD
+version of the
+.Nm
+utility, but is ignored.
+.It Fl l
+This option is accepted for compatibility with GNU
+.Xr ar 1 ,
+but is ignored.
+.It Fl m
+Move archive members specified by arguments
+.Ar
+within the archive.
+If a position has been specified by one of the
+.Fl a ,
+.Fl b
+or
+.Fl i
+options, the members are moved to before or after the specified
+position.
+If no position has been specified, the specified members are moved
+to the end of the archive.
+If the archive has a symbol table, it is updated to reflect the
+new contents of the archive.
+.It Fl M
+Read and execute MRI librarian commands from standard input.
+The commands understood by the
+.Nm
+utility are described in the section
+.Sx "MRI Librarian Commands" .
+.It Fl o
+Preserve the original modification times of members when extracting
+them.
+.It Fl p
+Write the contents of the specified archive members named by
+arguments
+.Ar
+to standard output.
+If no members were specified, the contents of all the files in the
+archive are written in the order they appear in the archive.
+.It Fl q
+Append the files specified by arguments
+.Ar
+to the archive specified by argument
+.Ar archive
+without checking if the files already exist in the archive.
+The archive symbol table will be updated as needed.
+If the file specified by the argument
+.Ar archive
+does not already exist, a new archive will be created.
+.It Fl r
+Replace (add) the files specified by arguments
+.Ar
+in the archive specified by argument
+.Ar archive ,
+creating the archive if necessary.
+Replacing existing members will not change the order of members within
+the archive.
+If a file named in arguments
+.Ar
+does not exist, existing members in the archive that match that
+name are not changed.
+New files are added to the end of the archive unless one of the
+positioning options
+.Fl a ,
+.Fl b
+or
+.Fl i
+is specified.
+The archive symbol table, if it exists, is updated to reflect the
+new state of the archive.
+.It Fl s
+Add an archive symbol table (see
+.Xr ar 5 )
+to the archive specified by argument
+.Ar archive .
+Invoking
+.Nm
+with the
+.Fl s
+option alone is equivalent to invoking
+.Xr ranlib 1 .
+.It Fl S
+Do not generate an archive symbol table.
+.It Fl t
+For
+.Nm ,
+list the files specified by arguments
+.Ar
+in the order in which they appear in the archive, one per line.
+If no files are specified, all files in the archive are listed.
+.It Fl T
+Use only the first fifteen characters of the archive member name or
+command line file name argument when naming archive members.
+.It Fl u
+Conditionally update the archive or extract members.
+When used with the
+.Fl r
+option, files named by arguments
+.Ar
+will be replaced in the archive if they are newer than their
+archived versions.
+When used with the
+.Fl x
+option, the members specified by arguments
+.Ar
+will be extracted only if they are newer than the corresponding
+files in the file system.
+.It Fl v
+Provide verbose output.
+When used with the
+.Fl d ,
+.Fl m ,
+.Fl q
+or
+.Fl x
+options,
+.Nm
+gives a file-by-file description of the archive modification being
+performed, which consists of three white-space seperated fields:
+the option letter, a dash
+.Dq "-" ,
+and the file name.
+When used with the
+.Fl r
+option,
+.Nm
+displays the description as above, but the initial letter is an
+.Dq a
+if the file is added to the archive, or an
+.Dq r
+if the file replaces a file already in the archive.
+When used with the
+.Fl p
+option, the name of the file enclosed in
+.Dq <
+and
+.Dq >
+characters is written to standard output preceded by a single newline
+character and followed by two newline characters.
+The contents of the named file follow the file name.
+When used with the
+.Fl t
+option,
+.Nm
+displays eight whitespace separated fields:
+the file permissions as displayed by
+.Xr strmode 3 ,
+decimal user and group IDs separated by a slash (
+.Dq / Ns ) ,
+the file size in bytes, the file modification time in
+.Xr strftime 3
+format
+.Dq "%b %e %H:%M %Y" ,
+and the name of the file.
+.It Fl V
+Print a version identifier and exit.
+.It Fl x
+Extract archive members specified by arguments
+.Ar
+into the current directory.
+If no members have been specified, extract all members of the archive.
+If the file corresponding to an extracted member does not exist it
+will be created.
+If the file corresponding to an extracted member does exist, its owner
+and group will not be changed while its contents will be overwritten
+and its permissions will set to that entered in the archive.
+The file's access and modification time would be that of the time
+of extraction unless the
+.Fl o
+option was specified.
+.It Fl z
+This option is accepted for compatibility with the
+.Tn FreeBSD
+version of the
+.Nm
+utility, but is ignored.
+.El
+.Ss "MRI Librarian Commands"
+If the
+.Fl M
+option is specified, the
+.Nm
+utility will read and execute commands from its standard input.
+If standard input is a terminal, the
+.Nm
+utility will display the prompt
+.Dq Li "AR >"
+before reading a line, and will continue operation even if errors are
+encountered.
+If standard input is not a terminal, the
+.Nm
+utility will not display a prompt and will terminate execution on
+encountering an error.
+.Pp
+Each input line contains a single command.
+Words in an input line are separated by whitespace characters.
+The first word of the line is the command, the remaining words are
+the arguments to the command.
+The command word may be specified in either case.
+Arguments may be separated by commas or blanks.
+.Pp
+Empty lines are allowed and are ignored.
+Long lines are continued by ending them with the
+.Dq Li +
+character.
+.Pp
+The
+.Dq Li *
+and
+.Dq Li "\;"
+characters start a comment.
+Comments extend till the end of the line.
+.Pp
+When executing an MRI librarian script the
+.Nm
+utility works on a temporary copy of an archive.
+Changes to the copy are made permanent using the
+.Ic save
+command.
+.Pp
+Commands understood by the
+.Nm
+utility are:
+.Bl -tag -width indent
+.It Ic addlib Ar archive | Ic addlib Ar archive Pq Ar member Oo Li , Ar member Oc Ns ...
+Add the contents of the archive named by argument
+.Ar archive
+to the current archive.
+If specific members are named using the arguments
+.Ar member ,
+then those members are added to the current archive.
+If no members are specified, the entire contents of the archive
+are added to the current archive.
+.It Ic addmod Ar member Oo Li , Ar member Oc Ns ...
+Add the files named by arguments
+.Ar member
+to the current archive.
+.It Ic clear
+Discard all the contents of the current archive.
+.It Ic create Ar archive
+Create a new archive named by the argument
+.Ar archive ,
+and makes it the current archive.
+If the named archive already exists, it will be overwritten
+when the
+.Ic save
+command is issued.
+.It Ic delete Ar module Oo Li , Ar member Oc Ns ...
+Delete the modules named by the arguments
+.Ar member
+from the current archive.
+.It Ic directory Ar archive Po Ar member Oo Li , Ar member Oc Ns ... Pc Op Ar outputfile
+List each named module in the archive.
+The format of the output depends on the verbosity setting set using
+the
+.Ic verbose
+command.
+Output is sent to standard output, or to the file specified by
+argument
+.Ar outputfile .
+.It Ic end
+Exit successfully from the
+.Nm
+utility.
+Any unsaved changes to the current archive will be discarded.
+.It Ic extract Ar member Oo Li , Ar member Oc Ns ...
+Extract the members named by the arguments
+.Ar member
+from the current archive.
+.It Ic list
+Display the contents of the current archive in verbose style.
+.It Ic open Ar archive
+Open the archive named by argument
+.Ar archive
+and make it the current archive.
+.It Ic replace Ar member Oo Li , Ar member Oc Ns ...
+Replace named members in the current archive with the files specified
+by arguments
+.Ar member .
+The files must be present in the current directory and the named
+modules must already exist in the current archive.
+.It Ic save
+Commit all changes to the current archive.
+.It Ic verbose
+Toggle the verbosity of the
+.Ic directory
+command.
+.El
+.Sh EXAMPLES
+To create a new archive
+.Pa ex.a
+containing three files
+.Pa ex1.o ,
+.Pa ex2.o
+and
+.Pa ex3.o ,
+use:
+.Dl "ar -rc ex.a ex1.o ex2.o ex3.o"
+.Pp
+To add an archive symbol table to an existing archive
+.Pa ex.a ,
+use:
+.Dl "ar -s ex.a"
+.Pp
+To delete file
+.Pa ex1.o
+from archive
+.Pa ex.a ,
+use:
+.D1 "ar -d ex.a ex1.o"
+.Pp
+To verbosely list the contents of archive
+.Pa ex.a ,
+use:
+.D1 "ar -tv ex.a"
+.Pp
+To create a new archive
+.Pa ex.a
+containing the files
+.Pa ex1.o ,
+and
+.Pa ex2.o ,
+using MRI librarian commands, use the following script:
+.Bd -literal -offset indent
+create ex.a * specify the output archive
+addmod ex1.o ex2.o * add modules
+save * save pending changes
+end * exit the utility
+.Ed
+.Sh DIAGNOSTICS
+.Ex -std
+.Sh SEE ALSO
+.Xr ld 1 ,
+.Xr ranlib 1 ,
+.Xr archive 3 ,
+.Xr elf 3 ,
+.Xr strftime 3 ,
+.Xr strmode 3 ,
+.Xr ar 5
+.Sh STANDARDS COMPLIANCE
+The
+.Nm
+utility's support for the
+.Fl a ,
+.Fl b ,
+.Fl c ,
+.Fl i ,
+.Fl m ,
+.Fl p ,
+.Fl q ,
+.Fl r ,
+.Fl s ,
+.Fl t ,
+.Fl u ,
+.Fl v ,
+.Fl C
+and
+.Fl T
+options is believed to be compliant with
+.St -p1003.2 .
+.Sh HISTORY
+An
+.Nm
+command first appeared in AT&T UNIX Version 1.
+In
+.Fx 8.0 ,
+.An "Kai Wang" Aq kaiw@FreeBSD.org
+reimplemented
+.Nm
+using the
+.Lb libarchive
+and the
+.Lb libelf .
diff --git a/ar/ar.5 b/ar/ar.5
new file mode 100644
index 000000000000..50397b29ff28
--- /dev/null
+++ b/ar/ar.5
@@ -0,0 +1,327 @@
+.\" Copyright (c) 2010 Joseph Koshy. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $Id: ar.5 2066 2011-10-26 15:40:28Z jkoshy $
+.\"
+.Dd November 28, 2010
+.Os
+.Dt AR 5
+.Sh NAME
+.Nm ar
+.Nd archive file format for
+.Xr ar 1
+and
+.Xr ranlib 1
+.Sh SYNOPSIS
+.In ar.h
+.Sh DESCRIPTION
+.Xr ar 1
+archives are created and managed by the
+.Xr ar 1
+and
+.Xr ranlib 1
+utilities.
+These archives are typically used during program development to
+hold libraries of program objects.
+An
+.Xr ar 1
+archive is contained in a single operating system file.
+.Pp
+This manual page documents two variants of the
+.Xr ar 1
+archive format: the BSD archive format, and the SVR4/GNU archive
+format.
+.Pp
+In both variants the archive file starts with an identifying byte
+sequence of the seven ASCII characters
+.Sq Li "!<arch>"
+followed by a ASCII linefeed character
+.Po
+see the constant
+.Dq ARMAG
+in the header file
+.In ar.h
+.Pc .
+.Pp
+Archive members follow the initial identifying byte sequence.
+Each archive member is prefixed by a fixed size header describing the
+file attributes associated with the member.
+.Ss "Archive Headers"
+An archive header describes the file attributes for the archive member that
+follows it.
+The
+.Xr ar 5
+format only supports a limited number of attributes: the file name,
+the file creation time stamp, the uid and gid of the creator, the file
+mode and the file size.
+.Pp
+Archive headers are placed at an even byte offset in the archive file.
+If the data for an archive member ends at an odd byte offset, then a
+padding byte with value 0x0A is used to position the next archive
+header on an even byte offset.
+.Pp
+An archive header comprises the following fixed sized fields:
+.Bl -tag -width "Li ar_name"
+.It Ar ar_name
+(16 bytes) The file name of the archive member.
+The format of this field varies between the BSD and SVR4/GNU formats and
+is described in more detail in the section
+.Sx "Representing File Names"
+below.
+.It Ar ar_date
+(12 bytes) The file modification time for the member in seconds since the
+epoch, encoded as a decimal number.
+.It Ar ar_uid
+(6 bytes) The uid associated with the archive member, encoded as a
+decimal number.
+.It Ar ar_gid
+(6 bytes) The gid associated with the archive member, encoded as a
+decimal number.
+.It Ar ar_mode
+(8 bytes) The file mode for the archive member, encoded as an octal
+number.
+.It Ar ar_size
+(10 bytes) In the SVR4/GNU archive format this field holds the size in
+bytes of the archive member, encoded as a decimal number.
+In the BSD archive format, for short file names, this field
+holds the size in bytes of the archive member, encoded as a decimal
+number.
+For long file names
+.Po
+see
+.Sx "Representing File Names"
+below
+.Pc ,
+the field contains the combined size of the
+archive member and its file name, encoded as a decimal number.
+.It Ar ar_fmag
+(2 bytes) This field holds 2 bytes with values 0x96 and 0x0A
+respectively, marking the end of the header.
+.El
+.Pp
+Unused bytes in the fields of an archive header are set to the value
+0x20.
+.Ss "Representing File Names"
+The BSD and SVR4/GNU variants use different schemes for encoding file
+names for members.
+.Bl -tag -width "SVR4/GNU"
+.It "BSD"
+File names that are upto 16 bytes long and which do not contain
+embedded spaces are stored directly in the
+.Ar ar_name
+field of the archive header.
+File names that are either longer than 16 bytes or which contain
+embedded spaces are stored immediately after the archive header
+and the
+.Ar ar_name
+field of the archive header is set to the string
+.Dq "#1/"
+followed by a decimal representation of the number of bytes needed for
+the file name.
+In addition, the
+.Ar ar_size
+field of the archive header is set to the decimal representation of
+the combined sizes of the archive member and the file name.
+The file contents of the member follows the file name without further
+padding.
+.Pp
+As an example, if the file name for a member was
+.Dq "A B"
+and its contents was the string
+.Dq "C D" ,
+then the
+.Ar ar_name
+field of the header would contain
+.Dq Li "#1/3" ,
+the
+.Ar ar_size
+field of the header would contain
+.Dq Li 6 ,
+and the bytes immediately following the header would be 0x41, 0x20,
+0x42, 0x43, 0x20 and 0x44
+.Po
+ASCII
+.Dq "A BC D"
+.Pc .
+.It "SVR4/GNU"
+File names that are upto 15 characters long are stored directly in the
+.Ar ar_name
+field of the header, terminated by a
+.Dq Li /
+character.
+.Pp
+If the file name is larger than would fit in space for the
+.Ar ar_name
+field, then the actual file name is kept in the archive
+string table
+.Po
+see
+.Sx "Archive String Tables"
+below
+.Pc ,
+and the decimal offset of the file name in the string table is stored
+in the
+.Ar ar_name
+field, prefixed by a
+.Dq Li /
+character.
+.Pp
+As an example, if the real file name has been stored at offset 768 in
+the archive string table, the
+.Ar ar_name
+field of the header will contain the string
+.Dq /768 .
+.El
+.Ss "Special Archive Members"
+The following archive members are special.
+.Bl -tag -width indent
+.It Dq Li /
+In the SVR4/GNU variant of the archive format, the archive member with
+name
+.Dq Li /
+denotes an archive symbol table.
+If present, this member will be the very first member in the
+archive.
+.It Dq Li //
+In the SVR4/GNU variant of the archive format, the archive member with
+name
+.Dq Li //
+denotes the archive string table.
+This special member is used to hold filenames that do not fit in the
+file name field of the header
+.Po
+see
+.Sx "Representing File Names"
+above
+.Pc .
+If present, this member immediately follows the archive symbol table
+if an archive symbol table is present, or is the first member otherwise.
+.It Dq Li "__.SYMDEF"
+This special member contains the archive symbol table in the BSD
+variant of the archive format.
+If present, this member will be the very first member in the
+archive.
+.El
+.Ss "Archive String Tables"
+An archive string table is used in the SVR4/GNU archive format to hold
+file names that are too large to fit into the constraints of the
+.Ar ar_name
+field of the archive header.
+An archive string table contains a sequence of file names.
+Each file name in the archive string table is terminated by the
+byte sequence 0x2F, 0x0A
+.Po
+the ASCII string
+.Dq "/\en"
+.Pc .
+No padding is used to separate adjacent file names.
+.Ss "Archive Symbol Tables"
+Archive symbol tables are used to speed up link editing by providing a
+mapping between the program symbols defined in the archive
+and the corresponding archive members.
+Archive symbol tables are managed by the
+.Xr ranlib 1
+utility.
+.Pp
+The format of archive symbol tables is as follows:
+.Bl -tag -width "SVR4/GNU"
+.It BSD
+In the BSD archive format, the archive symbol table comprises
+of two parts: a part containing an array of
+.Vt "struct ranlib"
+descriptors, followed by a part containing a symbol string table.
+The sizes and layout of the structures that make up a BSD format
+archive symbol table are machine dependent.
+.Pp
+The part containing
+.Vt "struct ranlib"
+descriptors begins with a field containing the size in bytes of the
+array of
+.Vt "struct ranlib"
+descriptors encoded as a C
+.Vt long
+value.
+.Pp
+The array of
+.Vt "struct ranlib"
+descriptors follows the size field.
+Each
+.Vt "struct ranlib"
+descriptor describes one symbol.
+.Pp
+A
+.Vt "struct ranlib"
+descriptor comprises two fields:
+.Bl -tag -width "Ar ran_strx" -compact
+.It Ar ran_strx
+.Pq C Vt long
+This field contains the zero-based offset of the symbol name in the
+symbol string table.
+.It Ar ran_off
+.Pq C Vt long
+This field is the file offset to the archive header for the archive
+member defining the symbol.
+.El
+.Pp
+The part containing the symbol string table begins with a field
+containing the size in bytes of the string table, encoded as a C
+.Vt long
+value.
+This string table follows the size field, and contains
+NUL-terminated strings for the symbols in the symbol table.
+.It SVR4/GNU
+In the SVR4/GNU archive format, the archive symbol table starts with a
+4-byte binary value containing the number of entries contained in the
+archive symbol table.
+This count of entries is stored most significant byte first.
+.Pp
+Next, there are
+.Ar count
+4-byte numbers, each stored most significant byte first.
+Each number is a binary offset to the archive header for the member in
+the archive file for the corresponding symbol table entry.
+.Pp
+After the binary offset values, there are
+.Ar count
+NUL-terminated strings in sequence, holding the symbol names for
+the corresponding symbol table entries.
+.El
+.Sh STANDARDS COMPLIANCE
+The
+.Xr ar 1
+archive format is not currently specified by a standard.
+.Pp
+This manual page documents the
+.Xr ar 1
+archive formats used by the
+.Bx 4.4
+and
+.Ux SVR4
+operating system releases.
+.Sh SEE ALSO
+.Xr ar 1 ,
+.Xr ld 1 ,
+.Xr ranlib 1 ,
+.Xr elf 3 ,
+.Xr elf_getarsym 3 ,
+.Xr elf_rand 3
diff --git a/ar/ar.c b/ar/ar.c
new file mode 100644
index 000000000000..9cdddb2ca406
--- /dev/null
+++ b/ar/ar.c
@@ -0,0 +1,435 @@
+/*-
+ * Copyright (c) 2007 Kai Wang
+ * Copyright (c) 2007 Tim Kientzle
+ * Copyright (c) 2007 Joseph Koshy
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*-
+ * Copyright (c) 1990, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Hugh Smith at The University of Guelph.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+
+#include <sys/queue.h>
+#include <sys/types.h>
+#include <archive.h>
+#include <errno.h>
+#include <getopt.h>
+#include <libelftc.h>
+#include <libgen.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "ar.h"
+
+ELFTC_VCSID("$Id: ar.c 2485 2012-04-07 15:54:59Z kaiwang27 $");
+
+enum options
+{
+ OPTION_HELP
+};
+
+static struct option longopts[] =
+{
+ {"flavor", required_argument, NULL, 'F'},
+ {"help", no_argument, NULL, OPTION_HELP},
+ {"version", no_argument, NULL, 'V'},
+ {NULL, 0, NULL, 0}
+};
+
+static void bsdar_usage(void);
+static void ranlib_usage(void);
+static void set_mode(struct bsdar *bsdar, char opt);
+static void only_mode(struct bsdar *bsdar, const char *opt,
+ const char *valid_modes);
+static void bsdar_version(void);
+
+int
+main(int argc, char **argv)
+{
+ struct bsdar *bsdar, bsdar_storage;
+ char *arcmd, *argv1_saved;
+ size_t len;
+ int i, opt;
+
+ bsdar = &bsdar_storage;
+ memset(bsdar, 0, sizeof(*bsdar));
+
+ arcmd = argv1_saved = NULL;
+ bsdar->output = stdout;
+
+ if ((bsdar->progname = ELFTC_GETPROGNAME()) == NULL)
+ bsdar->progname = "ar";
+
+ if (elf_version(EV_CURRENT) == EV_NONE)
+ bsdar_errc(bsdar, 0, "ELF library initialization failed: %s",
+ elf_errmsg(-1));
+
+ /*
+ * Act like ranlib if our name ends in "ranlib"; this
+ * accomodates names like "arm-freebsd7.1-ranlib",
+ * "bsdranlib", etc.
+ */
+ len = strlen(bsdar->progname);
+ if (len >= strlen("ranlib") &&
+ strcmp(bsdar->progname + len - strlen("ranlib"), "ranlib") == 0) {
+ while ((opt = getopt_long(argc, argv, "tDV", longopts,
+ NULL)) != -1) {
+ switch(opt) {
+ case 't':
+ /* Ignored. */
+ break;
+ case 'D':
+ bsdar->options |= AR_D;
+ break;
+ case 'V':
+ bsdar_version();
+ break;
+ case OPTION_HELP:
+ ranlib_usage();
+ default:
+ ranlib_usage();
+ }
+ }
+ argv += optind;
+ argc -= optind;
+
+ if (*argv == NULL)
+ ranlib_usage();
+
+ bsdar->options |= AR_S;
+ for (;(bsdar->filename = *argv++) != NULL;)
+ ar_write_archive(bsdar, 's');
+
+ exit(EXIT_SUCCESS);
+ } else {
+ if (argc < 2)
+ bsdar_usage();
+
+ /*
+ * Tack on a leading '-', for old-style usage.
+ */
+ if (*argv[1] != '-') {
+ argv1_saved = argv[1];
+ len = strlen(argv[1]) + 2;
+ if ((arcmd = malloc(len)) == NULL)
+ bsdar_errc(bsdar, errno, "malloc failed");
+ (void) snprintf(arcmd, len, "-%s", argv[1]);
+ argv[1] = arcmd;
+ }
+ }
+
+ while ((opt = getopt_long(argc, argv, "abCcdDfF:ijlMmopqrSsTtuVvxz",
+ longopts, NULL)) != -1) {
+ switch(opt) {
+ case 'a':
+ bsdar->options |= AR_A;
+ break;
+ case 'b':
+ case 'i':
+ bsdar->options |= AR_B;
+ break;
+ case 'C':
+ bsdar->options |= AR_CC;
+ break;
+ case 'c':
+ bsdar->options |= AR_C;
+ break;
+ case 'd':
+ set_mode(bsdar, opt);
+ break;
+ case 'D':
+ bsdar->options |= AR_D;
+ break;
+ case 'F':
+ if (!strcasecmp(optarg, "svr4") ||
+ !strcasecmp(optarg, "gnu"))
+ bsdar->options &= ~AR_BSD;
+ else if (!strcasecmp(optarg, "bsd"))
+ bsdar->options |= AR_BSD;
+ else
+ bsdar_usage();
+ break;
+ case 'f':
+ case 'T':
+ bsdar->options |= AR_TR;
+ break;
+ case 'j':
+ /* ignored */
+ break;
+ case 'l':
+ /* ignored, for GNU ar comptibility */
+ break;
+ case 'M':
+ set_mode(bsdar, opt);
+ break;
+ case 'm':
+ set_mode(bsdar, opt);
+ break;
+ case 'o':
+ bsdar->options |= AR_O;
+ break;
+ case 'p':
+ set_mode(bsdar, opt);
+ break;
+ case 'q':
+ set_mode(bsdar, opt);
+ break;
+ case 'r':
+ set_mode(bsdar, opt);
+ break;
+ case 'S':
+ bsdar->options |= AR_SS;
+ break;
+ case 's':
+ bsdar->options |= AR_S;
+ break;
+ case 't':
+ set_mode(bsdar, opt);
+ break;
+ case 'u':
+ bsdar->options |= AR_U;
+ break;
+ case 'V':
+ bsdar_version();
+ break;
+ case 'v':
+ bsdar->options |= AR_V;
+ break;
+ case 'x':
+ set_mode(bsdar, opt);
+ break;
+ case 'z':
+ /* ignored */
+ break;
+ case OPTION_HELP:
+ bsdar_usage();
+ default:
+ bsdar_usage();
+ }
+ }
+
+ /* Restore argv[1] if we had modified it. */
+ if (arcmd != NULL) {
+ argv[1] = argv1_saved;
+ free(arcmd);
+ arcmd = argv1_saved = NULL;
+ }
+
+ argv += optind;
+ argc -= optind;
+
+ if (*argv == NULL && bsdar->mode != 'M')
+ bsdar_usage();
+
+ if (bsdar->options & AR_A && bsdar->options & AR_B)
+ bsdar_errc(bsdar, 0,
+ "only one of -a and -[bi] options allowed");
+
+ if (bsdar->options & AR_J && bsdar->options & AR_Z)
+ bsdar_errc(bsdar, 0,
+ "only one of -j and -z options allowed");
+
+ if (bsdar->options & AR_S && bsdar->options & AR_SS)
+ bsdar_errc(bsdar, 0,
+ "only one of -s and -S options allowed");
+
+ if (bsdar->options & (AR_A | AR_B)) {
+ if (*argv == NULL)
+ bsdar_errc(bsdar, 0,
+ "no position operand specified");
+ if ((bsdar->posarg = basename(*argv)) == NULL)
+ bsdar_errc(bsdar, errno,
+ "basename failed");
+ argc--;
+ argv++;
+ }
+
+ if (bsdar->options & AR_A)
+ only_mode(bsdar, "-a", "mqr");
+ if (bsdar->options & AR_B)
+ only_mode(bsdar, "-b", "mqr");
+ if (bsdar->options & AR_C)
+ only_mode(bsdar, "-c", "qr");
+ if (bsdar->options & AR_CC)
+ only_mode(bsdar, "-C", "x");
+ if (bsdar->options & AR_D)
+ only_mode(bsdar, "-D", "qr");
+ if (bsdar->options & AR_O)
+ only_mode(bsdar, "-o", "x");
+ if (bsdar->options & AR_SS)
+ only_mode(bsdar, "-S", "mqr");
+ if (bsdar->options & AR_U)
+ only_mode(bsdar, "-u", "qrx");
+
+ if (bsdar->mode == 'M') {
+ ar_mode_script(bsdar);
+ exit(EXIT_SUCCESS);
+ }
+
+ if ((bsdar->filename = *argv) == NULL)
+ bsdar_usage();
+
+ bsdar->argc = --argc;
+ bsdar->argv = ++argv;
+
+ if ((!bsdar->mode || strchr("ptx", bsdar->mode)) &&
+ bsdar->options & AR_S) {
+ ar_write_archive(bsdar, 's');
+ if (!bsdar->mode)
+ exit(EXIT_SUCCESS);
+ }
+
+ switch(bsdar->mode) {
+ case 'd': case 'm': case 'q': case 'r':
+ ar_write_archive(bsdar, bsdar->mode);
+ break;
+
+ case 'p': case 't': case 'x':
+ ar_read_archive(bsdar, bsdar->mode);
+ break;
+ default:
+ bsdar_usage();
+ /* NOTREACHED */
+ }
+
+ for (i = 0; i < bsdar->argc; i++)
+ if (bsdar->argv[i] != NULL)
+ bsdar_warnc(bsdar, 0, "%s: not found in archive",
+ bsdar->argv[i]);
+
+ exit(EXIT_SUCCESS);
+}
+
+static void
+set_mode(struct bsdar *bsdar, char opt)
+{
+
+ if (bsdar->mode != '\0' && bsdar->mode != opt)
+ bsdar_errc(bsdar, 0, "Can't specify both -%c and -%c",
+ opt, bsdar->mode);
+ bsdar->mode = opt;
+}
+
+static void
+only_mode(struct bsdar *bsdar, const char *opt, const char *valid_modes)
+{
+
+ if (strchr(valid_modes, bsdar->mode) == NULL)
+ bsdar_errc(bsdar, 0, "Option %s is not permitted in mode -%c",
+ opt, bsdar->mode);
+}
+
+#define AR_USAGE_MESSAGE "\
+Usage: %s <command> [options] archive file...\n\
+ Manage archives.\n\n\
+ Where <command> is one of:\n\
+ -d Delete members from the archive.\n\
+ -m Move archive members within the archive.\n\
+ -p Write the contents of members to standard output.\n\
+ -q Append files to an archive.\n\
+ -r Replace (add) files to an archive.\n\
+ -s Add an archive symbol to an archive.\n\
+ -t List files in an archive.\n\
+ -x Extract members from an archive.\n\
+ -M Execute MRI librarian commands.\n\
+ -V Print a version identifier and exit.\n\n\
+ Options:\n\
+ -a MEMBER Add members after the specified member.\n\
+ -b MEMBER | -i MEMBER\n\
+ Add members before the specified member.\n\
+ -c Do not print a message when creating a new archive.\n\
+ -f | -T Only use the first fifteen characters of the member name.\n\
+ -j (This option is accepted, but is ignored).\n\
+ -l (This option is accepted, but is ignored).\n\
+ -o Preserve modification times when extracting members.\n\
+ -u Conditionally update or extract members.\n\
+ -v Be verbose.\n\
+ -z (This option is accepted, but is ignored).\n\
+ -C Do not overwrite existing files in the file system.\n\
+ -D Use fixed metadata, for consistent archive checksums.\n\
+ -F FORMAT | --flavor=FORMAT\n\
+ Create archives with the specified format.\n\
+ -S Do not generate an archive symbol table.\n"
+
+static void
+bsdar_usage(void)
+{
+ (void) fprintf(stderr, AR_USAGE_MESSAGE, ELFTC_GETPROGNAME());
+ exit(EXIT_FAILURE);
+}
+
+#define RANLIB_USAGE_MESSAGE "\
+Usage: %s [options] archive...\n\
+ Update or create archive symbol tables.\n\n\
+ Options:\n\
+ -t (This option is accepted, but ignored).\n\
+ -D Use fixed metadata, for consistent archive checksums.\n\
+ -V Print a version identifier and exit.\n"
+
+static void
+ranlib_usage(void)
+{
+ (void)fprintf(stderr, RANLIB_USAGE_MESSAGE, ELFTC_GETPROGNAME());
+ exit(EXIT_FAILURE);
+}
+
+static void
+bsdar_version(void)
+{
+ (void)printf("%s (%s, %s)\n", ELFTC_GETPROGNAME(), archive_version_string(),
+ elftc_version());
+ exit(EXIT_SUCCESS);
+}
diff --git a/ar/ar.h b/ar/ar.h
new file mode 100644
index 000000000000..a75b9a9eb856
--- /dev/null
+++ b/ar/ar.h
@@ -0,0 +1,143 @@
+/*-
+ * Copyright (c) 2007 Kai Wang
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $Id: ar.h 2496 2012-04-24 02:33:40Z jkoshy $
+ */
+
+#include <libelf.h>
+
+#include "_elftc.h"
+
+/*
+ * ar(1) options.
+ */
+#define AR_A 0x0001 /* position-after */
+#define AR_B 0x0002 /* position-before */
+#define AR_C 0x0004 /* creating new archive */
+#define AR_CC 0x0008 /* do not overwrite when extracting */
+#define AR_J 0x0010 /* bzip2 compression */
+#define AR_O 0x0020 /* preserve original mtime when extracting */
+#define AR_S 0x0040 /* write archive symbol table */
+#define AR_SS 0x0080 /* do not write archive symbol table */
+#define AR_TR 0x0100 /* only keep first 15 chars for member name */
+#define AR_U 0x0200 /* only extract or update newer members.*/
+#define AR_V 0x0400 /* verbose mode */
+#define AR_Z 0x0800 /* gzip compression */
+#define AR_D 0x1000 /* insert dummy mode, mtime, uid and gid */
+#define AR_BSD 0x2000 /* use the BSD archive format */
+
+#define DEF_BLKSZ 10240 /* default block size */
+
+/* Special names. */
+
+#define AR_STRINGTAB_NAME_SVR4 "//"
+#define AR_SYMTAB_NAME_BSD "__.SYMDEF"
+#define AR_SYMTAB_NAME_SVR4 "/"
+
+/*
+ * Convenient wrapper for general libarchive error handling.
+ */
+#define AC(CALL) do { \
+ if ((CALL)) \
+ bsdar_errc(bsdar, 0, "%s", \
+ archive_error_string(a)); \
+} while (0)
+
+/*
+ * The 'ACV' wrapper is used for libarchive APIs that changed from
+ * returning 'void' to returning an 'int' in later versions of libarchive.
+ */
+#if ARCHIVE_VERSION_NUMBER >= 2000000
+#define ACV(CALL) AC(CALL)
+#else
+#define ACV(CALL) do { \
+ (CALL); \
+ } while (0)
+#endif
+
+/*
+ * In-memory representation of archive member(object).
+ */
+struct ar_obj {
+ Elf *elf; /* object file descriptor */
+ char *name; /* member name */
+ uid_t uid; /* user id */
+ gid_t gid; /* group id */
+ mode_t md; /* octal file permissions */
+ size_t size; /* member size */
+ time_t mtime; /* modification time */
+ dev_t dev; /* inode's device */
+ ino_t ino; /* inode's number */
+
+ TAILQ_ENTRY(ar_obj) objs;
+};
+
+/*
+ * Structure encapsulates the "global" data for "ar" program.
+ */
+struct bsdar {
+ const char *filename; /* archive name. */
+ const char *addlib; /* target of ADDLIB. */
+ const char *posarg; /* position arg for modifiers -a, -b. */
+ char mode; /* program mode */
+ int options; /* command line options */
+ FILE *output; /* default output stream */
+
+ const char *progname; /* program name */
+ int argc;
+ char **argv;
+
+ dev_t ar_dev; /* archive device. */
+ ino_t ar_ino; /* archive inode. */
+
+ /*
+ * Fields for the archive string table.
+ */
+ char *as; /* buffer for archive string table. */
+ size_t as_sz; /* current size of as table. */
+ size_t as_cap; /* capacity of as table buffer. */
+
+ /*
+ * Fields for the archive symbol table.
+ */
+ uint32_t s_cnt; /* current number of symbols. */
+ uint32_t *s_so; /* symbol offset table. */
+ size_t s_so_cap; /* capacity of so table buffer. */
+ char *s_sn; /* symbol name table */
+ size_t s_sn_cap; /* capacity of sn table buffer. */
+ size_t s_sn_sz; /* current size of sn table. */
+ /* Current member's offset (relative to the end of pseudo members.) */
+ off_t rela_off;
+
+ TAILQ_HEAD(, ar_obj) v_obj; /* object(member) list */
+};
+
+void ar_mode_script(struct bsdar *ar);
+void ar_read_archive(struct bsdar *_ar, int _mode);
+void ar_write_archive(struct bsdar *_ar, int _mode);
+void bsdar_errc(struct bsdar *, int _code, const char *fmt, ...);
+int bsdar_is_pseudomember(struct bsdar *_ar, const char *_name);
+const char *bsdar_strmode(mode_t m);
+void bsdar_warnc(struct bsdar *, int _code, const char *fmt, ...);
diff --git a/ar/benchmark/acp.sh b/ar/benchmark/acp.sh
new file mode 100755
index 000000000000..11be68bf401e
--- /dev/null
+++ b/ar/benchmark/acp.sh
@@ -0,0 +1,65 @@
+#!/bin/sh
+# $Id: acp.sh 2086 2011-10-27 05:18:01Z jkoshy $
+
+# This script is adapted from Jan Psota's Tar Comparison Program(TCP).
+
+n=3 # number of repetitions
+AR="bsdar gnuar" # ar archivers to compare
+
+test $# -ge 2 || {
+ echo "usage: $0 source_dir where_to_place_archive [where_to_extract_it]"
+ exit 0
+}
+
+THISDIR=`/bin/pwd`
+src=$1
+dst=$2/acp.a
+ext=${3:-$2}/acptmp
+test -e $dst -o -e /tmp/acp \
+ && { echo "$dst or /tmp/acp exists, exiting"; exit 1; }
+mkdir -p $ext || exit 1
+
+show_result ()
+{
+ awk -vL="`du -k $dst`" '{printf "%s\t%s\t%s\%10.1d KB/s\n",
+$1, $3, $5, ($1>0?L/$1:0)}' /tmp/acp | sort | head -n 1
+}
+
+test -d $src || { echo "'$src' is not a directory"; exit 1; }
+
+# ar versions
+for ar in $AR; do echo -n "$ar: "; $ar -V | head -n 1;
+done
+
+echo
+echo "best time of $n repetitions"
+echo -n " src=$src, "
+echo -n "`du -sh $src | awk '{print $1}'`"
+echo -n " in "
+echo "`find $src | wc -l` files"
+echo " archive=$dst, extract to $ext"
+
+echo "program operation real user system speed"
+for op in "cru $dst $src/*" "t $dst" "x `basename $dst`"; do
+ for ar in $AR; do
+ echo -n "$ar "
+ echo $op | grep -q ^cr && echo -n "create "
+ echo $op | grep -q ^t && echo -n "list "
+ echo $op | grep -q ^x && echo -n "extract "
+ num=0
+ while [ $num -lt $n ]; do
+ echo $op | grep -q ^cr && rm -f $dst
+ echo $op | grep -q ^x && { rm -rf $ext; mkdir -p $ext
+ cp $dst $ext; cd $ext; }
+ sync
+ time $ar $op > /dev/null 2>> /tmp/acp
+ echo $op | grep -q ^x && cd $THISDIR
+ num=`expr $num + 1`
+ done
+ show_result
+ rm -rf /tmp/acp
+ done
+ echo
+done
+rm -rf $ext $dst
+rm -f /tmp/acp
diff --git a/ar/ranlib.1 b/ar/ranlib.1
new file mode 100644
index 000000000000..0f47deaad04e
--- /dev/null
+++ b/ar/ranlib.1
@@ -0,0 +1,86 @@
+.\" Copyright (c) 2007,2009-2012 Joseph Koshy. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" This software is provided by Joseph Koshy ``as is'' and
+.\" any express or implied warranties, including, but not limited to, the
+.\" implied warranties of merchantability and fitness for a particular purpose
+.\" are disclaimed. in no event shall Joseph Koshy be liable
+.\" for any direct, indirect, incidental, special, exemplary, or consequential
+.\" damages (including, but not limited to, procurement of substitute goods
+.\" or services; loss of use, data, or profits; or business interruption)
+.\" however caused and on any theory of liability, whether in contract, strict
+.\" liability, or tort (including negligence or otherwise) arising in any way
+.\" out of the use of this software, even if advised of the possibility of
+.\" such damage.
+.\"
+.\" $Id: ranlib.1 2739 2012-12-09 17:07:46Z jkoshy $
+.\"
+.Dd December 9, 2012
+.Os
+.Dt RANLIB 1
+.Sh NAME
+.Nm ranlib
+.Nd update archive symbol tables
+.Sh SYNOPSIS
+.Nm
+.Op Fl D
+.Op Fl t
+.Ar archive Ns ...
+.Nm
+.Fl V
+.Sh DESCRIPTION
+The
+.Nm ranlib
+utility is used to update an existing archive symbol table in an
+.Xr ar 1
+archive, or to add an archive symbol table to an archive lacking one.
+.Sh OPTIONS
+The
+.Nm
+utility supports the following options:
+.Bl -tag -width indent
+.It Fl D
+Use zeros for the mtime, uid and gid fields, and use mode 0644 for the
+file mode field for all archive member headers.
+This ensures that checksums on the resulting archives are reproducible
+when member contents are identical.
+.It Fl t
+This option is accepted, but is ignored.
+.It Fl V
+Print a version identifier and exit.
+.El
+.Sh EXAMPLES
+To update the archive symbol table for an archive
+.Pa lib.a ,
+use:
+.Dl "ranlib lib.a"
+.Sh DIAGNOSTICS
+.Ex -std
+.Sh SEE ALSO
+.Xr ar 1 ,
+.Xr ld 1 ,
+.Xr archive 3 ,
+.Xr elf 3 ,
+.Xr ar 5
+.Sh HISTORY
+The
+.Nm
+command first appeared in AT&T UNIX Version 7.
+.Pp
+In
+.Fx 8.0 ,
+.An "Kai Wang" Aq kaiw@FreeBSD.org
+reimplemented
+.Nm
+using the
+.Lb libarchive
+and the
+.Lb libelf .
diff --git a/ar/read.c b/ar/read.c
new file mode 100644
index 000000000000..6c2affe57438
--- /dev/null
+++ b/ar/read.c
@@ -0,0 +1,192 @@
+/*-
+ * Copyright (c) 2007 Kai Wang
+ * Copyright (c) 2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+#include <sys/queue.h>
+#include <sys/stat.h>
+
+#include <archive.h>
+#include <archive_entry.h>
+#include <assert.h>
+#include <errno.h>
+#include <libgen.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "ar.h"
+
+ELFTC_VCSID("$Id: read.c 2229 2011-11-27 13:25:37Z jkoshy $");
+
+/*
+ * Handle read modes: 'x', 't' and 'p'.
+ */
+void
+ar_read_archive(struct bsdar *bsdar, int mode)
+{
+ FILE *out;
+ struct archive *a;
+ struct archive_entry *entry;
+ struct stat sb;
+ struct tm *tp;
+ const char *bname;
+ const char *name;
+ mode_t md;
+ size_t size;
+ time_t mtime;
+ uid_t uid;
+ gid_t gid;
+ char **av;
+ char buf[25];
+ char find;
+ int i, flags, r;
+
+ assert(mode == 'p' || mode == 't' || mode == 'x');
+
+ if ((a = archive_read_new()) == NULL)
+ bsdar_errc(bsdar, 0, "archive_read_new failed");
+ archive_read_support_compression_none(a);
+ archive_read_support_format_ar(a);
+ AC(archive_read_open_file(a, bsdar->filename, DEF_BLKSZ));
+
+ out = bsdar->output;
+
+ for (;;) {
+ r = archive_read_next_header(a, &entry);
+ if (r == ARCHIVE_WARN || r == ARCHIVE_RETRY ||
+ r == ARCHIVE_FATAL)
+ bsdar_warnc(bsdar, 0, "%s", archive_error_string(a));
+ if (r == ARCHIVE_EOF || r == ARCHIVE_FATAL)
+ break;
+ if (r == ARCHIVE_RETRY) {
+ bsdar_warnc(bsdar, 0, "Retrying...");
+ continue;
+ }
+
+ if (archive_format(a) == ARCHIVE_FORMAT_AR_BSD)
+ bsdar->options |= AR_BSD;
+ else
+ bsdar->options &= ~AR_BSD;
+
+ name = archive_entry_pathname(entry);
+
+ /* Skip pseudo members. */
+ if (bsdar_is_pseudomember(bsdar, name))
+ continue;
+
+ if (bsdar->argc > 0) {
+ find = 0;
+ for(i = 0; i < bsdar->argc; i++) {
+ av = &bsdar->argv[i];
+ if (*av == NULL)
+ continue;
+ if ((bname = basename(*av)) == NULL)
+ bsdar_errc(bsdar, errno,
+ "basename failed");
+ if (strcmp(bname, name) != 0)
+ continue;
+
+ *av = NULL;
+ find = 1;
+ break;
+ }
+ if (!find)
+ continue;
+ }
+
+ if (mode == 't') {
+ if (bsdar->options & AR_V) {
+ md = archive_entry_mode(entry);
+ uid = archive_entry_uid(entry);
+ gid = archive_entry_gid(entry);
+ size = archive_entry_size(entry);
+ mtime = archive_entry_mtime(entry);
+ (void)fprintf(out, "%s %6d/%-6d %8ju ",
+ bsdar_strmode(md) + 1, uid, gid,
+ (uintmax_t)size);
+ tp = localtime(&mtime);
+ (void)strftime(buf, sizeof(buf),
+ "%b %e %H:%M %Y", tp);
+ (void)fprintf(out, "%s %s", buf, name);
+ } else
+ (void)fprintf(out, "%s", name);
+ r = archive_read_data_skip(a);
+ if (r == ARCHIVE_WARN || r == ARCHIVE_RETRY ||
+ r == ARCHIVE_FATAL) {
+ (void)fprintf(out, "\n");
+ bsdar_warnc(bsdar, 0, "%s",
+ archive_error_string(a));
+ }
+
+ if (r == ARCHIVE_FATAL)
+ break;
+
+ (void)fprintf(out, "\n");
+ } else {
+ /* mode == 'x' || mode = 'p' */
+ if (mode == 'p') {
+ if (bsdar->options & AR_V) {
+ (void)fprintf(out, "\n<%s>\n\n",
+ name);
+ fflush(out);
+ }
+ r = archive_read_data_into_fd(a, fileno(out));
+ } else {
+ /* mode == 'x' */
+ if (stat(name, &sb) != 0) {
+ if (errno != ENOENT) {
+ bsdar_warnc(bsdar, 0,
+ "stat %s failed",
+ bsdar->filename);
+ continue;
+ }
+ } else {
+ /* stat success, file exist */
+ if (bsdar->options & AR_CC)
+ continue;
+ if (bsdar->options & AR_U &&
+ archive_entry_mtime(entry) <=
+ sb.st_mtime)
+ continue;
+ }
+
+ if (bsdar->options & AR_V)
+ (void)fprintf(out, "x - %s\n", name);
+ flags = 0;
+ if (bsdar->options & AR_O)
+ flags |= ARCHIVE_EXTRACT_TIME;
+
+ r = archive_read_extract(a, entry, flags);
+ }
+
+ if (r)
+ bsdar_warnc(bsdar, 0, "%s",
+ archive_error_string(a));
+ }
+ }
+ AC(archive_read_close(a));
+ ACV(archive_read_finish(a));
+}
diff --git a/ar/util.c b/ar/util.c
new file mode 100644
index 000000000000..8ed877a60269
--- /dev/null
+++ b/ar/util.c
@@ -0,0 +1,185 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+#include <sys/queue.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "ar.h"
+
+ELFTC_VCSID("$Id: util.c 2130 2011-11-10 06:56:46Z jkoshy $");
+
+static void bsdar_vwarnc(struct bsdar *, int code,
+ const char *fmt, va_list ap);
+static void bsdar_verrc(struct bsdar *bsdar, int code,
+ const char *fmt, va_list ap);
+
+static void
+bsdar_vwarnc(struct bsdar *bsdar, int code, const char *fmt, va_list ap)
+{
+
+ fprintf(stderr, "%s: warning: ", bsdar->progname);
+ vfprintf(stderr, fmt, ap);
+ if (code != 0)
+ fprintf(stderr, ": %s", strerror(code));
+ fprintf(stderr, "\n");
+}
+
+void
+bsdar_warnc(struct bsdar *bsdar, int code, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ bsdar_vwarnc(bsdar, code, fmt, ap);
+ va_end(ap);
+}
+
+static void
+bsdar_verrc(struct bsdar *bsdar, int code, const char *fmt, va_list ap)
+{
+
+ fprintf(stderr, "%s: fatal: ", bsdar->progname);
+ vfprintf(stderr, fmt, ap);
+ if (code != 0)
+ fprintf(stderr, ": %s", strerror(code));
+ fprintf(stderr, "\n");
+}
+
+void
+bsdar_errc(struct bsdar *bsdar, int code, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ bsdar_verrc(bsdar, code, fmt, ap);
+ va_end(ap);
+ exit(EXIT_FAILURE);
+}
+
+#define AR_STRMODE_SIZE 12
+const char *
+bsdar_strmode(mode_t m)
+{
+ static char buf[AR_STRMODE_SIZE];
+
+#if ELFTC_HAVE_STRMODE
+ /* Use the system's strmode(3). */
+ strmode(m, buf);
+ return buf;
+
+#else
+ char c;
+
+ /*
+ * The first character of the string denotes the type of the
+ * entry.
+ */
+ if (S_ISBLK(m))
+ c = 'b';
+ else if (S_ISCHR(m))
+ c = 'c';
+ else if (S_ISDIR(m))
+ c = 'd';
+#if defined(S_ISFIFO)
+ else if (S_ISFIFO(m))
+ c = 'p';
+#endif
+#if defined(S_ISLNK)
+ else if (S_ISLNK(m))
+ c = 'l';
+#endif
+ else if (S_ISREG(m))
+ c = '-';
+#if defined(S_ISSOCK)
+ else if (S_ISSOCK(m))
+ c = 's';
+#endif
+ else
+ c = '?';
+ buf[0] = c;
+
+ /* The next 3 characters show permissions for the owner. */
+ buf[1] = (m & S_IRUSR) ? 'r' : '-';
+ buf[2] = m & S_IWUSR ? 'w' : '-';
+ if (m & S_ISUID)
+ c = (m & S_IXUSR) ? 's' : 'S';
+ else
+ c = (m & S_IXUSR) ? 'x' : '-';
+ buf[3] = c;
+
+ /* The next 3 characters describe permissions for the group. */
+ buf[4] = (m & S_IRGRP) ? 'r' : '-';
+ buf[5] = m & S_IWGRP ? 'w' : '-';
+ if (m & S_ISGID)
+ c = (m & S_IXGRP) ? 's' : 'S';
+ else
+ c = (m & S_IXGRP) ? 'x' : '-';
+ buf[6] = c;
+
+
+ /* The next 3 characters describe permissions for others. */
+ buf[7] = (m & S_IROTH) ? 'r' : '-';
+ buf[8] = m & S_IWOTH ? 'w' : '-';
+ if (m & S_ISVTX) /* sticky bit */
+ c = (m & S_IXOTH) ? 't' : 'T';
+ else
+ c = (m & S_IXOTH) ? 'x' : '-';
+ buf[9] = c;
+
+ /* End the string with a blank and NUL-termination. */
+ buf[10] = ' ';
+ buf[11] = '\0';
+
+ return buf;
+#endif /* !ELTC_HAVE_STRMODE */
+}
+
+int
+bsdar_is_pseudomember(struct bsdar *bsdar, const char *name)
+{
+ /*
+ * The "__.SYMDEF" member is special in the BSD format
+ * variant.
+ */
+ if (bsdar->options & AR_BSD)
+ return (strcmp(name, AR_SYMTAB_NAME_BSD) == 0);
+ else
+ /*
+ * The names "/ " and "// " are special in the SVR4
+ * variant.
+ */
+ return (strcmp(name, AR_STRINGTAB_NAME_SVR4) == 0 ||
+ strcmp(name, AR_SYMTAB_NAME_SVR4) == 0);
+}
diff --git a/ar/write.c b/ar/write.c
new file mode 100644
index 000000000000..f637d378f226
--- /dev/null
+++ b/ar/write.c
@@ -0,0 +1,978 @@
+/*-
+ * Copyright (c) 2007 Kai Wang
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF