aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog11
-rw-r--r--binutils/Makefile.am8
-rw-r--r--binutils/Makefile.in28
-rw-r--r--binutils/bfdtest1.c68
-rw-r--r--binutils/testsuite/ChangeLog8
-rw-r--r--binutils/testsuite/binutils-all/ar.exp29
6 files changed, 143 insertions, 9 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 3e8c2da..8b52cce 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,14 @@
+2012-08-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/14481
+ * Makefile.am (BFDTEST1_PROG): New.
+ (TEST_PROGS): Likewise.
+ (bfdtest1_DEPENDENCIES): Likewise.
+ (noinst_PROGRAMS): Add $(TEST_PROGS).
+ * Makefile.in: Regenerated.
+
+ * bfdtest1.c: New file.
+
2012-08-13 Ian Bolton <ian.bolton@arm.com>
Laurent Desnogues <laurent.desnogues@arm.com>
Jim MacArthur <jim.macarthur@arm.com>
diff --git a/binutils/Makefile.am b/binutils/Makefile.am
index 3364bee..f16de99 100644
--- a/binutils/Makefile.am
+++ b/binutils/Makefile.am
@@ -65,10 +65,15 @@ bin_PROGRAMS = $(SIZE_PROG) $(OBJDUMP_PROG) $(AR_PROG) $(STRINGS_PROG) $(RANLIB_
bin_SCRIPTS = @BUILD_INSTALL_MISC@
EXTRA_SCRIPTS = embedspu
+## Test programs.
+BFDTEST1_PROG = bfdtest1
+
+TEST_PROGS = $(BFDTEST1_PROG)
+
## We need a special rule to install the programs which are built with
## -new, and to rename cxxfilt to c++filt.
RENAMED_PROGS = $(NM_PROG) $(STRIP_PROG) $(DEMANGLER_PROG)
-noinst_PROGRAMS = $(RENAMED_PROGS) @BUILD_MISC@
+noinst_PROGRAMS = $(RENAMED_PROGS) $(TEST_PROGS) @BUILD_MISC@
EXTRA_PROGRAMS = $(NLMCONV_PROG) srconv sysdump coffdump $(DLLTOOL_PROG) $(WINDRES_PROG) $(WINDMC_PROG) $(DLLWRAP_PROG)
@@ -194,6 +199,7 @@ addr2line_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB)
readelf_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY)
elfedit_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY)
dllwrap_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY)
+bfdtest1_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB)
LDADD = $(BFDLIB) $(LIBIBERTY) $(LIBINTL)
diff --git a/binutils/Makefile.in b/binutils/Makefile.in
index 94331be..59b10aa 100644
--- a/binutils/Makefile.in
+++ b/binutils/Makefile.in
@@ -41,7 +41,7 @@ bin_PROGRAMS = $(am__EXEEXT_6) $(am__EXEEXT_7) $(am__EXEEXT_8) \
@BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ \
@BUILD_WINDMC@ $(am__EXEEXT_12) $(am__EXEEXT_13) \
$(am__EXEEXT_14) @BUILD_DLLWRAP@
-noinst_PROGRAMS = $(am__EXEEXT_18) @BUILD_MISC@
+noinst_PROGRAMS = $(am__EXEEXT_18) $(am__EXEEXT_20) @BUILD_MISC@
EXTRA_PROGRAMS = $(am__EXEEXT_1) srconv$(EXEEXT) sysdump$(EXEEXT) \
coffdump$(EXEEXT) $(am__EXEEXT_2) $(am__EXEEXT_3) \
$(am__EXEEXT_4) $(am__EXEEXT_5)
@@ -101,6 +101,8 @@ am__EXEEXT_15 = nm-new$(EXEEXT)
am__EXEEXT_16 = strip-new$(EXEEXT)
am__EXEEXT_17 = cxxfilt$(EXEEXT)
am__EXEEXT_18 = $(am__EXEEXT_15) $(am__EXEEXT_16) $(am__EXEEXT_17)
+am__EXEEXT_19 = bfdtest1$(EXEEXT)
+am__EXEEXT_20 = $(am__EXEEXT_19)
PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
am__objects_1 = bucomm.$(OBJEXT) version.$(OBJEXT) filemode.$(OBJEXT)
am_addr2line_OBJECTS = addr2line.$(OBJEXT) $(am__objects_1)
@@ -111,6 +113,9 @@ am_ar_OBJECTS = arparse.$(OBJEXT) arlex.$(OBJEXT) ar.$(OBJEXT) \
not-ranlib.$(OBJEXT) arsup.$(OBJEXT) rename.$(OBJEXT) \
binemul.$(OBJEXT) emul_$(EMULATION).$(OBJEXT) $(am__objects_1)
ar_OBJECTS = $(am_ar_OBJECTS)
+bfdtest1_SOURCES = bfdtest1.c
+bfdtest1_OBJECTS = bfdtest1.$(OBJEXT)
+bfdtest1_LDADD = $(LDADD)
am_coffdump_OBJECTS = coffdump.$(OBJEXT) coffgrok.$(OBJEXT) \
$(am__objects_1)
coffdump_OBJECTS = $(am_coffdump_OBJECTS)
@@ -221,13 +226,13 @@ YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS)
LTYACCCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(YACC) $(YFLAGS) $(AM_YFLAGS)
SOURCES = $(addr2line_SOURCES) $(ar_SOURCES) $(EXTRA_ar_SOURCES) \
- $(coffdump_SOURCES) $(cxxfilt_SOURCES) $(dlltool_SOURCES) \
- $(dllwrap_SOURCES) $(elfedit_SOURCES) $(nlmconv_SOURCES) \
- $(nm_new_SOURCES) $(objcopy_SOURCES) $(objdump_SOURCES) \
- $(EXTRA_objdump_SOURCES) $(ranlib_SOURCES) $(readelf_SOURCES) \
- $(size_SOURCES) $(srconv_SOURCES) $(strings_SOURCES) \
- $(strip_new_SOURCES) $(sysdump_SOURCES) $(windmc_SOURCES) \
- $(windres_SOURCES)
+ bfdtest1.c $(coffdump_SOURCES) $(cxxfilt_SOURCES) \
+ $(dlltool_SOURCES) $(dllwrap_SOURCES) $(elfedit_SOURCES) \
+ $(nlmconv_SOURCES) $(nm_new_SOURCES) $(objcopy_SOURCES) \
+ $(objdump_SOURCES) $(EXTRA_objdump_SOURCES) $(ranlib_SOURCES) \
+ $(readelf_SOURCES) $(size_SOURCES) $(srconv_SOURCES) \
+ $(strings_SOURCES) $(strip_new_SOURCES) $(sysdump_SOURCES) \
+ $(windmc_SOURCES) $(windres_SOURCES)
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
@@ -443,6 +448,8 @@ DLLWRAP_PROG = dllwrap
SRCONV_PROG = srconv$(EXEEXT) sysdump$(EXEEXT) coffdump$(EXEEXT)
bin_SCRIPTS = @BUILD_INSTALL_MISC@
EXTRA_SCRIPTS = embedspu
+BFDTEST1_PROG = bfdtest1
+TEST_PROGS = $(BFDTEST1_PROG)
RENAMED_PROGS = $(NM_PROG) $(STRIP_PROG) $(DEMANGLER_PROG)
# Stuff that goes in tooldir/ if appropriate.
@@ -537,6 +544,7 @@ addr2line_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB)
readelf_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY)
elfedit_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY)
dllwrap_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY)
+bfdtest1_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB)
LDADD = $(BFDLIB) $(LIBIBERTY) $(LIBINTL)
size_SOURCES = size.c $(BULIBS)
objcopy_SOURCES = objcopy.c not-strip.c rename.c $(WRITE_DEBUG_SRCS) $(BULIBS)
@@ -710,6 +718,9 @@ arparse.h: arparse.c
ar$(EXEEXT): $(ar_OBJECTS) $(ar_DEPENDENCIES)
@rm -f ar$(EXEEXT)
$(LINK) $(ar_OBJECTS) $(ar_LDADD) $(LIBS)
+bfdtest1$(EXEEXT): $(bfdtest1_OBJECTS) $(bfdtest1_DEPENDENCIES)
+ @rm -f bfdtest1$(EXEEXT)
+ $(LINK) $(bfdtest1_OBJECTS) $(bfdtest1_LDADD) $(LIBS)
coffdump$(EXEEXT): $(coffdump_OBJECTS) $(coffdump_DEPENDENCIES)
@rm -f coffdump$(EXEEXT)
$(LINK) $(coffdump_OBJECTS) $(coffdump_LDADD) $(LIBS)
@@ -830,6 +841,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arlex.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arparse.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arsup.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bfdtest1.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bin2c.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/binemul.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bucomm.Po@am__quote@
diff --git a/binutils/bfdtest1.c b/binutils/bfdtest1.c
new file mode 100644
index 0000000..b246a04
--- /dev/null
+++ b/binutils/bfdtest1.c
@@ -0,0 +1,68 @@
+/* A program to test BFD.
+ Copyright 2012 Free Software Foundation, Inc.
+
+ This file is part of the GNU Binutils.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+#include "sysdep.h"
+#include "bfd.h"
+
+static void
+die (const char *s)
+{
+ printf ("oops: %s\n", s);
+ exit (1);
+}
+
+int
+main (int argc, char **argv)
+{
+ bfd *archive;
+ bfd *last, *next;
+
+ if (argc != 2)
+ die ("bad usage");
+
+ archive = bfd_openr (argv[1], NULL);
+
+ if (!bfd_check_format (archive, bfd_archive))
+ {
+ bfd_close (archive);
+ die ("bfd_check_format");
+ }
+
+ for (last = bfd_openr_next_archived_file (archive, NULL);
+ last;
+ last = next)
+ {
+ next = bfd_openr_next_archived_file (archive, last);
+ bfd_close (last);
+ }
+
+ for (last = bfd_openr_next_archived_file (archive, NULL);
+ last;
+ last = next)
+ {
+ next = bfd_openr_next_archived_file (archive, last);
+ bfd_close (last);
+ }
+
+ if (!bfd_close (archive))
+ die ("bfd_close");
+
+ return 0;
+}
diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog
index 98555df..d7d3a04 100644
--- a/binutils/testsuite/ChangeLog
+++ b/binutils/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2012-08-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/14481
+ * ar.exp (bfdtest1): New.
+ (long_filenames): Run bfdtest1.
+ (thin_archive): Likewise.
+ (thin_archive_with_nested): Likewise.
+
2012-08-13 Ian Bolton <ian.bolton@arm.com>
Laurent Desnogues <laurent.desnogues@arm.com>
Jim MacArthur <jim.macarthur@arm.com>
diff --git a/binutils/testsuite/binutils-all/ar.exp b/binutils/testsuite/binutils-all/ar.exp
index 0caa847..c66c43e 100644
--- a/binutils/testsuite/binutils-all/ar.exp
+++ b/binutils/testsuite/binutils-all/ar.exp
@@ -27,6 +27,8 @@ if ![is_remote host] {
}
}
+set bfdtest1 [findfile $base_dir/bfdtest1]
+
# send_user "Version [binutil_version $AR]"
# Test long file name support
@@ -34,6 +36,7 @@ if ![is_remote host] {
proc long_filenames { } {
global AR
global host_triplet
+ global bfdtest1
set testname "ar long file names"
@@ -124,6 +127,14 @@ proc long_filenames { } {
return
}
+ verbose -log "$bfdtest1 $dest"
+ set exec_output [binutils_run $bfdtest1 "$dest"]
+ if ![string match "" $exec_output] {
+ verbose -log $exec_output
+ fail "$testname (bfdtest1)"
+ return
+ }
+
if [is_remote host] {
remote_upload host $n1 tmpdir/$n1
remote_upload host $n2 tmpdir/$n2
@@ -224,6 +235,7 @@ proc thin_archive { } {
global NM
global srcdir
global subdir
+ global bfdtest1
set testname "ar thin archive"
@@ -249,6 +261,14 @@ proc thin_archive { } {
return
}
+ verbose -log "$bfdtest1 $archive"
+ set exec_output [binutils_run $bfdtest1 "$archive"]
+ if ![string match "" $exec_output] {
+ verbose -log $exec_output
+ fail "$testname (bfdtest1)"
+ return
+ }
+
set got [binutils_run $NM "--print-armap $archive"]
if { ![string match "*text_symbol in *bintest.o*" $got] \
|| ![string match "*data_symbol in *bintest.o*" $got] \
@@ -271,6 +291,7 @@ proc thin_archive_with_nested { } {
global NM
global srcdir
global subdir
+ global bfdtest1
set testname "ar thin archive with nested archive"
@@ -306,6 +327,14 @@ proc thin_archive_with_nested { } {
return
}
+ verbose -log "$bfdtest1 $archive"
+ set exec_output [binutils_run $bfdtest1 "$archive"]
+ if ![string match "" $exec_output] {
+ verbose -log $exec_output
+ fail "$testname (bfdtest1)"
+ return
+ }
+
set got [binutils_run $NM "--print-armap $archive"]
if { ![string match "*text_symbol in *bintest.o*" $got] \
|| ![string match "*data_symbol in *bintest.o*" $got] \