mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-11-16 12:34:43 +00:00
Compare commits
84 Commits
gdb-8.2-re
...
gdb_5_0-20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88cfc08ef5 | ||
|
|
2aac9d09df | ||
|
|
7c918888f6 | ||
|
|
d3be96bea9 | ||
|
|
875b74fd3f | ||
|
|
9a7ab2161e | ||
|
|
cf294b2442 | ||
|
|
eb86a940c8 | ||
|
|
4cd2d06ff0 | ||
|
|
f3fafc2120 | ||
|
|
bc4516fb7a | ||
|
|
ea495fea60 | ||
|
|
f829970fc4 | ||
|
|
cc613b8d96 | ||
|
|
6bf308561d | ||
|
|
5b7ac16982 | ||
|
|
bcff17218d | ||
|
|
d1859a5359 | ||
|
|
0bfd239509 | ||
|
|
b5bd9fd151 | ||
|
|
06a91f49f3 | ||
|
|
c0cceafa48 | ||
|
|
8b8433a0d2 | ||
|
|
6567e7b210 | ||
|
|
f8e23704ac | ||
|
|
96ca257806 | ||
|
|
da6ca1eea2 | ||
|
|
d5321dc35a | ||
|
|
f1ed6b88db | ||
|
|
b6a4d64e9d | ||
|
|
c0e61ea6c9 | ||
|
|
9135f0fa35 | ||
|
|
a063581072 | ||
|
|
3321595dc9 | ||
|
|
3d026853d2 | ||
|
|
69bcdfccc4 | ||
|
|
4c9387f61f | ||
|
|
642f6e8e34 | ||
|
|
d7bf706049 | ||
|
|
3c0e93f96d | ||
|
|
2f74b3388e | ||
|
|
0d6e201f19 | ||
|
|
5a1a891d13 | ||
|
|
f9e1f60f3e | ||
|
|
18f11b7fdf | ||
|
|
156bc43f98 | ||
|
|
6cb12085f0 | ||
|
|
f3b6bd7f35 | ||
|
|
e63aa406a4 | ||
|
|
2755414b7a | ||
|
|
3a037ac175 | ||
|
|
a1c52dda1b | ||
|
|
942eadaea5 | ||
|
|
1eaf51f64b | ||
|
|
8c37c0a893 | ||
|
|
3df8fb30de | ||
|
|
bf7e829457 | ||
|
|
1b6cfaff1e | ||
|
|
645af88bb4 | ||
|
|
86953df312 | ||
|
|
31b32d86bf | ||
|
|
70d0f8e089 | ||
|
|
08f4dd01dd | ||
|
|
ec115cb415 | ||
|
|
4f2604da3f | ||
|
|
69acdc827f | ||
|
|
0c5ca6a518 | ||
|
|
eaa1f1361d | ||
|
|
04c300ec02 | ||
|
|
529b5529f1 | ||
|
|
2f4abaf9f0 | ||
|
|
391cd2fa6c | ||
|
|
6a65c18d1d | ||
|
|
9a7fb91116 | ||
|
|
8f89eb795a | ||
|
|
d628709571 | ||
|
|
7ca185ed5b | ||
|
|
cb8ace88a4 | ||
|
|
ff484e52b4 | ||
|
|
d6de49f8df | ||
|
|
1e7943d138 | ||
|
|
0982cdc3d3 | ||
|
|
86a7ad1c2a | ||
|
|
e15042df38 |
45
ChangeLog
45
ChangeLog
@@ -1,3 +1,48 @@
|
||||
Mon May 29 13:50:03 2000 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* texinfo/texinfo.tex: Update. Version from makeinfo 4.0.
|
||||
|
||||
2000-05-08 Eli Zaretskii <eliz@is.elta.co.il>
|
||||
|
||||
* djunpack.bat: Change the Sed script to replace @V@ in fnchange.lst
|
||||
with the version name.
|
||||
|
||||
Thu Apr 27 11:01:48 2000 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* Makefile.in (do-tar-bz2, do-md5sum): Skip CVS directories when
|
||||
building file lists.
|
||||
|
||||
Wed Apr 26 17:03:53 2000 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* Makefile.in (do-djunpack): New target. Update djunpack.bat with
|
||||
current version information. Add to proto-toplev directory.
|
||||
(gdb-taz): Build do-djunpack.
|
||||
|
||||
2000-04-23 Eli Zaretskii <eliz@is.elta.co.il>
|
||||
|
||||
* djunpack.bat: New file.
|
||||
|
||||
Wed Apr 19 12:46:26 2000 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* Makefile.in (taz, gdb-taz, gas.tar.bz2, binutils.tar.bz2,
|
||||
gas+binutils.tar.bz2, libg++.tar.bz2, gnats.tar.bz2, gdb.tar.bz2,
|
||||
dejagnu.tar.bz2, gdb+dejagnu.tar.bz2, insight.tar.bz2,
|
||||
insight+dejagnu.tar.bz2, newlib.tar.bz2): Pass MD5PROG to sub-make.
|
||||
|
||||
Wed Apr 12 16:42:48 2000 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* Makefile.in (gdb-taz): New target. GDB specific archive.
|
||||
(do-md5sum): New target.
|
||||
(MD5PROG): Define.
|
||||
(PACKAGE): Default to TOOL.
|
||||
(VER): Default to a shell script.
|
||||
(taz): Rewrite target. Move real work to do-proto-toplev. Include
|
||||
md5 checksum generation.
|
||||
(do-proto-toplev): New target. Create $(PACKAGE)-$(VER) link.
|
||||
(do-tar-bz2): Delete creation of $(PACKAGE)-$(VER) link.
|
||||
(gdb.tar.bz2, dejagnu.tar.bz2, gdb+dejagnu.tar.bz2,
|
||||
insight.tar.bz2): Use gdb-taz to create archive.
|
||||
|
||||
Fri Apr 7 18:10:29 2000 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* configure (warn_cflags): Delete.
|
||||
|
||||
106
Makefile.in
106
Makefile.in
@@ -111,6 +111,7 @@ NM = nm
|
||||
LD = ld
|
||||
|
||||
BZIPPROG = bzip2
|
||||
MD5PROG = md5sum
|
||||
|
||||
# These values are substituted by configure.
|
||||
DEFAULT_YACC = yacc
|
||||
@@ -711,7 +712,6 @@ INSTALL_MODULES = \
|
||||
install-shellutils \
|
||||
install-sim \
|
||||
install-tar \
|
||||
install-texinfo \
|
||||
install-textutils \
|
||||
install-tgas \
|
||||
install-time \
|
||||
@@ -1690,9 +1690,52 @@ ETC_SUPPORT= Makefile.in configure configure.in standards.texi \
|
||||
# this macro.
|
||||
SUPPORT_FILES = list-of-support-files-for-tool-in-question
|
||||
|
||||
.PHONY: taz
|
||||
# NOTE: No double quotes in the below. It is used within shell script
|
||||
# as VER="$(VER)"
|
||||
VER = ` if grep AM_INIT_AUTOMAKE $(TOOL)/configure.in >/dev/null 2>&1; then \
|
||||
sed < $(TOOL)/configure.in -n 's/AM_INIT_AUTOMAKE[^,]*, *\([^)]*\))/\1/p'; \
|
||||
else \
|
||||
sed < $(TOOL)/Makefile.in -n 's/^VERSION *= *//p'; \
|
||||
fi`
|
||||
PACKAGE = $(TOOL)
|
||||
|
||||
.PHONY: taz
|
||||
taz: $(DEVO_SUPPORT) $(SUPPORT_FILES) texinfo/texinfo.tex
|
||||
$(MAKE) -f Makefile.in do-proto-toplev \
|
||||
TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
|
||||
MD5PROG="$(MD5PROG)" \
|
||||
SUPPORT_FILES="$(SUPPORT_FILES)"
|
||||
$(MAKE) -f Makefile.in do-md5sum \
|
||||
TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
|
||||
MD5PROG="$(MD5PROG)" \
|
||||
SUPPORT_FILES="$(SUPPORT_FILES)"
|
||||
$(MAKE) -f Makefile.in do-tar-bz2 \
|
||||
TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
|
||||
MD5PROG="$(MD5PROG)" \
|
||||
SUPPORT_FILES="$(SUPPORT_FILES)"
|
||||
|
||||
.PHONY: gdb-taz
|
||||
gdb-taz: $(DEVO_SUPPORT) $(SUPPORT_FILES) texinfo/texinfo.tex
|
||||
$(MAKE) -f Makefile.in do-proto-toplev \
|
||||
TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
|
||||
MD5PROG="$(MD5PROG)" \
|
||||
SUPPORT_FILES="$(SUPPORT_FILES)"
|
||||
$(MAKE) -f Makefile.in do-md5sum \
|
||||
TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
|
||||
MD5PROG="$(MD5PROG)" \
|
||||
SUPPORT_FILES="$(SUPPORT_FILES)"
|
||||
$(MAKE) -f Makefile.in do-djunpack \
|
||||
TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
|
||||
MD5PROG="$(MD5PROG)" \
|
||||
SUPPORT_FILES="$(SUPPORT_FILES)"
|
||||
$(MAKE) -f Makefile.in do-tar-bz2 \
|
||||
TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
|
||||
MD5PROG="$(MD5PROG)" \
|
||||
SUPPORT_FILES="$(SUPPORT_FILES)"
|
||||
|
||||
.PHONY: do-proto-toplev
|
||||
do-proto-toplev: $(DEVO_SUPPORT) $(SUPPORT_FILES) texinfo/texinfo.tex
|
||||
echo "==> Making $(PACKAGE)-$(VER)/"
|
||||
# Take out texinfo from a few places.
|
||||
sed -e '/^all\.normal: /s/\all-texinfo //' \
|
||||
-e '/^ install-texinfo /d' \
|
||||
@@ -1742,25 +1785,35 @@ taz: $(DEVO_SUPPORT) $(SUPPORT_FILES) texinfo/texinfo.tex
|
||||
ln -s ../../../texinfo/util/tex3patch proto-toplev/texinfo/util ; \
|
||||
else true; fi
|
||||
chmod -R og=u . || chmod og=u `find . -print`
|
||||
if grep AM_INIT_AUTOMAKE $(TOOL)/configure.in >/dev/null 2>&1; then \
|
||||
ver=`sed < $(TOOL)/configure.in -n 's/AM_INIT_AUTOMAKE[^,]*, *\([^)]*\))/\1/p'`; \
|
||||
else \
|
||||
ver=`sed <$(TOOL)/Makefile.in -n 's/^VERSION *= *//p'`; \
|
||||
fi; \
|
||||
if test x"$(PACKAGE)" = x; then \
|
||||
package="$(TOOL)"; \
|
||||
else \
|
||||
package="$(PACKAGE)"; \
|
||||
fi; \
|
||||
$(MAKE) -f Makefile.in do-tar-bz2 TOOL=$(TOOL) VER=$$ver PACKAGE=$$package
|
||||
|
||||
do-tar-bz2:
|
||||
echo "==> Making $(PACKAGE)-$(VER).tar.bz2"
|
||||
#
|
||||
-rm -f $(PACKAGE)-$(VER)
|
||||
ln -s proto-toplev $(PACKAGE)-$(VER)
|
||||
tar cfh $(PACKAGE)-$(VER).tar $(PACKAGE)-$(VER)
|
||||
|
||||
.PHONY: do-tar-bz2
|
||||
do-tar-bz2:
|
||||
echo "==> Making $(PACKAGE)-$(VER).tar.bz2"
|
||||
-rm -f $(PACKAGE)-$(VER).tar.bz2
|
||||
find $(PACKAGE)-$(VER) -follow -name CVS -prune -o -type f -print \
|
||||
| tar cTfh - $(PACKAGE)-$(VER).tar
|
||||
$(BZIPPROG) -v -9 $(PACKAGE)-$(VER).tar
|
||||
|
||||
.PHONY: do-md5sum
|
||||
do-md5sum:
|
||||
echo "==> Adding md5 checksum to top-level directory"
|
||||
cd proto-toplev && find * -follow -name CVS -prune -o -type f -print \
|
||||
| xargs $(MD5PROG) > ../md5.sum
|
||||
mv md5.sum proto-toplev
|
||||
|
||||
.PHONY: do-djunpack
|
||||
do-djunpack:
|
||||
echo "==> Adding updated djunpack.bat to top-level directory"
|
||||
echo - 's /gdb-[0-9\.]*/gdb-'"$(VER)"'/'
|
||||
sed < djunpack.bat > djunpack.new \
|
||||
-e 's/gdb-[0-9][0-9\.]*/gdb-'"$(VER)"'/'
|
||||
mv djunpack.new djunpack.bat
|
||||
-rm -f proto-toplev/djunpack.bat
|
||||
ln -s ../djunpack.bat proto-toplev/djunpack.bat
|
||||
|
||||
TEXINFO_SUPPORT= texinfo/texinfo.tex
|
||||
DIST_SUPPORT= $(DEVO_SUPPORT) $(TEXINFO_SUPPORT)
|
||||
|
||||
@@ -1768,6 +1821,7 @@ DIST_SUPPORT= $(DEVO_SUPPORT) $(TEXINFO_SUPPORT)
|
||||
GAS_SUPPORT_DIRS= bfd include libiberty opcodes intl setup.com makefile.vms mkdep
|
||||
gas.tar.bz2: $(DIST_SUPPORT) $(GAS_SUPPORT_DIRS) gas
|
||||
$(MAKE) -f Makefile.in taz TOOL=gas \
|
||||
MD5PROG="$(MD5PROG)" \
|
||||
SUPPORT_FILES="$(GAS_SUPPORT_DIRS)"
|
||||
|
||||
# The FSF "binutils" release includes gprof and ld.
|
||||
@@ -1775,53 +1829,62 @@ gas.tar.bz2: $(DIST_SUPPORT) $(GAS_SUPPORT_DIRS) gas
|
||||
BINUTILS_SUPPORT_DIRS= bfd gas include libiberty opcodes ld gprof intl setup.com makefile.vms mkdep
|
||||
binutils.tar.bz2: $(DIST_SUPPORT) $(BINUTILS_SUPPORT_DIRS) binutils
|
||||
$(MAKE) -f Makefile.in taz TOOL=binutils \
|
||||
MD5PROG="$(MD5PROG)" \
|
||||
SUPPORT_FILES="$(BINUTILS_SUPPORT_DIRS)"
|
||||
|
||||
.PHONY: gas+binutils.tar.bz2
|
||||
GASB_SUPPORT_DIRS= $(GAS_SUPPORT_DIRS) binutils ld gprof
|
||||
gas+binutils.tar.bz2: $(DIST_SUPPORT) $(GASB_SUPPORT_DIRS) gas
|
||||
$(MAKE) -f Makefile.in taz TOOL=gas \
|
||||
MD5PROG="$(MD5PROG)" \
|
||||
SUPPORT_FILES="$(GASB_SUPPORT_DIRS)"
|
||||
|
||||
.PHONY: libg++.tar.bz2
|
||||
LIBGXX_SUPPORT_DIRS=include libstdc++ libio librx libiberty
|
||||
libg++.tar.bz2: $(DIST_SUPPORT) libg++
|
||||
$(MAKE) -f Makefile.in taz TOOL=libg++ \
|
||||
MD5PROG="$(MD5PROG)" \
|
||||
SUPPORT_FILES="$(LIBGXX_SUPPORT_DIRS)"
|
||||
|
||||
GNATS_SUPPORT_DIRS=include libiberty send-pr
|
||||
gnats.tar.bz2: $(DIST_SUPPORT) $(GNATS_SUPPORT_DIRS) gnats
|
||||
$(MAKE) -f Makefile.in taz TOOL=gnats \
|
||||
MD5PROG="$(MD5PROG)" \
|
||||
SUPPORT_FILES="$(GNATS_SUPPORT_DIRS)"
|
||||
|
||||
.PHONY: gdb.tar.bz2
|
||||
GDB_SUPPORT_DIRS= bfd include libiberty mmalloc opcodes readline sim utils intl
|
||||
gdb.tar.bz2: $(DIST_SUPPORT) $(GDB_SUPPORT_DIRS) gdb
|
||||
$(MAKE) -f Makefile.in taz TOOL=gdb \
|
||||
$(MAKE) -f Makefile.in gdb-taz TOOL=gdb \
|
||||
MD5PROG="$(MD5PROG)" \
|
||||
SUPPORT_FILES="$(GDB_SUPPORT_DIRS)"
|
||||
|
||||
.PHONY: dejagnu.tar.bz2
|
||||
DEJAGNU_SUPPORT_DIRS= tcl expect libiberty
|
||||
dejagnu.tar.bz2: $(DIST_SUPPORT) $(DEJAGNU_SUPPORT_DIRS) dejagnu
|
||||
$(MAKE) -f Makefile.in taz TOOL=dejagnu \
|
||||
MD5PROG="$(MD5PROG)" \
|
||||
SUPPORT_FILES="$(DEJAGNU_SUPPORT_DIRS)"
|
||||
|
||||
.PHONY: gdb+dejagnu.tar.bz2
|
||||
GDBD_SUPPORT_DIRS= $(GDB_SUPPORT_DIRS) tcl expect dejagnu
|
||||
gdb+dejagnu.tar.bz2: $(DIST_SUPPORT) $(GDBD_SUPPORT_DIRS) gdb
|
||||
$(MAKE) -f Makefile.in taz TOOL=gdb PACKAGE=gdb+dejagnu \
|
||||
$(MAKE) -f Makefile.in gdb-taz TOOL=gdb PACKAGE=gdb+dejagnu \
|
||||
MD5PROG="$(MD5PROG)" \
|
||||
SUPPORT_FILES="$(GDBD_SUPPORT_DIRS)"
|
||||
|
||||
.PHONY: insight.tar.bz2
|
||||
INSIGHT_SUPPORT_DIRS= $(GDB_SUPPORT_DIRS) tcl tk itcl tix libgui
|
||||
insight.tar.bz2: $(DIST_SUPPORT) $(GDB_SUPPORT_DIRS) gdb
|
||||
$(MAKE) -f Makefile.in taz TOOL=gdb PACKAGE=insight \
|
||||
$(MAKE) -f Makefile.in gdb-taz TOOL=gdb PACKAGE=insight \
|
||||
MD5PROG="$(MD5PROG)" \
|
||||
SUPPORT_FILES="$(INSIGHT_SUPPORT_DIRS)"
|
||||
|
||||
.PHONY: insight+dejagnu.tar.bz2
|
||||
INSIGHTD_SUPPORT_DIRS= $(INSIGHT_SUPPORT_DIRS) expect dejagnu
|
||||
insight+dejagnu.tar.bz2: $(DIST_SUPPORT) $(INSIGHTD_SUPPORT_DIRS) gdb
|
||||
$(MAKE) -f Makefile.in taz TOOL=gdb PACKAGE="insight+dejagnu" \
|
||||
$(MAKE) -f Makefile.in gdb-taz TOOL=gdb PACKAGE="insight+dejagnu" \
|
||||
MD5PROG="$(MD5PROG)" \
|
||||
SUPPORT_FILES="$(INSIGHTD_SUPPORT_DIRS)"
|
||||
|
||||
.PHONY: newlib.tar.bz2
|
||||
@@ -1839,6 +1902,7 @@ NEWLIB_SUPPORT_DIRS=libgloss
|
||||
# supports newlib (if only minimally).
|
||||
newlib.tar.bz2: $(DIST_SUPPORT) $(NEWLIB_SUPPORT_DIRS) newlib
|
||||
$(MAKE) -f Makefile.in taz TOOL=newlib \
|
||||
MD5PROG="$(MD5PROG)" \
|
||||
SUPPORT_FILES="$(NEWLIB_SUPPORT_DIRS)" \
|
||||
DEVO_SUPPORT="$(DEVO_SUPPORT) COPYING.NEWLIB" newlib
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
Wed Apr 19 16:28:40 2000 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* bfd-in2.h: Re-generate.
|
||||
|
||||
Fri Apr 7 15:56:57 2000 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* configure.in (WARN_CFLAGS): Set to -W -Wall by default. Add
|
||||
|
||||
@@ -1058,9 +1058,9 @@ typedef struct sec
|
||||
#define SEC_SHARED 0x4000000
|
||||
|
||||
/* When a section with this flag is being linked, then if the size of
|
||||
the input section is less than a page, it should not cross a page
|
||||
boundary. If the size of the input section is one page or more, it
|
||||
should be aligned on a page boundary. */
|
||||
the input section is less than a page, it should not cross a page
|
||||
boundary. If the size of the input section is one page or more, it
|
||||
should be aligned on a page boundary. */
|
||||
#define SEC_BLOCK 0x8000000
|
||||
|
||||
/* Conditionally link this section; do not link if there are no
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
Wed Apr 26 17:57:26 2000 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* Makefile.in: Rebuild using autoconf/automake snapshot with fixed
|
||||
TEXINPUTS bug.
|
||||
|
||||
Fri Apr 7 17:54:38 2000 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* Makefile.in: Rebuild with current autoconf/automake.
|
||||
|
||||
@@ -212,7 +212,7 @@ DVIPS = dvips
|
||||
$(MAKEINFO) -I $(srcdir) $<
|
||||
|
||||
.texi.dvi:
|
||||
TEXINPUTS=$(top_srcdir)/../texinfo/texinfo.tex:$$TEXINPUTS \
|
||||
TEXINPUTS=$(top_srcdir)/../texinfo:$$TEXINPUTS \
|
||||
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
|
||||
|
||||
.texi:
|
||||
@@ -228,7 +228,7 @@ DVIPS = dvips
|
||||
$(MAKEINFO) -I $(srcdir) $<
|
||||
|
||||
.texinfo.dvi:
|
||||
TEXINPUTS=$(top_srcdir)/../texinfo/texinfo.tex:$$TEXINPUTS \
|
||||
TEXINPUTS=$(top_srcdir)/../texinfo:$$TEXINPUTS \
|
||||
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
|
||||
|
||||
.txi.info:
|
||||
@@ -236,7 +236,7 @@ DVIPS = dvips
|
||||
$(MAKEINFO) -I $(srcdir) $<
|
||||
|
||||
.txi.dvi:
|
||||
TEXINPUTS=$(top_srcdir)/../texinfo/texinfo.tex:$$TEXINPUTS \
|
||||
TEXINPUTS=$(top_srcdir)/../texinfo:$$TEXINPUTS \
|
||||
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
|
||||
|
||||
.txi:
|
||||
|
||||
7506
binutils/ChangeLog
7506
binutils/ChangeLog
File diff suppressed because it is too large
Load Diff
@@ -1,519 +0,0 @@
|
||||
## Process this file with automake to generate Makefile.in
|
||||
|
||||
## FIXME: Work around apparent bug in automake.
|
||||
INTLLIBS = @INTLLIBS@
|
||||
|
||||
AUTOMAKE_OPTIONS = cygnus dejagnu
|
||||
|
||||
SUBDIRS = po
|
||||
|
||||
tooldir = $(exec_prefix)/$(target_alias)
|
||||
|
||||
## These aren't set by automake, because they appear in
|
||||
## bfd/acinclude.m4, which is included by binutils/acinclude.m4, and
|
||||
## thus is not seen by automake.
|
||||
CC_FOR_BUILD = @CC_FOR_BUILD@
|
||||
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
|
||||
|
||||
YACC = `if [ -f ../bison/bison ]; then echo ../bison/bison -y -L$(srcdir)/../bison/; else echo @YACC@; fi`
|
||||
YFLAGS = -d
|
||||
LEX = `if [ -f ../flex/flex ]; then echo ../flex/flex; else echo @LEX@; fi`
|
||||
|
||||
WARN_CFLAGS = @WARN_CFLAGS@
|
||||
AM_CFLAGS = $(WARN_CFLAGS)
|
||||
|
||||
# these two are almost the same program
|
||||
AR_PROG=ar
|
||||
RANLIB_PROG=ranlib
|
||||
|
||||
# objcopy and strip should be the same program
|
||||
OBJCOPY_PROG=objcopy
|
||||
STRIP_PROG=strip-new
|
||||
|
||||
STRINGS_PROG=strings
|
||||
|
||||
READELF_PROG=readelf
|
||||
|
||||
# These should all be the same program too.
|
||||
SIZE_PROG=size
|
||||
NM_PROG=nm-new
|
||||
OBJDUMP_PROG=objdump
|
||||
|
||||
# This is the demangler, as a standalone program.
|
||||
# Note: This one is used as the installed name too, unlike the above.
|
||||
DEMANGLER_PROG=cxxfilt
|
||||
|
||||
ADDR2LINE_PROG=addr2line
|
||||
|
||||
NLMCONV_PROG=nlmconv
|
||||
DLLTOOL_PROG=dlltool
|
||||
WINDRES_PROG=windres
|
||||
DLLWRAP_PROG=dllwrap
|
||||
|
||||
SRCONV_PROG=srconv$(EXEEXT) sysdump$(EXEEXT) coffdump$(EXEEXT)
|
||||
|
||||
man_MANS = ar.1 nm.1 objdump.1 ranlib.1 size.1 strings.1 strip.1 objcopy.1 \
|
||||
addr2line.1 nlmconv.1 $(DEMANGLER_NAME).1
|
||||
|
||||
PROGS = $(SIZE_PROG) $(OBJDUMP_PROG) $(NM_PROG) $(AR_PROG) $(STRINGS_PROG) $(STRIP_PROG) $(RANLIB_PROG) $(DEMANGLER_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ $(ADDR2LINE_PROG) $(READELF_PROG) @BUILD_DLLWRAP@ @BUILD_MISC@
|
||||
|
||||
bin_PROGRAMS = $(SIZE_PROG) $(OBJDUMP_PROG) $(AR_PROG) $(STRINGS_PROG) $(RANLIB_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ $(ADDR2LINE_PROG) $(READELF_PROG) @BUILD_DLLWRAP@ @BUILD_MISC@
|
||||
|
||||
## We need a special rule to install the programs which are built with
|
||||
## -new, and to rename cxxfilt to c++filt.
|
||||
noinst_PROGRAMS = $(NM_PROG) $(STRIP_PROG) $(DEMANGLER_PROG)
|
||||
|
||||
EXTRA_PROGRAMS = $(NLMCONV_PROG) srconv sysdump coffdump $(DLLTOOL_PROG) $(WINDRES_PROG) $(DLLWRAP_PROG)
|
||||
|
||||
# Stuff that goes in tooldir/ if appropriate
|
||||
TOOL_PROGS = nm-new strip-new ar ranlib dlltool
|
||||
|
||||
BASEDIR = $(srcdir)/..
|
||||
BFDDIR = $(BASEDIR)/bfd
|
||||
INCDIR = $(BASEDIR)/include
|
||||
|
||||
MKDEP = gcc -MM
|
||||
|
||||
INCLUDES = -D_GNU_SOURCE -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) @HDEFINES@ -I$(srcdir)/../intl -I../intl -DLOCALEDIR="\"$(prefix)/share/locale\""
|
||||
|
||||
HFILES = arsup.h bucomm.h budbg.h coffgrok.h debug.h nlmconv.h dlltool.h \
|
||||
windres.h winduni.h dyn-string.h
|
||||
|
||||
GENERATED_HFILES = arparse.h sysroff.h sysinfo.h defparse.h rcparse.h
|
||||
|
||||
CFILES = addr2line.c ar.c arsup.c bucomm.c coffdump.c coffgrok.c debug.c \
|
||||
dlltool.c filemode.c ieee.c is-ranlib.c is-strip.c maybe-ranlib.c \
|
||||
maybe-strip.c nlmconv.c nm.c not-ranlib.c not-strip.c \
|
||||
objcopy.c objdump.c prdbg.c rdcoff.c rddbg.c size.c srconv.c \
|
||||
stabs.c strings.c sysdump.c version.c wrstabs.c \
|
||||
windres.c resrc.c rescoff.c resbin.c winduni.c readelf.c \
|
||||
resres.c dyn-string.c dllwrap.c rename.c
|
||||
|
||||
GENERATED_CFILES = \
|
||||
underscore.c arparse.c arlex.c sysroff.c sysinfo.c syslex.c \
|
||||
defparse.c deflex.c nlmheader.c rcparse.c rclex.c
|
||||
|
||||
DEBUG_SRCS = rddbg.c debug.c stabs.c ieee.c rdcoff.c
|
||||
WRITE_DEBUG_SRCS = $(DEBUG_SRCS) wrstabs.c
|
||||
|
||||
# Code shared by all the binutils.
|
||||
BULIBS = bucomm.c version.c filemode.c
|
||||
|
||||
BFDLIB = ../bfd/libbfd.la
|
||||
|
||||
OPCODES = ../opcodes/libopcodes.la
|
||||
|
||||
LIBIBERTY = ../libiberty/libiberty.a
|
||||
|
||||
POTFILES = $(CFILES) $(DEBUG_SRCS) $(HFILES)
|
||||
po/POTFILES.in: @MAINT@ Makefile
|
||||
for file in $(POTFILES); do echo $$file; done | sort > tmp \
|
||||
&& mv tmp $(srcdir)/po/POTFILES.in
|
||||
|
||||
EXPECT = `if [ -f $$r/../expect/expect ] ; then \
|
||||
echo $$r/../expect/expect ; \
|
||||
else echo expect ; fi`
|
||||
RUNTEST = `if [ -f ${srcdir}/../dejagnu/runtest ] ; then \
|
||||
echo ${srcdir}/../dejagnu/runtest ; \
|
||||
else echo runtest ; fi`
|
||||
|
||||
CC_FOR_TARGET = ` \
|
||||
if [ -f $$r/../gcc/xgcc ] ; then \
|
||||
if [ -f $$r/../newlib/Makefile ] ; then \
|
||||
echo $$r/../gcc/xgcc -B$$r/../gcc/ -idirafter $$r/../newlib/targ-include -idirafter $${srcroot}/../newlib/libc/include -nostdinc; \
|
||||
else \
|
||||
echo $$r/../gcc/xgcc -B$$r/../gcc/; \
|
||||
fi; \
|
||||
else \
|
||||
if [ "@host@" = "@target@" ] ; then \
|
||||
echo $(CC); \
|
||||
else \
|
||||
echo gcc | sed '$(transform)'; \
|
||||
fi; \
|
||||
fi`
|
||||
|
||||
check-DEJAGNU: site.exp
|
||||
srcdir=`cd $(srcdir) && pwd`; export srcdir; \
|
||||
r=`pwd`; export r; \
|
||||
EXPECT=$(EXPECT); export EXPECT; \
|
||||
if [ -f $(top_builddir)/../expect/expect ]; then \
|
||||
TCL_LIBRARY=`cd $(top_srcdir)/../tcl/library && pwd`; \
|
||||
export TCL_LIBRARY; \
|
||||
fi; \
|
||||
runtest=$(RUNTEST); \
|
||||
if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
|
||||
$$runtest --tool $(DEJATOOL) --srcdir $${srcdir}/testsuite \
|
||||
CC_FOR_TARGET="$(CC_FOR_TARGET)" \
|
||||
CFLAGS_FOR_TARGET="$(CFLAGS)" $(RUNTESTFLAGS); \
|
||||
else echo "WARNING: could not find \`runtest'" 1>&2; :;\
|
||||
fi
|
||||
|
||||
installcheck:
|
||||
/bin/sh $(srcdir)/sanity.sh $(bindir)
|
||||
|
||||
info_TEXINFOS = binutils.texi
|
||||
|
||||
LDADD = $(BFDLIB) $(LIBIBERTY) $(INTLLIBS)
|
||||
|
||||
size_SOURCES = size.c $(BULIBS)
|
||||
|
||||
objcopy_SOURCES = objcopy.c not-strip.c rename.c $(WRITE_DEBUG_SRCS) $(BULIBS)
|
||||
|
||||
strings_SOURCES = strings.c $(BULIBS)
|
||||
|
||||
readelf_SOURCES = readelf.c version.c
|
||||
readelf_LDADD = $(INTLLIBS) $(LIBIBERTY)
|
||||
|
||||
strip_new_SOURCES = objcopy.c is-strip.c rename.c $(WRITE_DEBUG_SRCS) $(BULIBS)
|
||||
|
||||
nm_new_SOURCES = nm.c $(BULIBS)
|
||||
|
||||
objdump_SOURCES = objdump.c prdbg.c $(DEBUG_SRCS) $(BULIBS)
|
||||
objdump_LDADD = $(OPCODES) $(BFDLIB) $(LIBIBERTY) $(INTLLIBS)
|
||||
|
||||
underscore.c: stamp-under ; @true
|
||||
|
||||
stamp-under: Makefile
|
||||
echo '/*WARNING: This file is automatically generated!*/' >underscore.t
|
||||
echo "int prepends_underscore = @UNDERSCORE@;" >>underscore.t
|
||||
$(SHELL) $(srcdir)/../move-if-change underscore.t underscore.c
|
||||
touch stamp-under
|
||||
|
||||
cplus-dem.o: $(BASEDIR)/libiberty/cplus-dem.c $(INCDIR)/getopt.h
|
||||
$(COMPILE) -c -DMAIN -DVERSION='"$(VERSION)"' $(BASEDIR)/libiberty/cplus-dem.c
|
||||
|
||||
cxxfilt_SOURCES =
|
||||
cxxfilt_LDADD = cplus-dem.o underscore.o $(LIBIBERTY) $(INTLLIBS)
|
||||
|
||||
ar_SOURCES = arparse.y arlex.l ar.c not-ranlib.c arsup.c rename.c $(BULIBS)
|
||||
ar_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS)
|
||||
|
||||
ranlib_SOURCES = ar.c is-ranlib.c arparse.y arlex.l arsup.c rename.c $(BULIBS)
|
||||
ranlib_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS)
|
||||
|
||||
addr2line_SOURCES = addr2line.c $(BULIBS)
|
||||
|
||||
# The following is commented out for the conversion to automake.
|
||||
# This rule creates a single binary that switches between ar and ranlib
|
||||
# by looking at argv[0]. Use this kludge to save some disk space.
|
||||
# However, you have to install things by hand.
|
||||
# (That is after 'make install', replace the installed ranlib by a link to ar.)
|
||||
# Alternatively, you can install ranlib.sh as ranlib.
|
||||
# ar_with_ranlib: $(ADDL_DEPS) ar.o maybe-ranlib.o
|
||||
# $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(AR_PROG) ar.o maybe-ranlib.o $(ADDL_LIBS) $(EXTRALIBS)
|
||||
# -rm -f $(RANLIB_PROG)
|
||||
# -ln $(AR_PROG) $(RANLIB_PROG)
|
||||
#
|
||||
# objcopy and strip in one binary that uses argv[0] to decide its action.
|
||||
#
|
||||
#objcopy_with_strip: $(ADDL_DEPS) objcopy.o maybe-strip.o
|
||||
# $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(OBJCOPY_PROG) objcopy.o maybe-strip.o $(ADDL_LIBS) $(EXTRALIBS)
|
||||
# -rm -f $(STRIP_PROG)
|
||||
# -ln $(OBJCOPY_PROG) $(STRIP_PROG)
|
||||
|
||||
sysroff.c: sysinfo$(EXEEXT_FOR_BUILD) sysroff.info
|
||||
./sysinfo$(EXEEXT_FOR_BUILD) -c <$(srcdir)/sysroff.info >sysroff.c
|
||||
./sysinfo$(EXEEXT_FOR_BUILD) -i <$(srcdir)/sysroff.info >>sysroff.c
|
||||
./sysinfo$(EXEEXT_FOR_BUILD) -g <$(srcdir)/sysroff.info >>sysroff.c
|
||||
|
||||
sysroff.h: sysinfo$(EXEEXT_FOR_BUILD) sysroff.info
|
||||
./sysinfo$(EXEEXT_FOR_BUILD) -d <$(srcdir)/sysroff.info >sysroff.h
|
||||
|
||||
sysinfo$(EXEEXT_FOR_BUILD): sysinfo.o syslex.o
|
||||
$(CC_FOR_BUILD) $(CFLAGS) $(LDFLAGS) -o $@ sysinfo.o syslex.o
|
||||
|
||||
syslex.o: syslex.c sysinfo.h
|
||||
if [ -r syslex.c ]; then \
|
||||
$(CC_FOR_BUILD) -c -I. $(CFLAGS) syslex.c ; \
|
||||
else \
|
||||
$(CC_FOR_BUILD) -c -I. -I$(srcdir) $(CFLAGS) $(srcdir)/syslex.c ;\
|
||||
fi
|
||||
|
||||
sysinfo.o: sysinfo.c
|
||||
if [ -r sysinfo.c ]; then \
|
||||
$(CC_FOR_BUILD) -c -I. $(CFLAGS) sysinfo.c ; \
|
||||
else \
|
||||
$(CC_FOR_BUILD) -c -I. $(CFLAGS) $(srcdir)/sysinfo.c ; \
|
||||
fi
|
||||
|
||||
# We need these for parallel make.
|
||||
arparse.h: arparse.c
|
||||
defparse.h: defparse.c
|
||||
nlmheader.h: nlmheader.c
|
||||
rcparse.h: rcparse.c
|
||||
sysinfo.h: sysinfo.c
|
||||
|
||||
srconv_SOURCES = srconv.c coffgrok.c $(BULIBS)
|
||||
|
||||
dlltool_SOURCES = dlltool.c defparse.y deflex.l dyn-string.c $(BULIBS)
|
||||
dlltool_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS)
|
||||
|
||||
dlltool.o:dlltool.c
|
||||
$(COMPILE) -c $(DLLTOOL_DEFS) $(srcdir)/dlltool.c
|
||||
|
||||
rescoff.o:rescoff.c
|
||||
$(COMPILE) -c $(DLLTOOL_DEFS) $(srcdir)/rescoff.c
|
||||
|
||||
coffdump_SOURCES = coffdump.c coffgrok.c $(BULIBS)
|
||||
|
||||
sysdump_SOURCES = sysdump.c $(BULIBS)
|
||||
|
||||
# coff/sym.h and coff/ecoff.h won't be found by the automatic dependency
|
||||
# scripts, since they are only included conditionally.
|
||||
nlmconv.o: nlmconv.c $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h
|
||||
ldname=`echo ld | sed '$(transform)'`; \
|
||||
$(COMPILE) -c -DLD_NAME="\"$${ldname}\"" @NLMCONV_DEFS@ $(srcdir)/nlmconv.c
|
||||
|
||||
nlmconv_SOURCES = nlmconv.c nlmheader.y $(BULIBS)
|
||||
|
||||
windres_SOURCES = windres.c resrc.c rescoff.c resbin.c rcparse.y rclex.l \
|
||||
winduni.c resres.c $(BULIBS)
|
||||
windres_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS)
|
||||
|
||||
dllwrap_SOURCES = dllwrap.c dyn-string.c version.c
|
||||
dllwrap_LDADD = $(LIBIBERTY) $(INTLLIBS)
|
||||
|
||||
|
||||
DISTSTUFF = arparse.c arparse.h arlex.c nlmheader.c sysinfo.c sysinfo.h \
|
||||
syslex.c deflex.c defparse.h defparse.c rclex.c rcparse.h rcparse.c
|
||||
|
||||
diststuff: $(DISTSTUFF) info
|
||||
|
||||
DISTCLEANFILES = stamp-under sysinfo underscore.c sysroff.c sysroff.h \
|
||||
site.exp site.bak
|
||||
|
||||
# Targets to rebuild dependencies in this Makefile.
|
||||
# Have to get rid of DEP1 here so that "$?" later includes all of $(CFILES).
|
||||
DEP: dep.sed $(CFILES) $(HFILES) $(GENERATED_CFILES) $(GENERATED_HFILES) config.h
|
||||
rm -f DEP1
|
||||
$(MAKE) MKDEP="$(MKDEP)" DEP1
|
||||
sed -f dep.sed < DEP1 > $@
|
||||
echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> $@
|
||||
|
||||
DEP1: $(CFILES) $(GENERATED_CFILES)
|
||||
echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP2
|
||||
echo '# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.' >> DEP2
|
||||
$(MKDEP) $(INCLUDES) $(CFLAGS) $? >> DEP2
|
||||
mv -f DEP2 $@
|
||||
|
||||
dep.sed: dep-in.sed config.status
|
||||
objdir=`pwd`; \
|
||||
sed <$(srcdir)/dep-in.sed >dep.sed \
|
||||
-e 's!@INCDIR@!$(INCDIR)!' \
|
||||
-e 's!@BFDDIR@!$(BFDDIR)!' \
|
||||
-e 's!@SRCDIR@!$(srcdir)!' \
|
||||
-e "s!@OBJDIR@!$${objdir}!"
|
||||
|
||||
dep: DEP
|
||||
sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
|
||||
cat DEP >> tmp-Makefile
|
||||
$(SHELL) $(srcdir)/../move-if-change tmp-Makefile Makefile
|
||||
|
||||
dep-in: DEP
|
||||
sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in
|
||||
cat DEP >> tmp-Makefile.in
|
||||
$(SHELL) $(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in
|
||||
|
||||
dep-am: DEP
|
||||
sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.am > tmp-Makefile.am
|
||||
cat DEP >> tmp-Makefile.am
|
||||
$(SHELL) $(srcdir)/../move-if-change tmp-Makefile.am $(srcdir)/Makefile.am
|
||||
|
||||
.PHONY: dep dep-in dep-am
|
||||
|
||||
###
|
||||
# DOCUMENTATION TARGETS
|
||||
config.texi: Makefile
|
||||
rm -f config.texi
|
||||
echo '@set VERSION $(VERSION)' > config.texi
|
||||
|
||||
binutils.dvi: $(srcdir)/binutils.texi config.texi
|
||||
|
||||
binutils.info: $(srcdir)/binutils.texi config.texi
|
||||
|
||||
MAINTAINERCLEANFILES = config.texi
|
||||
|
||||
$(DEMANGLER_NAME).1: cxxfilt.man Makefile
|
||||
sed -e 's/@PROGRAM@/$(DEMANGLER_NAME)/' < $(srcdir)/cxxfilt.man \
|
||||
> $(DEMANGLER_NAME).1
|
||||
|
||||
MOSTLYCLEANFILES = sysinfo $(DEMANGLER_NAME).1 binutils.log binutils.sum \
|
||||
abcdefgh*
|
||||
mostlyclean-local:
|
||||
-rm -rf tmpdir
|
||||
|
||||
CLEANFILES = dep.sed DEP DEP1 DEP2
|
||||
|
||||
.PHONY: install-exec-local
|
||||
|
||||
install-exec-local: install-binPROGRAMS $(bin_PROGRAMS) $(noinst_PROGRAMS)
|
||||
@list='$(noinst_PROGRAMS)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed -e 's/$(EXEEXT)$$//' -e 's/-new//' -e 's/cxxfilt/$(DEMANGLER_NAME)/'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
|
||||
$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed -e 's/$(EXEEXT)$$//' -e 's/-new//' -e 's/cxxfilt/$(DEMANGLER_NAME)/'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
|
||||
else :; fi; \
|
||||
done
|
||||
$(mkinstalldirs) $(tooldir)/bin
|
||||
for i in $(TOOL_PROGS); do \
|
||||
if [ -f $$i$(EXEEXT) ]; then \
|
||||
j=`echo $$i | sed -e 's/-new//'`; \
|
||||
k=`echo $$j | sed '$(transform)'`; \
|
||||
if [ "$(bindir)/$$k$(EXEEXT)" != "$(tooldir)/bin/$$j$(EXEEXT)" ]; then \
|
||||
rm -f $(tooldir)/bin/$$j$(EXEEXT); \
|
||||
ln $(bindir)/$$k$(EXEEXT) $(tooldir)/bin/$$j$(EXEEXT) >/dev/null 2>/dev/null \
|
||||
|| $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$i$(EXEEXT) $(tooldir)/bin/$$j$(EXEEXT); \
|
||||
fi; \
|
||||
else true; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
# What appears below is generated by a hacked mkdep using gcc -MM.
|
||||
|
||||
# DO NOT DELETE THIS LINE -- mkdep uses it.
|
||||
# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
|
||||
addr2line.o: addr2line.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/getopt.h $(INCDIR)/libiberty.h $(INCDIR)/demangle.h \
|
||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h
|
||||
ar.o: ar.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
|
||||
$(INCDIR)/progress.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
|
||||
$(INCDIR)/fopen-same.h $(INCDIR)/aout/ar.h $(BFDDIR)/libbfd.h \
|
||||
arsup.h
|
||||
arsup.o: arsup.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
arsup.h $(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
|
||||
$(INCDIR)/fopen-same.h
|
||||
bucomm.o: bucomm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
|
||||
$(INCDIR)/fopen-same.h
|
||||
coffdump.o: coffdump.c coffgrok.h bucomm.h config.h \
|
||||
$(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h
|
||||
coffgrok.o: coffgrok.c bucomm.h config.h $(INCDIR)/bin-bugs.h \
|
||||
$(INCDIR)/fopen-same.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \
|
||||
$(INCDIR)/bfdlink.h coffgrok.h
|
||||
debug.o: debug.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
|
||||
$(INCDIR)/libiberty.h debug.h
|
||||
dlltool.o: dlltool.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
|
||||
$(INCDIR)/fopen-same.h $(INCDIR)/demangle.h dyn-string.h \
|
||||
dlltool.h
|
||||
filemode.o: filemode.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h
|
||||
ieee.o: ieee.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/ieee.h \
|
||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
|
||||
$(INCDIR)/libiberty.h debug.h budbg.h
|
||||
is-ranlib.o: is-ranlib.c
|
||||
is-strip.o: is-strip.c
|
||||
maybe-ranlib.o: maybe-ranlib.c
|
||||
maybe-strip.o: maybe-strip.c
|
||||
nlmconv.o: nlmconv.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
|
||||
$(INCDIR)/fopen-same.h $(BFDDIR)/libnlm.h $(INCDIR)/nlm/common.h \
|
||||
$(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h nlmconv.h
|
||||
nm.o: nm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/progress.h \
|
||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
|
||||
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ranlib.h \
|
||||
$(INCDIR)/demangle.h $(INCDIR)/libiberty.h
|
||||
not-ranlib.o: not-ranlib.c
|
||||
not-strip.o: not-strip.c
|
||||
objcopy.o: objcopy.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/progress.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
|
||||
$(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h budbg.h
|
||||
objdump.o: objdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/getopt.h $(INCDIR)/progress.h bucomm.h config.h \
|
||||
$(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/dis-asm.h \
|
||||
$(INCDIR)/libiberty.h $(INCDIR)/demangle.h debug.h \
|
||||
budbg.h $(INCDIR)/aout/aout64.h
|
||||
prdbg.o: prdbg.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
|
||||
$(INCDIR)/libiberty.h debug.h budbg.h
|
||||
rdcoff.o: rdcoff.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/coff/internal.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
|
||||
$(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/demangle.h \
|
||||
debug.h budbg.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h
|
||||
rddbg.o: rddbg.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
|
||||
$(INCDIR)/libiberty.h debug.h budbg.h
|
||||
size.o: size.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/getopt.h \
|
||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
|
||||
$(INCDIR)/libiberty.h
|
||||
srconv.o: srconv.c bucomm.h config.h $(INCDIR)/bin-bugs.h \
|
||||
$(INCDIR)/fopen-same.h sysroff.h coffgrok.h $(INCDIR)/coff/internal.h \
|
||||
$(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h sysroff.c
|
||||
stabs.o: stabs.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
|
||||
$(INCDIR)/libiberty.h $(INCDIR)/demangle.h debug.h \
|
||||
budbg.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
|
||||
$(INCDIR)/aout/stab.def
|
||||
strings.o: strings.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
|
||||
$(INCDIR)/libiberty.h
|
||||
sysdump.o: sysdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
|
||||
sysroff.h sysroff.c
|
||||
version.o: version.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h
|
||||
wrstabs.o: wrstabs.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
|
||||
$(INCDIR)/libiberty.h debug.h budbg.h $(INCDIR)/aout/aout64.h \
|
||||
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def
|
||||
windres.o: windres.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/getopt.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
|
||||
$(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/obstack.h \
|
||||
windres.h winduni.h
|
||||
resrc.o: resrc.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
|
||||
$(INCDIR)/libiberty.h windres.h winduni.h
|
||||
rescoff.o: rescoff.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
|
||||
$(INCDIR)/libiberty.h windres.h winduni.h $(INCDIR)/coff/internal.h \
|
||||
$(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h
|
||||
resbin.o: resbin.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
|
||||
$(INCDIR)/libiberty.h windres.h winduni.h
|
||||
winduni.o: winduni.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
|
||||
winduni.h
|
||||
readelf.o: readelf.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/elf/common.h $(INCDIR)/elf/external.h $(INCDIR)/elf/internal.h \
|
||||
$(INCDIR)/elf/dwarf2.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \
|
||||
$(INCDIR)/elf/v850.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/mips.h \
|
||||
$(INCDIR)/elf/alpha.h $(INCDIR)/elf/arm.h $(INCDIR)/elf/m68k.h \
|
||||
$(INCDIR)/elf/sparc.h $(INCDIR)/elf/m32r.h $(INCDIR)/elf/d10v.h \
|
||||
$(INCDIR)/elf/d30v.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/mn10200.h \
|
||||
$(INCDIR)/elf/mn10300.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/arc.h \
|
||||
$(INCDIR)/elf/fr30.h $(INCDIR)/elf/mcore.h $(INCDIR)/elf/i960.h \
|
||||
$(INCDIR)/elf/pj.h $(INCDIR)/elf/avr.h bucomm.h config.h \
|
||||
$(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h
|
||||
resres.o: resres.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
|
||||
$(INCDIR)/libiberty.h windres.h winduni.h
|
||||
dyn-string.o: dyn-string.c config.h $(INCDIR)/ansidecl.h \
|
||||
dyn-string.h
|
||||
dllwrap.o: dllwrap.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
|
||||
$(INCDIR)/fopen-same.h dyn-string.h
|
||||
rename.o: rename.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h
|
||||
underscore.o: underscore.c
|
||||
arparse.o: arparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
|
||||
arsup.h
|
||||
arlex.o: arlex.c $(INCDIR)/libiberty.h arparse.h
|
||||
sysroff.o: sysroff.c
|
||||
sysinfo.o: sysinfo.c
|
||||
syslex.o: syslex.c sysinfo.h
|
||||
defparse.o: defparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
|
||||
dlltool.h
|
||||
deflex.o: deflex.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
|
||||
defparse.h dlltool.h
|
||||
nlmheader.o: nlmheader.c ../bfd/bfd.h bucomm.h config.h \
|
||||
$(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/nlm/common.h \
|
||||
$(INCDIR)/nlm/internal.h nlmconv.h
|
||||
rcparse.o: rcparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
|
||||
$(INCDIR)/libiberty.h windres.h winduni.h
|
||||
rclex.o: rclex.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
|
||||
$(INCDIR)/libiberty.h windres.h winduni.h rcparse.h
|
||||
# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
|
||||
1379
binutils/Makefile.in
1379
binutils/Makefile.in
File diff suppressed because it is too large
Load Diff
177
binutils/NEWS
177
binutils/NEWS
@@ -1,177 +0,0 @@
|
||||
-*- text -*-
|
||||
|
||||
Changes in binutils 2.10:
|
||||
|
||||
* New command line switch to objdump --file-start-context which shows the
|
||||
entire file contents up to the source line first encountered for a given
|
||||
file.
|
||||
|
||||
* New command line switch to objdump -M (or --disassembler-options) which takes
|
||||
a parameter which can then be interpreted on a per-target basis by the
|
||||
disassembler. Used by ARM targets to select register name sets, ISA, APCS or
|
||||
raw verions.
|
||||
|
||||
* objdump support for -mi386:intel which causes disassembly to be displayed
|
||||
with intel syntax.
|
||||
|
||||
* New program: readelf. This displays the contents of ELF format files,
|
||||
regardless of target machine.
|
||||
|
||||
* objcopy now takes --change-section-lma, --change-section-vma, and
|
||||
--change-section-address options. The old --adjust-section-vma option is
|
||||
equivalent to --change-section-address. The other --adjust-* options are now
|
||||
renamed to --change-*, although --adjust-* continues to work.
|
||||
|
||||
* objcopy has a --redefine-sym option that lets you rename symbols.
|
||||
|
||||
* objcopy now takes a -j/--only-section option to copy only the specified
|
||||
sections.
|
||||
|
||||
* dlltool now supports the IMPORTS command.
|
||||
|
||||
* dlltool now takes --export-all-symbols, --no-export-all-symbols,
|
||||
--exclude-symbols, and --no-default-excludes options.
|
||||
|
||||
Changes in binutils 2.9:
|
||||
|
||||
* Added windres program, which can be used to manipulate resources in WIN32
|
||||
files as used on Windows 95 and Windows NT.
|
||||
|
||||
* The objcopy --gap-fill and --pad-to options operate on the LMA rather than
|
||||
the VMA of the sections.
|
||||
|
||||
* Added S modifier to ar to not build a symbol table.
|
||||
|
||||
Changes in binutils 2.8:
|
||||
|
||||
* The objdump disassembly format has been changed, and hopefully improved. Use
|
||||
the new --prefix-addresses option to get the old format. There are also new
|
||||
--disassemble-zeroes and --no-show-raw-insn options which affect disassembler
|
||||
output.
|
||||
|
||||
* Formats may now be specified as configuration triplets. For example,
|
||||
objdump -b i386-pc-linux. The triplets are not passed through config.sub,
|
||||
so they must be in canonical form.
|
||||
|
||||
* Added new addr2line program. This uses the debugging information to convert
|
||||
an address into a file name and line number within a program.
|
||||
|
||||
* Added --change-leading-char argument to objcopy.
|
||||
|
||||
* Added --weaken argument to objcopy.
|
||||
|
||||
* objdump --dynamic-reloc now works on ELF executables and shared libraries.
|
||||
|
||||
* Added --adjust-vma option to objdump.
|
||||
|
||||
* Added -C/--demangle option to objdump.
|
||||
|
||||
* Added -p/--preserve-dates option to strip and objcopy.
|
||||
|
||||
Changes in binutils 2.7:
|
||||
|
||||
* Added --enable-shared and --enable-commonbfdlib options to configure.
|
||||
|
||||
* Added --debugging argument to objdump and objcopy.
|
||||
|
||||
* Added --defined-only argument to nm.
|
||||
|
||||
* Added --remove-leading-char argument to objcopy.
|
||||
|
||||
* The objdump --line-numbers option is now meaningful with --reloc.
|
||||
|
||||
* Added --line-numbers option to nm.
|
||||
|
||||
* Added --endian/-EB/-EL option to objdump.
|
||||
|
||||
* Added support for Alpha OpenVMS/AXP.
|
||||
|
||||
Changes in binutils 2.6:
|
||||
|
||||
* Added -N/--strip-symbol and -K/--keep-symbol arguments to strip and objcopy.
|
||||
|
||||
* Added several arguments to objcopy to provide some control over how the new
|
||||
file is laid out in memory. Also added binary output format to BFD to permit
|
||||
generating plain binary files.
|
||||
|
||||
* Added --start-address and --stop-address options to objdump.
|
||||
|
||||
* ar and ranlib now work on AIX. The tools are now built by default on AIX.
|
||||
|
||||
Changes in binutils 2.5:
|
||||
|
||||
* Changed objdump -dr to dump the relocs interspersed with the assembly
|
||||
listing, for a more useful listing of relocateable files.
|
||||
|
||||
* Changed objdump -d/--disassemble to only disassemble SEC_CODE sections.
|
||||
Added -D/--disassemble-all option to disassemble all sections.
|
||||
|
||||
* Added --size-sort option to nm.
|
||||
|
||||
* strip and objcopy should now be able to handle dynamically linked ELF
|
||||
executables.
|
||||
|
||||
Changes in binutils 2.4:
|
||||
|
||||
* Support for HP-PA (by Jeff Law), i386 Mach (by David Mackenzie), RS/6000 and
|
||||
PowerPC (except ar and ranlib; by Ian Taylor).
|
||||
|
||||
* Support for Irix 5.
|
||||
|
||||
* Programs `strip' and `objcopy' will not attempt to write dynamically linked
|
||||
ELF output files, since BFD currently can't create them properly.
|
||||
|
||||
Changes in binutils 2.3:
|
||||
|
||||
* A new --stabs argument has been added to objdump to dump stabs sections in
|
||||
ELF and COFF files.
|
||||
|
||||
* A new program, nlmconv, has been added. It can convert object files into
|
||||
Novell NetWare Loadable Modules.
|
||||
|
||||
* The strings program has been added.
|
||||
|
||||
Changes in binutils 2.2:
|
||||
|
||||
* The 'copy' program has been renamed to 'objcopy', for consistency with
|
||||
'objdump', and because 'copy' might more plausibly be used as a synonym for
|
||||
'cp'.
|
||||
|
||||
* The new stand-alone program c++filt is a filter that converts encoded
|
||||
(mangled) C++ assembly-level identifiers to user-level names. (Note: This
|
||||
may get moved to the gcc distribution.)
|
||||
|
||||
* nm -o on an archive now prefixes each line with the archive name, matching
|
||||
the output from BSD nm.
|
||||
|
||||
* ar (and ld) can now read (but not write) BSD4.4-style archives.
|
||||
|
||||
* New support for H8500, Z8000, and the Hitach SH.
|
||||
|
||||
* Dis-assembler interface changed to allow sharing with gdb.
|
||||
|
||||
* There is new Elf code, but it is not yet ready for general use.
|
||||
|
||||
* There is the beginnings of a test suite.
|
||||
|
||||
Changes in binutils 2.1:
|
||||
|
||||
* There is now support for writing ECOFF files, so ld and the other utilities
|
||||
should work on Risc/Ultrix and Irix. Please let us know how well this works.
|
||||
|
||||
* ar now automatically creates a symbol table (a __.SYMDEF member, in the BSD
|
||||
version), if there are any object files in the archive. So running ranlib is
|
||||
now redundant (unless the non-standard q command is used). This is required
|
||||
for Posix.2 conformance.
|
||||
|
||||
* The archive-reading code now reads both BSD-style and SYSV-style archives
|
||||
independently of the selected target format. This is to encourage people to
|
||||
switch to SYSV-format, which has a number of advantages.
|
||||
|
||||
* The strip and copy programs now have options to remove debug-symbols only
|
||||
and/or local symbols only. They now also support long options.
|
||||
|
||||
|
||||
Local variables:
|
||||
fill-column: 79
|
||||
End:
|
||||
189
binutils/README
189
binutils/README
@@ -1,189 +0,0 @@
|
||||
These are the GNU binutils. These are utilities of use when dealing
|
||||
with object files.
|
||||
|
||||
The linker (ld) is in a separate directory, which should be ../ld.
|
||||
Linker-specific notes are in ../ld/README.
|
||||
|
||||
As of version 2.5, the assembler (as) is also included in this package, in
|
||||
../gas. Assembler-specific notes can be found in ../gas/README.
|
||||
|
||||
Recent changes are in ./NEWS, ../ld/NEWS, and ../gas/NEWS.
|
||||
|
||||
Unpacking and Installation -- quick overview
|
||||
============================================
|
||||
|
||||
When you unpack the binutils-2.9.tar.gz file, you'll get a directory
|
||||
called something like `binutils-2.9', which contains various files and
|
||||
directories. Most of the files in the top directory are for
|
||||
information and for configuration. The actual source code is in
|
||||
subdirectories.
|
||||
|
||||
To build binutils, you can just do:
|
||||
|
||||
cd binutils-2.9
|
||||
./configure [options]
|
||||
make
|
||||
make install # copies the programs files into /usr/local/bin
|
||||
# by default.
|
||||
|
||||
This will configure and build all the libraries as well as the
|
||||
assembler, the binutils, and the linker.
|
||||
|
||||
If you have GNU make, we recommend building in a different directory:
|
||||
|
||||
mkdir objdir
|
||||
cd objdir
|
||||
../binutils-2.9/configure [options]
|
||||
make
|
||||
make install
|
||||
|
||||
This relies on the VPATH feature of GNU make.
|
||||
|
||||
By default, the binutils will be configured to support the system on
|
||||
which they are built. When doing cross development, use the --target
|
||||
configure option to specify a different target.
|
||||
|
||||
The --enable-targets option adds support for more binary file formats
|
||||
besides the default. List them as the argument to --enable-targets,
|
||||
separated by commas. For example:
|
||||
|
||||
./configure --enable-targets=sun3,rs6000-aix,decstation
|
||||
|
||||
The name 'all' compiles in support for all valid BFD targets (this was
|
||||
the default in releases before 2.3):
|
||||
|
||||
./configure --enable-targets=all
|
||||
|
||||
You can also specify the --enable-shared option when you run
|
||||
configure. This will build the BFD and opcodes libraries as shared
|
||||
libraries. You can use arguments with the --enable-shared option to
|
||||
indicate that only certain libraries should be built shared; for
|
||||
example, --enable-shared=bfd. The only potential shared libraries in
|
||||
a binutils release are bfd and opcodes.
|
||||
|
||||
The binutils will be linked against the shared libraries. The build
|
||||
step will attempt to place the correct library in the runtime search
|
||||
path for the binaries. However, in some cases, after you install the
|
||||
binaries, you may have to set an environment variable, normally
|
||||
LD_LIBRARY_PATH, so that the system can find the installed libbfd
|
||||
shared library.
|
||||
|
||||
To build under openVMS/AXP, see the file makefile.vms in the top level
|
||||
directory.
|
||||
|
||||
If you don't have ar
|
||||
====================
|
||||
|
||||
If your system does not already have an ar program, the normal
|
||||
binutils build process will not work. In this case, run configure as
|
||||
usual. Before running make, run this script:
|
||||
|
||||
#!/bin/sh
|
||||
MAKE_PROG="${MAKE-make}"
|
||||
MAKE="${MAKE_PROG} AR=true LINK=true"
|
||||
export MAKE
|
||||
${MAKE} $* all-libiberty
|
||||
${MAKE} $* all-intl
|
||||
${MAKE} $* all-bfd
|
||||
cd binutils
|
||||
MAKE="${MAKE_PROG}"
|
||||
export MAKE
|
||||
${MAKE} $* ar_DEPENDENCIES= ar_LDADD='../bfd/*.o `cat ../libiberty/required-list ../libiberty/needed-list | sed -e "s,\([^ ][^ ]*\),../libiberty/\1,g"` `if test -f ../intl/gettext.o; then echo '../intl/*.o'; fi`' ar
|
||||
|
||||
This script will build an ar program in binutils/ar. Move binutils/ar
|
||||
into a directory on your PATH. After doing this, you can run make as
|
||||
usual to build the complete binutils distribution. You do not need
|
||||
the ranlib program in order to build the distribution.
|
||||
|
||||
Porting
|
||||
=======
|
||||
|
||||
Binutils-2.9 supports many different architectures, but there
|
||||
are many more not supported, including some that were supported
|
||||
by earlier versions. We are hoping for volunteers to
|
||||
improve this situation.
|
||||
|
||||
The major effort in porting binutils to a new host and/or target
|
||||
architecture involves the BFD library. There is some documentation
|
||||
in ../bfd/doc. The file ../gdb/doc/gdbint.texinfo (distributed
|
||||
with gdb-4.x) may also be of help.
|
||||
|
||||
Reporting bugs
|
||||
==============
|
||||
|
||||
Send bug reports and patches to bug-gnu-utils@gnu.org. Always mention
|
||||
the version number you are running; this is printed by running any of
|
||||
the binutils with the --version option. We appreciate reports about
|
||||
bugs, but we do not promise to fix them.
|
||||
|
||||
VMS
|
||||
===
|
||||
|
||||
This section was written by Klaus K"ampf <kkaempf@rmi.de>. It
|
||||
describes how to build and install the binutils on openVMS (Alpha and
|
||||
Vax). (The BFD library only supports reading Vax object files.)
|
||||
|
||||
Compiling the release:
|
||||
|
||||
To compile the gnu binary utilities and the gnu assembler, you'll
|
||||
need DEC C or GNU C for openVMS/Alpha. You'll need *both* compilers
|
||||
on openVMS/Vax.
|
||||
|
||||
Compiling with either DEC C or GNU C works on openVMS/Alpha only. Some
|
||||
of the opcodes and binutils files trap a bug in the DEC C optimizer,
|
||||
so these files must be compiled with /noopt.
|
||||
|
||||
Compiling on openVMS/Vax is a bit complicated, as the bfd library traps
|
||||
a bug in GNU C and the gnu assembler a bug in (my version of) DEC C.
|
||||
|
||||
I never tried compiling with VAX C.
|
||||
|
||||
|
||||
You further need GNU Make Version 3.76 or later. This is available
|
||||
at ftp.progis.de or any GNU archive site. The makefiles assume that
|
||||
gmake starts gnu make as a foreign command.
|
||||
|
||||
If you're compiling with DEC C or VAX C, you must run
|
||||
|
||||
$ @setup
|
||||
|
||||
before starting gnu-make. This isn't needed with GNU C.
|
||||
|
||||
On the Alpha you can choose the compiler by editing the toplevel
|
||||
makefile.vms. Either select CC=cc (for DEC C) or CC=gcc (for GNU C)
|
||||
|
||||
|
||||
Installing the release
|
||||
|
||||
Provided that your directory setup conforms to the GNU on openVMS
|
||||
standard, you already have a concealed deviced named 'GNU_ROOT'.
|
||||
In this case, a simple
|
||||
|
||||
$ gmake install
|
||||
|
||||
suffices to copy all programs and libraries to the proper directories.
|
||||
|
||||
Define the programs as foreign commands by adding these lines to your
|
||||
login.com:
|
||||
|
||||
$ gas :== $GNU_ROOT:[bin]as.exe
|
||||
$ size :== $GNU_ROOT:[bin]size.exe
|
||||
$ nm :== $GNU_ROOT:[bin]nm.exe
|
||||
$ objdump :== $GNU_ROOT:[bin]objdump.exe
|
||||
$ strings :== $GNU_ROOT:[bin]strings.exe
|
||||
|
||||
If you have a different directory setup, copy the binary utilities
|
||||
([.binutils]size.exe, [.binutils]nm.exe, [.binutils]objdump.exe,
|
||||
and [.binutils]strings.exe) and the gnu assembler and preprocessor
|
||||
([.gas]as.exe and [.gas]gasp.exe]) to a directory of your choice
|
||||
and define all programs as foreign commands.
|
||||
|
||||
|
||||
If you're satiesfied with the compilation, you may want to remove
|
||||
unneeded objects and libraries:
|
||||
|
||||
$ gmake clean
|
||||
|
||||
|
||||
If you have any problems or questions about the binutils on VMS, feel
|
||||
free to mail me at kkaempf@rmi.de.
|
||||
@@ -1 +0,0 @@
|
||||
sinclude(../bfd/acinclude.m4)
|
||||
925
binutils/aclocal.m4
vendored
925
binutils/aclocal.m4
vendored
@@ -1,925 +0,0 @@
|
||||
dnl aclocal.m4 generated automatically by aclocal 1.4
|
||||
|
||||
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl This program is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
dnl PARTICULAR PURPOSE.
|
||||
|
||||
sinclude(../bfd/acinclude.m4)
|
||||
|
||||
# Do all the work for Automake. This macro actually does too much --
|
||||
# some checks are only needed if your package does certain things.
|
||||
# But this isn't really a big deal.
|
||||
|
||||
# serial 1
|
||||
|
||||
dnl Usage:
|
||||
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
|
||||
|
||||
AC_DEFUN(AM_INIT_AUTOMAKE,
|
||||
[AC_REQUIRE([AC_PROG_INSTALL])
|
||||
PACKAGE=[$1]
|
||||
AC_SUBST(PACKAGE)
|
||||
VERSION=[$2]
|
||||
AC_SUBST(VERSION)
|
||||
dnl test to see if srcdir already configured
|
||||
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
|
||||
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
|
||||
fi
|
||||
ifelse([$3],,
|
||||
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
|
||||
AC_REQUIRE([AM_SANITY_CHECK])
|
||||
AC_REQUIRE([AC_ARG_PROGRAM])
|
||||
dnl FIXME This is truly gross.
|
||||
missing_dir=`cd $ac_aux_dir && pwd`
|
||||
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
|
||||
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
|
||||
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
|
||||
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
|
||||
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
|
||||
AC_REQUIRE([AC_PROG_MAKE_SET])])
|
||||
|
||||
#
|
||||
# Check to make sure that the build environment is sane.
|
||||
#
|
||||
|
||||
AC_DEFUN(AM_SANITY_CHECK,
|
||||
[AC_MSG_CHECKING([whether build environment is sane])
|
||||
# Just in case
|
||||
sleep 1
|
||||
echo timestamp > conftestfile
|
||||
# Do `set' in a subshell so we don't clobber the current shell's
|
||||
# arguments. Must try -L first in case configure is actually a
|
||||
# symlink; some systems play weird games with the mod time of symlinks
|
||||
# (eg FreeBSD returns the mod time of the symlink's containing
|
||||
# directory).
|
||||
if (
|
||||
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
|
||||
if test "[$]*" = "X"; then
|
||||
# -L didn't work.
|
||||
set X `ls -t $srcdir/configure conftestfile`
|
||||
fi
|
||||
if test "[$]*" != "X $srcdir/configure conftestfile" \
|
||||
&& test "[$]*" != "X conftestfile $srcdir/configure"; then
|
||||
|
||||
# If neither matched, then we have a broken ls. This can happen
|
||||
# if, for instance, CONFIG_SHELL is bash and it inherits a
|
||||
# broken ls alias from the environment. This has actually
|
||||
# happened. Such a system could not be considered "sane".
|
||||
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
|
||||
alias in your environment])
|
||||
fi
|
||||
|
||||
test "[$]2" = conftestfile
|
||||
)
|
||||
then
|
||||
# Ok.
|
||||
:
|
||||
else
|
||||
AC_MSG_ERROR([newly created file is older than distributed files!
|
||||
Check your system clock])
|
||||
fi
|
||||
rm -f conftest*
|
||||
AC_MSG_RESULT(yes)])
|
||||
|
||||
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
|
||||
dnl The program must properly implement --version.
|
||||
AC_DEFUN(AM_MISSING_PROG,
|
||||
[AC_MSG_CHECKING(for working $2)
|
||||
# Run test in a subshell; some versions of sh will print an error if
|
||||
# an executable is not found, even if stderr is redirected.
|
||||
# Redirect stdin to placate older versions of autoconf. Sigh.
|
||||
if ($2 --version) < /dev/null > /dev/null 2>&1; then
|
||||
$1=$2
|
||||
AC_MSG_RESULT(found)
|
||||
else
|
||||
$1="$3/missing $2"
|
||||
AC_MSG_RESULT(missing)
|
||||
fi
|
||||
AC_SUBST($1)])
|
||||
|
||||
|
||||
# serial 40 AC_PROG_LIBTOOL
|
||||
AC_DEFUN(AC_PROG_LIBTOOL,
|
||||
[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
|
||||
|
||||
# Save cache, so that ltconfig can load it
|
||||
AC_CACHE_SAVE
|
||||
|
||||
# Actually configure libtool. ac_aux_dir is where install-sh is found.
|
||||
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
|
||||
LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
|
||||
LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
|
||||
DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
|
||||
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
|
||||
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
|
||||
|| AC_MSG_ERROR([libtool configure failed])
|
||||
|
||||
# Reload cache, that may have been modified by ltconfig
|
||||
AC_CACHE_LOAD
|
||||
|
||||
# This can be used to rebuild libtool when needed
|
||||
LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
|
||||
|
||||
# Always use our own libtool.
|
||||
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
|
||||
AC_SUBST(LIBTOOL)dnl
|
||||
|
||||
# Redirect the config.log output again, so that the ltconfig log is not
|
||||
# clobbered by the next message.
|
||||
exec 5>>./config.log
|
||||
])
|
||||
|
||||
AC_DEFUN(AC_LIBTOOL_SETUP,
|
||||
[AC_PREREQ(2.13)dnl
|
||||
AC_REQUIRE([AC_ENABLE_SHARED])dnl
|
||||
AC_REQUIRE([AC_ENABLE_STATIC])dnl
|
||||
AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_PROG_LD])dnl
|
||||
AC_REQUIRE([AC_PROG_NM])dnl
|
||||
AC_REQUIRE([AC_PROG_LN_S])dnl
|
||||
dnl
|
||||
|
||||
case "$target" in
|
||||
NONE) lt_target="$host" ;;
|
||||
*) lt_target="$target" ;;
|
||||
esac
|
||||
|
||||
# Check for any special flags to pass to ltconfig.
|
||||
libtool_flags="--cache-file=$cache_file"
|
||||
test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
|
||||
test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
|
||||
test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
|
||||
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
|
||||
test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
|
||||
[libtool_flags="$libtool_flags --enable-dlopen"])
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
|
||||
[libtool_flags="$libtool_flags --enable-win32-dll"])
|
||||
AC_ARG_ENABLE(libtool-lock,
|
||||
[ --disable-libtool-lock avoid locking (might break parallel builds)])
|
||||
test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
|
||||
test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
|
||||
|
||||
# Some flags need to be propagated to the compiler or linker for good
|
||||
# libtool support.
|
||||
case "$lt_target" in
|
||||
*-*-irix6*)
|
||||
# Find out which ABI we are using.
|
||||
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
|
||||
if AC_TRY_EVAL(ac_compile); then
|
||||
case "`/usr/bin/file conftest.o`" in
|
||||
*32-bit*)
|
||||
LD="${LD-ld} -32"
|
||||
;;
|
||||
*N32*)
|
||||
LD="${LD-ld} -n32"
|
||||
;;
|
||||
*64-bit*)
|
||||
LD="${LD-ld} -64"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
rm -rf conftest*
|
||||
;;
|
||||
|
||||
*-*-sco3.2v5*)
|
||||
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
|
||||
SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -belf"
|
||||
AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
|
||||
[AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
|
||||
if test x"$lt_cv_cc_needs_belf" != x"yes"; then
|
||||
# this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
|
||||
CFLAGS="$SAVE_CFLAGS"
|
||||
fi
|
||||
;;
|
||||
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
|
||||
[*-*-cygwin* | *-*-mingw*)
|
||||
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
||||
AC_CHECK_TOOL(AS, as, false)
|
||||
AC_CHECK_TOOL(OBJDUMP, objdump, false)
|
||||
;;
|
||||
])
|
||||
esac
|
||||
])
|
||||
|
||||
# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
|
||||
AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
|
||||
|
||||
# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
|
||||
AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
|
||||
|
||||
# AC_ENABLE_SHARED - implement the --enable-shared flag
|
||||
# Usage: AC_ENABLE_SHARED[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AC_ENABLE_SHARED, [dnl
|
||||
define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(shared,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_shared=yes ;;
|
||||
no) enable_shared=no ;;
|
||||
*)
|
||||
enable_shared=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_shared=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
|
||||
AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_SHARED(no)])
|
||||
|
||||
# AC_ENABLE_STATIC - implement the --enable-static flag
|
||||
# Usage: AC_ENABLE_STATIC[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AC_ENABLE_STATIC, [dnl
|
||||
define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(static,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_static=yes ;;
|
||||
no) enable_static=no ;;
|
||||
*)
|
||||
enable_static=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_static=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_DISABLE_STATIC - set the default static flag to --disable-static
|
||||
AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_STATIC(no)])
|
||||
|
||||
|
||||
# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
|
||||
# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
|
||||
define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(fast-install,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_fast_install=yes ;;
|
||||
no) enable_fast_install=no ;;
|
||||
*)
|
||||
enable_fast_install=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_fast_install=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
|
||||
AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_FAST_INSTALL(no)])
|
||||
|
||||
# AC_PROG_LD - find the path to the GNU or non-GNU linker
|
||||
AC_DEFUN(AC_PROG_LD,
|
||||
[AC_ARG_WITH(gnu-ld,
|
||||
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
|
||||
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
||||
ac_prog=ld
|
||||
if test "$ac_cv_prog_gcc" = yes; then
|
||||
# Check if gcc -print-prog-name=ld gives a path.
|
||||
AC_MSG_CHECKING([for ld used by GCC])
|
||||
ac_prog=`($CC -print-prog-name=ld) 2>&5`
|
||||
case "$ac_prog" in
|
||||
# Accept absolute paths.
|
||||
changequote(,)dnl
|
||||
[\\/]* | [A-Za-z]:[\\/]*)
|
||||
re_direlt='/[^/][^/]*/\.\./'
|
||||
changequote([,])dnl
|
||||
# Canonicalize the path of ld
|
||||
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
|
||||
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
|
||||
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
|
||||
done
|
||||
test -z "$LD" && LD="$ac_prog"
|
||||
;;
|
||||
"")
|
||||
# If it fails, then pretend we aren't using GCC.
|
||||
ac_prog=ld
|
||||
;;
|
||||
*)
|
||||
# If it is relative, then search for the first ld in PATH.
|
||||
with_gnu_ld=unknown
|
||||
;;
|
||||
esac
|
||||
elif test "$with_gnu_ld" = yes; then
|
||||
AC_MSG_CHECKING([for GNU ld])
|
||||
else
|
||||
AC_MSG_CHECKING([for non-GNU ld])
|
||||
fi
|
||||
AC_CACHE_VAL(ac_cv_path_LD,
|
||||
[if test -z "$LD"; then
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
|
||||
for ac_dir in $PATH; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
|
||||
ac_cv_path_LD="$ac_dir/$ac_prog"
|
||||
# Check to see if the program is GNU ld. I'd rather use --version,
|
||||
# but apparently some GNU ld's only accept -v.
|
||||
# Break only if it was the GNU/non-GNU ld that we prefer.
|
||||
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
|
||||
test "$with_gnu_ld" != no && break
|
||||
else
|
||||
test "$with_gnu_ld" != yes && break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
else
|
||||
ac_cv_path_LD="$LD" # Let the user override the test with a path.
|
||||
fi])
|
||||
LD="$ac_cv_path_LD"
|
||||
if test -n "$LD"; then
|
||||
AC_MSG_RESULT($LD)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
|
||||
AC_PROG_LD_GNU
|
||||
])
|
||||
|
||||
AC_DEFUN(AC_PROG_LD_GNU,
|
||||
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
|
||||
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
|
||||
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
|
||||
ac_cv_prog_gnu_ld=yes
|
||||
else
|
||||
ac_cv_prog_gnu_ld=no
|
||||
fi])
|
||||
])
|
||||
|
||||
# AC_PROG_NM - find the path to a BSD-compatible name lister
|
||||
AC_DEFUN(AC_PROG_NM,
|
||||
[AC_MSG_CHECKING([for BSD-compatible nm])
|
||||
AC_CACHE_VAL(ac_cv_path_NM,
|
||||
[if test -n "$NM"; then
|
||||
# Let the user override the test.
|
||||
ac_cv_path_NM="$NM"
|
||||
else
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
|
||||
for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
|
||||
# Check to see if the nm accepts a BSD-compat flag.
|
||||
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
|
||||
# nm: unknown option "B" ignored
|
||||
if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
||||
ac_cv_path_NM="$ac_dir/nm -B"
|
||||
break
|
||||
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
||||
ac_cv_path_NM="$ac_dir/nm -p"
|
||||
break
|
||||
else
|
||||
ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
|
||||
continue # so that we can try to find one that supports BSD flags
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
|
||||
fi])
|
||||
NM="$ac_cv_path_NM"
|
||||
AC_MSG_RESULT([$NM])
|
||||
])
|
||||
|
||||
# AC_CHECK_LIBM - check for math library
|
||||
AC_DEFUN(AC_CHECK_LIBM,
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
LIBM=
|
||||
case "$lt_target" in
|
||||
*-*-beos* | *-*-cygwin*)
|
||||
# These system don't have libm
|
||||
;;
|
||||
*-ncr-sysv4.3*)
|
||||
AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
|
||||
AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
|
||||
;;
|
||||
*)
|
||||
AC_CHECK_LIB(m, main, LIBM="-lm")
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
|
||||
# the libltdl convenience library, adds --enable-ltdl-convenience to
|
||||
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
|
||||
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
|
||||
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
|
||||
# '${top_builddir}/' (note the single quotes!) if your package is not
|
||||
# flat, and, if you're not using automake, define top_builddir as
|
||||
# appropriate in the Makefiles.
|
||||
AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
case "$enable_ltdl_convenience" in
|
||||
no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
|
||||
"") enable_ltdl_convenience=yes
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
|
||||
esac
|
||||
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
|
||||
INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
|
||||
])
|
||||
|
||||
# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
|
||||
# the libltdl installable library, and adds --enable-ltdl-install to
|
||||
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
|
||||
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
|
||||
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
|
||||
# '${top_builddir}/' (note the single quotes!) if your package is not
|
||||
# flat, and, if you're not using automake, define top_builddir as
|
||||
# appropriate in the Makefiles.
|
||||
# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
|
||||
AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_CHECK_LIB(ltdl, main,
|
||||
[test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
|
||||
[if test x"$enable_ltdl_install" = xno; then
|
||||
AC_MSG_WARN([libltdl not installed, but installation disabled])
|
||||
else
|
||||
enable_ltdl_install=yes
|
||||
fi
|
||||
])
|
||||
if test x"$enable_ltdl_install" = x"yes"; then
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-install"
|
||||
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
|
||||
INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
|
||||
else
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
|
||||
LIBLTDL="-lltdl"
|
||||
INCLTDL=
|
||||
fi
|
||||
])
|
||||
|
||||
dnl old names
|
||||
AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
|
||||
AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
|
||||
AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
|
||||
AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
|
||||
AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
|
||||
AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
|
||||
AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
|
||||
|
||||
dnl This is just to silence aclocal about the macro not being used
|
||||
ifelse([AC_DISABLE_FAST_INSTALL])dnl
|
||||
|
||||
# Like AC_CONFIG_HEADER, but automatically create stamp file.
|
||||
|
||||
AC_DEFUN(AM_CONFIG_HEADER,
|
||||
[AC_PREREQ([2.12])
|
||||
AC_CONFIG_HEADER([$1])
|
||||
dnl When config.status generates a header, we must update the stamp-h file.
|
||||
dnl This file resides in the same directory as the config header
|
||||
dnl that is generated. We must strip everything past the first ":",
|
||||
dnl and everything past the last "/".
|
||||
AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
|
||||
ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
|
||||
<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
|
||||
<<am_indx=1
|
||||
for am_file in <<$1>>; do
|
||||
case " <<$>>CONFIG_HEADERS " in
|
||||
*" <<$>>am_file "*<<)>>
|
||||
echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
|
||||
;;
|
||||
esac
|
||||
am_indx=`expr "<<$>>am_indx" + 1`
|
||||
done<<>>dnl>>)
|
||||
changequote([,]))])
|
||||
|
||||
|
||||
dnl AM_PROG_LEX
|
||||
dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
|
||||
AC_DEFUN(AM_PROG_LEX,
|
||||
[missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
|
||||
AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
|
||||
AC_PROG_LEX
|
||||
AC_DECL_YYTEXT])
|
||||
|
||||
# This file is derived from `gettext.m4'. The difference is that the
|
||||
# included macros assume Cygnus-style source and build trees.
|
||||
|
||||
# Macro to add for using GNU gettext.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||
#
|
||||
# This file file be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU Public License
|
||||
# but which still want to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code is *not* freely available.
|
||||
|
||||
# serial 3
|
||||
|
||||
AC_DEFUN(CY_WITH_NLS,
|
||||
[AC_MSG_CHECKING([whether NLS is requested])
|
||||
dnl Default is enabled NLS
|
||||
AC_ARG_ENABLE(nls,
|
||||
[ --disable-nls do not use Native Language Support],
|
||||
USE_NLS=$enableval, USE_NLS=yes)
|
||||
AC_MSG_RESULT($USE_NLS)
|
||||
AC_SUBST(USE_NLS)
|
||||
|
||||
USE_INCLUDED_LIBINTL=no
|
||||
|
||||
dnl If we use NLS figure out what method
|
||||
if test "$USE_NLS" = "yes"; then
|
||||
AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if NLS is requested])
|
||||
AC_MSG_CHECKING([whether included gettext is requested])
|
||||
AC_ARG_WITH(included-gettext,
|
||||
[ --with-included-gettext use the GNU gettext library included here],
|
||||
nls_cv_force_use_gnu_gettext=$withval,
|
||||
nls_cv_force_use_gnu_gettext=no)
|
||||
AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
|
||||
|
||||
nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
|
||||
if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
|
||||
dnl User does not insist on using GNU NLS library. Figure out what
|
||||
dnl to use. If gettext or catgets are available (in this order) we
|
||||
dnl use this. Else we have to fall back to GNU NLS library.
|
||||
dnl catgets is only used if permitted by option --with-catgets.
|
||||
nls_cv_header_intl=
|
||||
nls_cv_header_libgt=
|
||||
CATOBJEXT=NONE
|
||||
|
||||
AC_CHECK_HEADER(libintl.h,
|
||||
[AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
|
||||
[AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
|
||||
gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
|
||||
|
||||
if test "$gt_cv_func_gettext_libc" != "yes"; then
|
||||
AC_CHECK_LIB(intl, bindtextdomain,
|
||||
[AC_CACHE_CHECK([for gettext in libintl],
|
||||
gt_cv_func_gettext_libintl,
|
||||
[AC_TRY_LINK([], [return (int) gettext ("")],
|
||||
gt_cv_func_gettext_libintl=yes,
|
||||
gt_cv_func_gettext_libintl=no)])])
|
||||
fi
|
||||
|
||||
if test "$gt_cv_func_gettext_libc" = "yes" \
|
||||
|| test "$gt_cv_func_gettext_libintl" = "yes"; then
|
||||
AC_DEFINE(HAVE_GETTEXT, 1,
|
||||
[Define as 1 if you have gettext and don't want to use GNU gettext.])
|
||||
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
|
||||
if test "$MSGFMT" != "no"; then
|
||||
AC_CHECK_FUNCS(dcgettext)
|
||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
|
||||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||
AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
|
||||
return _nl_msg_cat_cntr],
|
||||
[CATOBJEXT=.gmo
|
||||
DATADIRNAME=share],
|
||||
[CATOBJEXT=.mo
|
||||
DATADIRNAME=lib])
|
||||
INSTOBJEXT=.mo
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
dnl In the standard gettext, we would now check for catgets.
|
||||
dnl However, we never want to use catgets for our releases.
|
||||
|
||||
if test "$CATOBJEXT" = "NONE"; then
|
||||
dnl Neither gettext nor catgets in included in the C library.
|
||||
dnl Fall back on GNU gettext library.
|
||||
nls_cv_use_gnu_gettext=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$nls_cv_use_gnu_gettext" = "yes"; then
|
||||
dnl Mark actions used to generate GNU NLS library.
|
||||
INTLOBJS="\$(GETTOBJS)"
|
||||
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
|
||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
|
||||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||
AC_SUBST(MSGFMT)
|
||||
USE_INCLUDED_LIBINTL=yes
|
||||
CATOBJEXT=.gmo
|
||||
INSTOBJEXT=.mo
|
||||
DATADIRNAME=share
|
||||
INTLDEPS='$(top_builddir)/../intl/libintl.a'
|
||||
INTLLIBS=$INTLDEPS
|
||||
LIBS=`echo $LIBS | sed -e 's/-lintl//'`
|
||||
nls_cv_header_intl=libintl.h
|
||||
nls_cv_header_libgt=libgettext.h
|
||||
fi
|
||||
|
||||
dnl Test whether we really found GNU xgettext.
|
||||
if test "$XGETTEXT" != ":"; then
|
||||
dnl If it is no GNU xgettext we define it as : so that the
|
||||
dnl Makefiles still can work.
|
||||
if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
|
||||
: ;
|
||||
else
|
||||
AC_MSG_RESULT(
|
||||
[found xgettext programs is not GNU xgettext; ignore it])
|
||||
XGETTEXT=":"
|
||||
fi
|
||||
fi
|
||||
|
||||
# We need to process the po/ directory.
|
||||
POSUB=po
|
||||
else
|
||||
DATADIRNAME=share
|
||||
nls_cv_header_intl=libintl.h
|
||||
nls_cv_header_libgt=libgettext.h
|
||||
fi
|
||||
|
||||
# If this is used in GNU gettext we have to set USE_NLS to `yes'
|
||||
# because some of the sources are only built for this goal.
|
||||
if test "$PACKAGE" = gettext; then
|
||||
USE_NLS=yes
|
||||
USE_INCLUDED_LIBINTL=yes
|
||||
fi
|
||||
|
||||
dnl These rules are solely for the distribution goal. While doing this
|
||||
dnl we only have to keep exactly one list of the available catalogs
|
||||
dnl in configure.in.
|
||||
for lang in $ALL_LINGUAS; do
|
||||
GMOFILES="$GMOFILES $lang.gmo"
|
||||
POFILES="$POFILES $lang.po"
|
||||
done
|
||||
|
||||
dnl Make all variables we use known to autoconf.
|
||||
AC_SUBST(USE_INCLUDED_LIBINTL)
|
||||
AC_SUBST(CATALOGS)
|
||||
AC_SUBST(CATOBJEXT)
|
||||
AC_SUBST(DATADIRNAME)
|
||||
AC_SUBST(GMOFILES)
|
||||
AC_SUBST(INSTOBJEXT)
|
||||
AC_SUBST(INTLDEPS)
|
||||
AC_SUBST(INTLLIBS)
|
||||
AC_SUBST(INTLOBJS)
|
||||
AC_SUBST(POFILES)
|
||||
AC_SUBST(POSUB)
|
||||
])
|
||||
|
||||
AC_DEFUN(CY_GNU_GETTEXT,
|
||||
[AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
AC_REQUIRE([AC_ISC_POSIX])dnl
|
||||
AC_REQUIRE([AC_HEADER_STDC])dnl
|
||||
AC_REQUIRE([AC_C_CONST])dnl
|
||||
AC_REQUIRE([AC_C_INLINE])dnl
|
||||
AC_REQUIRE([AC_TYPE_OFF_T])dnl
|
||||
AC_REQUIRE([AC_TYPE_SIZE_T])dnl
|
||||
AC_REQUIRE([AC_FUNC_ALLOCA])dnl
|
||||
AC_REQUIRE([AC_FUNC_MMAP])dnl
|
||||
|
||||
AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
|
||||
unistd.h values.h sys/param.h])
|
||||
AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
|
||||
__argz_count __argz_stringify __argz_next])
|
||||
|
||||
if test "${ac_cv_func_stpcpy+set}" != "set"; then
|
||||
AC_CHECK_FUNCS(stpcpy)
|
||||
fi
|
||||
if test "${ac_cv_func_stpcpy}" = "yes"; then
|
||||
AC_DEFINE(HAVE_STPCPY, 1, [Define if you have the stpcpy function])
|
||||
fi
|
||||
|
||||
AM_LC_MESSAGES
|
||||
CY_WITH_NLS
|
||||
|
||||
if test "x$CATOBJEXT" != "x"; then
|
||||
if test "x$ALL_LINGUAS" = "x"; then
|
||||
LINGUAS=
|
||||
else
|
||||
AC_MSG_CHECKING(for catalogs to be installed)
|
||||
NEW_LINGUAS=
|
||||
for lang in ${LINGUAS=$ALL_LINGUAS}; do
|
||||
case "$ALL_LINGUAS" in
|
||||
*$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
|
||||
esac
|
||||
done
|
||||
LINGUAS=$NEW_LINGUAS
|
||||
AC_MSG_RESULT($LINGUAS)
|
||||
fi
|
||||
|
||||
dnl Construct list of names of catalog files to be constructed.
|
||||
if test -n "$LINGUAS"; then
|
||||
for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl The reference to <locale.h> in the installed <libintl.h> file
|
||||
dnl must be resolved because we cannot expect the users of this
|
||||
dnl to define HAVE_LOCALE_H.
|
||||
if test $ac_cv_header_locale_h = yes; then
|
||||
INCLUDE_LOCALE_H="#include <locale.h>"
|
||||
else
|
||||
INCLUDE_LOCALE_H="\
|
||||
/* The system does not provide the header <locale.h>. Take care yourself. */"
|
||||
fi
|
||||
AC_SUBST(INCLUDE_LOCALE_H)
|
||||
|
||||
dnl Determine which catalog format we have (if any is needed)
|
||||
dnl For now we know about two different formats:
|
||||
dnl Linux libc-5 and the normal X/Open format
|
||||
if test -f $srcdir/po2tbl.sed.in; then
|
||||
if test "$CATOBJEXT" = ".cat"; then
|
||||
AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
|
||||
|
||||
dnl Transform the SED scripts while copying because some dumb SEDs
|
||||
dnl cannot handle comments.
|
||||
sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed
|
||||
fi
|
||||
dnl po2tbl.sed is always needed.
|
||||
sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
|
||||
$srcdir/po2tbl.sed.in > po2tbl.sed
|
||||
fi
|
||||
|
||||
dnl In the intl/Makefile.in we have a special dependency which makes
|
||||
dnl only sense for gettext. We comment this out for non-gettext
|
||||
dnl packages.
|
||||
if test "$PACKAGE" = "gettext"; then
|
||||
GT_NO="#NO#"
|
||||
GT_YES=
|
||||
else
|
||||
GT_NO=
|
||||
GT_YES="#YES#"
|
||||
fi
|
||||
AC_SUBST(GT_NO)
|
||||
AC_SUBST(GT_YES)
|
||||
|
||||
MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs"
|
||||
AC_SUBST(MKINSTALLDIRS)
|
||||
|
||||
dnl *** For now the libtool support in intl/Makefile is not for real.
|
||||
l=
|
||||
AC_SUBST(l)
|
||||
|
||||
dnl Generate list of files to be processed by xgettext which will
|
||||
dnl be included in po/Makefile. But only do this if the po directory
|
||||
dnl exists in srcdir.
|
||||
if test -d $srcdir/po; then
|
||||
test -d po || mkdir po
|
||||
if test "x$srcdir" != "x."; then
|
||||
if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
|
||||
posrcprefix="$srcdir/"
|
||||
else
|
||||
posrcprefix="../$srcdir/"
|
||||
fi
|
||||
else
|
||||
posrcprefix="../"
|
||||
fi
|
||||
rm -f po/POTFILES
|
||||
sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
|
||||
< $srcdir/po/POTFILES.in > po/POTFILES
|
||||
fi
|
||||
])
|
||||
|
||||
# Search path for a program which passes the given test.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||
#
|
||||
# This file file be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU Public License
|
||||
# but which still want to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code is *not* freely available.
|
||||
|
||||
# serial 1
|
||||
|
||||
dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
|
||||
dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
|
||||
AC_DEFUN(AM_PATH_PROG_WITH_TEST,
|
||||
[# Extract the first word of "$2", so it can be a program name with args.
|
||||
set dummy $2; ac_word=[$]2
|
||||
AC_MSG_CHECKING([for $ac_word])
|
||||
AC_CACHE_VAL(ac_cv_path_$1,
|
||||
[case "[$]$1" in
|
||||
/*)
|
||||
ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in ifelse([$5], , $PATH, [$5]); do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/$ac_word; then
|
||||
if [$3]; then
|
||||
ac_cv_path_$1="$ac_dir/$ac_word"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
dnl If no 4th arg is given, leave the cache variable unset,
|
||||
dnl so AC_PATH_PROGS will keep looking.
|
||||
ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
|
||||
])dnl
|
||||
;;
|
||||
esac])dnl
|
||||
$1="$ac_cv_path_$1"
|
||||
if test -n "[$]$1"; then
|
||||
AC_MSG_RESULT([$]$1)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
AC_SUBST($1)dnl
|
||||
])
|
||||
|
||||
# Check whether LC_MESSAGES is available in <locale.h>.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||
#
|
||||
# This file file be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU Public License
|
||||
# but which still want to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code is *not* freely available.
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_LC_MESSAGES,
|
||||
[if test $ac_cv_header_locale_h = yes; then
|
||||
AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
|
||||
[AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
|
||||
am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
|
||||
if test $am_cv_val_LC_MESSAGES = yes; then
|
||||
AC_DEFINE(HAVE_LC_MESSAGES, 1,
|
||||
[Define if your locale.h file contains LC_MESSAGES.])
|
||||
fi
|
||||
fi])
|
||||
|
||||
# Add --enable-maintainer-mode option to configure.
|
||||
# From Jim Meyering
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_MAINTAINER_MODE,
|
||||
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
|
||||
dnl maintainer-mode is disabled by default
|
||||
AC_ARG_ENABLE(maintainer-mode,
|
||||
[ --enable-maintainer-mode enable make rules and dependencies not useful
|
||||
(and sometimes confusing) to the casual installer],
|
||||
USE_MAINTAINER_MODE=$enableval,
|
||||
USE_MAINTAINER_MODE=no)
|
||||
AC_MSG_RESULT($USE_MAINTAINER_MODE)
|
||||
AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
|
||||
MAINT=$MAINTAINER_MODE_TRUE
|
||||
AC_SUBST(MAINT)dnl
|
||||
]
|
||||
)
|
||||
|
||||
# Define a conditional.
|
||||
|
||||
AC_DEFUN(AM_CONDITIONAL,
|
||||
[AC_SUBST($1_TRUE)
|
||||
AC_SUBST($1_FALSE)
|
||||
if $2; then
|
||||
$1_TRUE=
|
||||
$1_FALSE='#'
|
||||
else
|
||||
$1_TRUE='#'
|
||||
$1_FALSE=
|
||||
fi])
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
.\" Copyright (c) 1997 Free Software Foundation
|
||||
.\" See COPYING for conditions for redistribution
|
||||
.TH addr2line 1 "27 March 1997" "Cygnus Solutions" "GNU Development Tools"
|
||||
.de BP
|
||||
.sp
|
||||
.ti \-.2i
|
||||
\(**
|
||||
..
|
||||
|
||||
.SH NAME
|
||||
addr2line \- convert addresses into file names and line numbers
|
||||
|
||||
.SH SYNOPSIS
|
||||
.hy 0
|
||||
.na
|
||||
.TP
|
||||
.B addr2line
|
||||
.RB "[\|" "\-b\ "\c
|
||||
.I bfdname\c
|
||||
.RB " | " "\-\-target="\c
|
||||
.I bfdname\c
|
||||
\&\|]
|
||||
.RB "[\|" \-C | \-\-demangle "\|]"
|
||||
.RB "[\|" "\-e\ "\c
|
||||
.I filename\c
|
||||
.RB " | " "\-\-exe="\c
|
||||
.I filename\c
|
||||
\&\|]
|
||||
.RB "[\|" \-f | \-\-functions "\|]"
|
||||
.RB "[\|" \-s | \-\-basenames "\|]"
|
||||
.RB "[\|" \-H | \-\-help "\|]"
|
||||
.RB "[\|" \-V | \-\-version "\|]"
|
||||
.RB "[\|" addr addr ... "\|]"
|
||||
.ad b
|
||||
.hy 1
|
||||
.SH DESCRIPTION
|
||||
\c
|
||||
.B addr2line
|
||||
translates program addresses into file names and line numbers. Given
|
||||
an address and an executable, it uses the debugging information in the
|
||||
executable to figure out which file name and line number are
|
||||
associated with a given address.
|
||||
|
||||
The executable to use is specified with the
|
||||
.B \-e
|
||||
option. The default is
|
||||
.B a.out\c
|
||||
\&.
|
||||
|
||||
.B addr2line
|
||||
has two modes of operation.
|
||||
|
||||
In the first, hexadecimal addresses are specified on the command line,
|
||||
and
|
||||
.B addr2line
|
||||
displays the file name and line number for each address.
|
||||
|
||||
In the second,
|
||||
.B addr2line
|
||||
reads hexadecimal addresses from standard input, and prints the file
|
||||
name and line number for each address on standard output. In this
|
||||
mode,
|
||||
.B addr2line
|
||||
may be used in a pipe to convert dynamically chosen addresses.
|
||||
|
||||
The format of the output is FILENAME:LINENO. The file name and line
|
||||
number for each address is printed on a separate line. If the
|
||||
.B \-f
|
||||
option is used, then each FILENAME:LINENO line is preceded by a
|
||||
FUNCTIONNAME line which is the name of the function containing the
|
||||
address.
|
||||
|
||||
If the file name or function name can not be determined,
|
||||
.B addr2line
|
||||
will print two question marks in their place. If the line number can
|
||||
not be determined,
|
||||
.B addr2line
|
||||
will print 0.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.BI "\-b " "bfdname"\c
|
||||
.TP
|
||||
.BI "\-\-target=" "bfdname"
|
||||
Specify the object-code format for the object files to be
|
||||
\c
|
||||
.I bfdname\c
|
||||
\&.
|
||||
|
||||
.TP
|
||||
.B \-C
|
||||
.TP
|
||||
.B \-\-demangle
|
||||
Decode (\fIdemangle\fP) low-level symbol names into user-level names.
|
||||
Besides removing any initial underscore prepended by the system, this
|
||||
makes C++ function names readable.
|
||||
|
||||
.TP
|
||||
.BI "\-e " "filename"\c
|
||||
.TP
|
||||
.BI "\-\-exe=" "filename"
|
||||
Specify the name of the executable for which addresses should be
|
||||
translated. The default file is
|
||||
.B a.out\c
|
||||
\&.
|
||||
|
||||
.TP
|
||||
.B \-f
|
||||
.TP
|
||||
.B \-\-functions
|
||||
Display function names as well as file and line number information.
|
||||
|
||||
.TP
|
||||
.B \-s
|
||||
.TP
|
||||
.B \-\-basenames
|
||||
Display only the base of each file name.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.RB "`\|" binutils "\|'"
|
||||
entry in
|
||||
.B
|
||||
info\c
|
||||
\&;
|
||||
.I
|
||||
The GNU Binary Utilities\c
|
||||
\&, Roland H. Pesch (October 1991).
|
||||
@@ -1,335 +0,0 @@
|
||||
/* addr2line.c -- convert addresses to line number and function name
|
||||
Copyright 1997, 98, 99, 2000 Free Software Foundation, Inc.
|
||||
Contributed by Ulrich Lauther <Ulrich.Lauther@zfe.siemens.de>
|
||||
|
||||
This file is part of 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 2, 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Derived from objdump.c and nm.c by Ulrich.Lauther@zfe.siemens.de
|
||||
|
||||
Usage:
|
||||
addr2line [options] addr addr ...
|
||||
or
|
||||
addr2line [options]
|
||||
|
||||
both forms write results to stdout, the second form reads addresses
|
||||
to be converted from stdin. */
|
||||
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "bfd.h"
|
||||
#include "getopt.h"
|
||||
#include "libiberty.h"
|
||||
#include "demangle.h"
|
||||
#include "bucomm.h"
|
||||
|
||||
extern char *program_version;
|
||||
|
||||
static boolean with_functions; /* -f, show function names. */
|
||||
static boolean do_demangle; /* -C, demangle names. */
|
||||
static boolean base_names; /* -s, strip directory names. */
|
||||
|
||||
static int naddr; /* Number of addresses to process. */
|
||||
static char **addr; /* Hex addresses to process. */
|
||||
|
||||
static asymbol **syms; /* Symbol table. */
|
||||
|
||||
static struct option long_options[] =
|
||||
{
|
||||
{"basenames", no_argument, NULL, 's'},
|
||||
{"demangle", no_argument, NULL, 'C'},
|
||||
{"exe", required_argument, NULL, 'e'},
|
||||
{"functions", no_argument, NULL, 'f'},
|
||||
{"target", required_argument, NULL, 'b'},
|
||||
{"help", no_argument, NULL, 'H'},
|
||||
{"version", no_argument, NULL, 'V'},
|
||||
{0, no_argument, 0, 0}
|
||||
};
|
||||
|
||||
static void usage PARAMS ((FILE *, int));
|
||||
static void slurp_symtab PARAMS ((bfd *));
|
||||
static void find_address_in_section PARAMS ((bfd *, asection *, PTR));
|
||||
static void translate_addresses PARAMS ((bfd *));
|
||||
static void process_file PARAMS ((const char *, const char *));
|
||||
|
||||
/* Print a usage message to STREAM and exit with STATUS. */
|
||||
|
||||
static void
|
||||
usage (stream, status)
|
||||
FILE *stream;
|
||||
int status;
|
||||
{
|
||||
fprintf (stream, _("\
|
||||
Usage: %s [-CfsHV] [-b bfdname] [--target=bfdname]\n\
|
||||
[-e executable] [--exe=executable] [--demangle]\n\
|
||||
[--basenames] [--functions] [addr addr ...]\n"),
|
||||
program_name);
|
||||
list_supported_targets (program_name, stream);
|
||||
if (status == 0)
|
||||
fprintf (stream, _("Report bugs to %s\n"), REPORT_BUGS_TO);
|
||||
exit (status);
|
||||
}
|
||||
|
||||
/* Read in the symbol table. */
|
||||
|
||||
static void
|
||||
slurp_symtab (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
long storage;
|
||||
long symcount;
|
||||
|
||||
if ((bfd_get_file_flags (abfd) & HAS_SYMS) == 0)
|
||||
return;
|
||||
|
||||
storage = bfd_get_symtab_upper_bound (abfd);
|
||||
if (storage < 0)
|
||||
bfd_fatal (bfd_get_filename (abfd));
|
||||
|
||||
syms = (asymbol **) xmalloc (storage);
|
||||
|
||||
symcount = bfd_canonicalize_symtab (abfd, syms);
|
||||
if (symcount < 0)
|
||||
bfd_fatal (bfd_get_filename (abfd));
|
||||
}
|
||||
|
||||
/* These global variables are used to pass information between
|
||||
translate_addresses and find_address_in_section. */
|
||||
|
||||
static bfd_vma pc;
|
||||
static const char *filename;
|
||||
static const char *functionname;
|
||||
static unsigned int line;
|
||||
static boolean found;
|
||||
|
||||
/* Look for an address in a section. This is called via
|
||||
bfd_map_over_sections. */
|
||||
|
||||
static void
|
||||
find_address_in_section (abfd, section, data)
|
||||
bfd *abfd;
|
||||
asection *section;
|
||||
PTR data ATTRIBUTE_UNUSED;
|
||||
{
|
||||
bfd_vma vma;
|
||||
bfd_size_type size;
|
||||
|
||||
if (found)
|
||||
return;
|
||||
|
||||
if ((bfd_get_section_flags (abfd, section) & SEC_ALLOC) == 0)
|
||||
return;
|
||||
|
||||
vma = bfd_get_section_vma (abfd, section);
|
||||
if (pc < vma)
|
||||
return;
|
||||
|
||||
size = bfd_get_section_size_before_reloc (section);
|
||||
if (pc >= vma + size)
|
||||
return;
|
||||
|
||||
found = bfd_find_nearest_line (abfd, section, syms, pc - vma,
|
||||
&filename, &functionname, &line);
|
||||
}
|
||||
|
||||
/* Read hexadecimal addresses from stdin, translate into
|
||||
file_name:line_number and optionally function name. */
|
||||
|
||||
static void
|
||||
translate_addresses (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
int read_stdin = (naddr == 0);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (read_stdin)
|
||||
{
|
||||
char addr_hex[100];
|
||||
|
||||
if (fgets (addr_hex, sizeof addr_hex, stdin) == NULL)
|
||||
break;
|
||||
pc = bfd_scan_vma (addr_hex, NULL, 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (naddr <= 0)
|
||||
break;
|
||||
--naddr;
|
||||
pc = bfd_scan_vma (*addr++, NULL, 16);
|
||||
}
|
||||
|
||||
found = false;
|
||||
bfd_map_over_sections (abfd, find_address_in_section, (PTR) NULL);
|
||||
|
||||
if (! found)
|
||||
{
|
||||
if (with_functions)
|
||||
printf ("??\n");
|
||||
printf ("??:0\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (with_functions)
|
||||
{
|
||||
if (functionname == NULL || *functionname == '\0')
|
||||
printf ("??\n");
|
||||
else if (! do_demangle)
|
||||
printf ("%s\n", functionname);
|
||||
else
|
||||
{
|
||||
char *res;
|
||||
|
||||
res = cplus_demangle (functionname, DMGL_ANSI | DMGL_PARAMS);
|
||||
if (res == NULL)
|
||||
printf ("%s\n", functionname);
|
||||
else
|
||||
{
|
||||
printf ("%s\n", res);
|
||||
free (res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (base_names && filename != NULL)
|
||||
{
|
||||
char *h;
|
||||
|
||||
h = strrchr (filename, '/');
|
||||
if (h != NULL)
|
||||
filename = h + 1;
|
||||
}
|
||||
|
||||
printf ("%s:%u\n", filename ? filename : "??", line);
|
||||
}
|
||||
|
||||
/* fflush() is essential for using this command as a server
|
||||
child process that reads addresses from a pipe and responds
|
||||
with line number information, processing one address at a
|
||||
time. */
|
||||
fflush (stdout);
|
||||
}
|
||||
}
|
||||
|
||||
/* Process a file. */
|
||||
|
||||
static void
|
||||
process_file (filename, target)
|
||||
const char *filename;
|
||||
const char *target;
|
||||
{
|
||||
bfd *abfd;
|
||||
char **matching;
|
||||
|
||||
abfd = bfd_openr (filename, target);
|
||||
if (abfd == NULL)
|
||||
bfd_fatal (filename);
|
||||
|
||||
if (bfd_check_format (abfd, bfd_archive))
|
||||
fatal (_("%s: can not get addresses from archive"), filename);
|
||||
|
||||
if (! bfd_check_format_matches (abfd, bfd_object, &matching))
|
||||
{
|
||||
bfd_nonfatal (bfd_get_filename (abfd));
|
||||
if (bfd_get_error () == bfd_error_file_ambiguously_recognized)
|
||||
{
|
||||
list_matching_formats (matching);
|
||||
free (matching);
|
||||
}
|
||||
xexit (1);
|
||||
}
|
||||
|
||||
slurp_symtab (abfd);
|
||||
|
||||
translate_addresses (abfd);
|
||||
|
||||
if (syms != NULL)
|
||||
{
|
||||
free (syms);
|
||||
syms = NULL;
|
||||
}
|
||||
|
||||
bfd_close (abfd);
|
||||
}
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
char *filename;
|
||||
char *target;
|
||||
int c;
|
||||
|
||||
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
|
||||
setlocale (LC_MESSAGES, "");
|
||||
#endif
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
program_name = *argv;
|
||||
xmalloc_set_program_name (program_name);
|
||||
|
||||
bfd_init ();
|
||||
set_default_bfd_target ();
|
||||
|
||||
filename = NULL;
|
||||
target = NULL;
|
||||
while ((c = getopt_long (argc, argv, "b:Ce:sfHV", long_options, (int *) 0))
|
||||
!= EOF)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case 0:
|
||||
break; /* we've been given a long option */
|
||||
case 'b':
|
||||
target = optarg;
|
||||
break;
|
||||
case 'C':
|
||||
do_demangle = true;
|
||||
break;
|
||||
case 'e':
|
||||
filename = optarg;
|
||||
break;
|
||||
case 's':
|
||||
base_names = true;
|
||||
break;
|
||||
case 'f':
|
||||
with_functions = true;
|
||||
break;
|
||||
case 'V':
|
||||
print_version ("addr2line");
|
||||
break;
|
||||
case 'H':
|
||||
usage (stdout, 0);
|
||||
break;
|
||||
default:
|
||||
usage (stderr, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (filename == NULL)
|
||||
filename = "a.out";
|
||||
|
||||
addr = argv + optind;
|
||||
naddr = argc - optind;
|
||||
|
||||
process_file (filename, target);
|
||||
|
||||
return 0;
|
||||
}
|
||||
533
binutils/ar.1
533
binutils/ar.1
@@ -1,533 +0,0 @@
|
||||
.\" Copyright (c) 1991, 1992, 1993, 1995, 1998, 1999 Free Software Foundation
|
||||
.\" See section COPYING for conditions for redistribution
|
||||
.TH ar 1 "1999" "Cygnus Solutions" "GNU Development Tools"
|
||||
.de BP
|
||||
.sp
|
||||
.ti \-.2i
|
||||
\(**
|
||||
..
|
||||
|
||||
.SH NAME
|
||||
ar \- create, modify, and extract from archives.
|
||||
|
||||
.SH SYNOPSIS
|
||||
.hy 0
|
||||
.na
|
||||
.BR ar " [\|" "-" "\|]"\c
|
||||
.I {dmpqrtx}[abcfilNoPsSuvV] \c
|
||||
[\|\c
|
||||
.I membername\c
|
||||
\&\|] \c
|
||||
[\|\c
|
||||
.I count\c
|
||||
\&\|] \c
|
||||
.I archive\c
|
||||
\& \c
|
||||
.I files\c
|
||||
\&.\|.\|.
|
||||
|
||||
.ad b
|
||||
.hy 1
|
||||
.SH DESCRIPTION
|
||||
The GNU \c
|
||||
.B ar\c
|
||||
\& program creates, modifies, and extracts from
|
||||
archives. An \c
|
||||
.I archive\c
|
||||
\& is a single file holding a collection of
|
||||
other files in a structure that makes it possible to retrieve
|
||||
the original individual files (called \c
|
||||
.I members\c
|
||||
\& of the archive).
|
||||
|
||||
The original files' contents, mode (permissions), timestamp, owner, and
|
||||
group are preserved in the archive, and may be reconstituted on
|
||||
extraction.
|
||||
|
||||
GNU \c
|
||||
.B ar\c
|
||||
\& can maintain archives whose members have names of any
|
||||
length; however, depending on how \c
|
||||
.B ar\c
|
||||
\& is configured on your
|
||||
system, a limit on member-name length may be imposed (for compatibility
|
||||
with archive formats maintained with other tools). If it exists, the
|
||||
limit is often 15 characters (typical of formats related to a.out) or 16
|
||||
characters (typical of formats related to coff).
|
||||
|
||||
\c
|
||||
.B ar\c
|
||||
\& is considered a binary utility because archives of this sort
|
||||
are most often used as \c
|
||||
.I libraries\c
|
||||
\& holding commonly needed
|
||||
subroutines.
|
||||
|
||||
\c
|
||||
.B ar\c
|
||||
\& will create an index to the symbols defined in relocatable
|
||||
object modules in the archive when you specify the modifier `\|\c
|
||||
.B s\c
|
||||
\|'.
|
||||
Once created, this index is updated in the archive whenever \c
|
||||
.B ar\c
|
||||
\&
|
||||
makes a change to its contents (save for the `\|\c
|
||||
.B q\c
|
||||
\|' update operation).
|
||||
An archive with such an index speeds up linking to the library, and
|
||||
allows routines in the library to call each other without regard to
|
||||
their placement in the archive.
|
||||
|
||||
You may use `\|\c
|
||||
.B nm \-s\c
|
||||
\|' or `\|\c
|
||||
.B nm \-\-print\-armap\c
|
||||
\|' to list this index
|
||||
table. If an archive lacks the table, another form of \c
|
||||
.B ar\c
|
||||
\& called
|
||||
\c
|
||||
.B ranlib\c
|
||||
\& can be used to add just the table.
|
||||
|
||||
\c
|
||||
.B ar\c
|
||||
\& insists on at least two arguments to execute: one
|
||||
keyletter specifying the \c
|
||||
.I operation\c
|
||||
\& (optionally accompanied by other
|
||||
keyletters specifying \c
|
||||
.I modifiers\c
|
||||
\&), and the archive name to act on.
|
||||
|
||||
Most operations can also accept further \c
|
||||
.I files\c
|
||||
\& arguments,
|
||||
specifying particular files to operate on.
|
||||
|
||||
.SH OPTIONS
|
||||
GNU \c
|
||||
.B ar\c
|
||||
\& allows you to mix the operation code \c
|
||||
.I p\c
|
||||
\& and modifier
|
||||
flags \c
|
||||
.I mod\c
|
||||
\& in any order, within the first command-line argument.
|
||||
|
||||
If you wish, you may begin the first command-line argument with a
|
||||
dash.
|
||||
|
||||
The \c
|
||||
.I p\c
|
||||
\& keyletter specifies what operation to execute; it may be
|
||||
any of the following, but you must specify only one of them:
|
||||
|
||||
.TP
|
||||
.B d
|
||||
\c
|
||||
.I Delete\c
|
||||
\& modules from the archive. Specify the names of modules to
|
||||
be deleted as \c
|
||||
.I files\c
|
||||
\&; the archive is untouched if you
|
||||
specify no files to delete.
|
||||
|
||||
If you specify the `\|\c
|
||||
.B v\c
|
||||
\|' modifier, \c
|
||||
.B ar\c
|
||||
\& will list each module
|
||||
as it is deleted.
|
||||
|
||||
.TP
|
||||
.B m
|
||||
Use this operation to \c
|
||||
.I move\c
|
||||
\& members in an archive.
|
||||
|
||||
The ordering of members in an archive can make a difference in how
|
||||
programs are linked using the library, if a symbol is defined in more
|
||||
than one member.
|
||||
|
||||
If no modifiers are used with \c
|
||||
.B m\c
|
||||
\&, any members you name in the
|
||||
\c
|
||||
.I files\c
|
||||
\& arguments are moved to the \c
|
||||
.I end\c
|
||||
\& of the archive;
|
||||
you can use the `\|\c
|
||||
.B a\c
|
||||
\|', `\|\c
|
||||
.B b\c
|
||||
\|', or `\|\c
|
||||
.B i\c
|
||||
\|' modifiers to move them to a
|
||||
specified place instead.
|
||||
|
||||
.TP
|
||||
.B p
|
||||
\c
|
||||
.I Print\c
|
||||
\& the specified members of the archive, to the standard
|
||||
output file. If the `\|\c
|
||||
.B v\c
|
||||
\|' modifier is specified, show the member
|
||||
name before copying its contents to standard output.
|
||||
|
||||
If you specify no \c
|
||||
.I files\c
|
||||
\&, all the files in the archive are printed.
|
||||
|
||||
.TP
|
||||
.B q
|
||||
\c
|
||||
.I Quick append\c
|
||||
\&; add \c
|
||||
.I files\c
|
||||
\& to the end of \c
|
||||
.I archive\c
|
||||
\&,
|
||||
without checking for replacement.
|
||||
|
||||
The modifiers `\|\c
|
||||
.B a\c
|
||||
\|', `\|\c
|
||||
.B b\c
|
||||
\|', and `\|\c
|
||||
.B i\c
|
||||
\|' do \c
|
||||
.I not\c
|
||||
\& affect this
|
||||
operation; new members are always placed at the end of the archive.
|
||||
|
||||
The modifier `\|\c
|
||||
.B v\c
|
||||
\|' makes \c
|
||||
.B ar\c
|
||||
\& list each file as it is appended.
|
||||
|
||||
Since the point of this operation is speed, the archive's symbol table
|
||||
index is not updated, even if it already existed; you can use `\|\c
|
||||
.B ar s\c
|
||||
\|' or
|
||||
\c
|
||||
.B ranlib\c
|
||||
\& explicitly to update the symbol table index.
|
||||
|
||||
However, too many different systems assume quick append rebuilds the
|
||||
index, so GNU
|
||||
.B ar
|
||||
implements `\|\c
|
||||
.B q\c
|
||||
\|' as a synonym for `\|\c
|
||||
.B r\c
|
||||
\|'.
|
||||
|
||||
.TP
|
||||
.B r
|
||||
Insert \c
|
||||
.I files\c
|
||||
\& into \c
|
||||
.I archive\c
|
||||
\& (with \c
|
||||
.I replacement\c
|
||||
\&). This
|
||||
operation differs from `\|\c
|
||||
.B q\c
|
||||
\|' in that any previously existing members
|
||||
are deleted if their names match those being added.
|
||||
|
||||
If one of the files named in \c
|
||||
.I files\c
|
||||
\& doesn't exist, \c
|
||||
.B ar\c
|
||||
\&
|
||||
displays an error message, and leaves undisturbed any existing members
|
||||
of the archive matching that name.
|
||||
|
||||
By default, new members are added at the end of the file; but you may
|
||||
use one of the modifiers `\|\c
|
||||
.B a\c
|
||||
\|', `\|\c
|
||||
.B b\c
|
||||
\|', or `\|\c
|
||||
.B i\c
|
||||
\|' to request
|
||||
placement relative to some existing member.
|
||||
|
||||
The modifier `\|\c
|
||||
.B v\c
|
||||
\|' used with this operation elicits a line of
|
||||
output for each file inserted, along with one of the letters `\|\c
|
||||
.B a\c
|
||||
\|' or
|
||||
`\|\c
|
||||
.B r\c
|
||||
\|' to indicate whether the file was appended (no old member
|
||||
deleted) or replaced.
|
||||
|
||||
.TP
|
||||
.B t
|
||||
Display a \c
|
||||
.I table\c
|
||||
\& listing the contents of \c
|
||||
.I archive\c
|
||||
\&, or those
|
||||
of the files listed in \c
|
||||
.I files\c
|
||||
\& that are present in the
|
||||
archive. Normally only the member name is shown; if you also want to
|
||||
see the modes (permissions), timestamp, owner, group, and size, you can
|
||||
request that by also specifying the `\|\c
|
||||
.B v\c
|
||||
\|' modifier.
|
||||
|
||||
If you do not specify any \c
|
||||
.I files\c
|
||||
\&, all files in the archive
|
||||
are listed.
|
||||
|
||||
If there is more than one file with the same name (say, `\|\c
|
||||
.B fie\c
|
||||
\|') in
|
||||
an archive (say `\|\c
|
||||
.B b.a\c
|
||||
\|'), `\|\c
|
||||
.B ar t b.a fie\c
|
||||
\|' will list only the
|
||||
first instance; to see them all, you must ask for a complete
|
||||
listing\(em\&in our example, `\|\c
|
||||
.B ar t b.a\c
|
||||
\|'.
|
||||
|
||||
.TP
|
||||
.B x
|
||||
\c
|
||||
.I Extract\c
|
||||
\& members (named \c
|
||||
.I files\c
|
||||
\&) from the archive. You can
|
||||
use the `\|\c
|
||||
.B v\c
|
||||
\|' modifier with this operation, to request that
|
||||
\c
|
||||
.B ar\c
|
||||
\& list each name as it extracts it.
|
||||
|
||||
If you do not specify any \c
|
||||
.I files\c
|
||||
\&, all files in the archive
|
||||
are extracted.
|
||||
|
||||
.PP
|
||||
|
||||
A number of modifiers (\c
|
||||
.I mod\c
|
||||
\&) may immediately follow the \c
|
||||
.I p\c
|
||||
\&
|
||||
keyletter, to specify variations on an operation's behavior:
|
||||
|
||||
.TP
|
||||
.B a
|
||||
Add new files \c
|
||||
.I after\c
|
||||
\& an existing member of the
|
||||
archive. If you use the modifier \c
|
||||
.B a\c
|
||||
\&, the name of an existing archive
|
||||
member must be present as the \c
|
||||
.I membername\c
|
||||
\& argument, before the
|
||||
\c
|
||||
.I archive\c
|
||||
\& specification.
|
||||
|
||||
.TP
|
||||
.B b
|
||||
Add new files \c
|
||||
.I before\c
|
||||
\& an existing member of the
|
||||
archive. If you use the modifier \c
|
||||
.B b\c
|
||||
\&, the name of an existing archive
|
||||
member must be present as the \c
|
||||
.I membername\c
|
||||
\& argument, before the
|
||||
\c
|
||||
.I archive\c
|
||||
\& specification. (same as `\|\c
|
||||
.B i\c
|
||||
\|').
|
||||
|
||||
.TP
|
||||
.B c
|
||||
\c
|
||||
.I Create\c
|
||||
\& the archive. The specified \c
|
||||
.I archive\c
|
||||
\& is always
|
||||
created if it didn't exist, when you request an update. But a warning is
|
||||
issued unless you specify in advance that you expect to create it, by
|
||||
using this modifier.
|
||||
|
||||
.TP
|
||||
.B f
|
||||
Truncate names in the archive.
|
||||
.B ar
|
||||
will normally permit file names of any length. This will cause it to
|
||||
create archives which are not compatible with the native
|
||||
.B ar
|
||||
program on some systems. If this is a concern, the
|
||||
.B f
|
||||
modifier may be used to truncate file names when putting them in the
|
||||
archive.
|
||||
|
||||
.TP
|
||||
.B i
|
||||
Insert new files \c
|
||||
.I before\c
|
||||
\& an existing member of the
|
||||
archive. If you use the modifier \c
|
||||
.B i\c
|
||||
\&, the name of an existing archive
|
||||
member must be present as the \c
|
||||
.I membername\c
|
||||
\& argument, before the
|
||||
\c
|
||||
.I archive\c
|
||||
\& specification. (same as `\|\c
|
||||
.B b\c
|
||||
\|').
|
||||
|
||||
.TP
|
||||
.B l
|
||||
This modifier is accepted but not used.
|
||||
|
||||
.TP
|
||||
.B N
|
||||
Uses the
|
||||
.I count
|
||||
parameter. This is used if there are multiple entries in the archive
|
||||
with the same name. Extract or delete instance
|
||||
.I count
|
||||
of the given name from the archive.
|
||||
|
||||
.TP
|
||||
.B o
|
||||
Preserve the \c
|
||||
.I original\c
|
||||
\& dates of members when extracting them. If
|
||||
you do not specify this modifier, files extracted from the archive
|
||||
will be stamped with the time of extraction.
|
||||
|
||||
.TP
|
||||
.B P
|
||||
Use the full path name when matching names in the archive.
|
||||
.B ar
|
||||
can not create an archive with a full path name (such archives are not
|
||||
POSIX complaint), but other archive creators can. This option will
|
||||
cause
|
||||
.B ar
|
||||
to match file names using a complete path name, which can be
|
||||
convenient when extracting a single file from an archive created by
|
||||
another tool.
|
||||
|
||||
.TP
|
||||
.B s
|
||||
Write an object-file index into the archive, or update an existing one,
|
||||
even if no other change is made to the archive. You may use this modifier
|
||||
flag either with any operation, or alone. Running `\|\c
|
||||
.B ar s\c
|
||||
\|' on an
|
||||
archive is equivalent to running `\|\c
|
||||
.B ranlib\c
|
||||
\|' on it.
|
||||
|
||||
.TP
|
||||
.B S
|
||||
Do not generate an archive symbol table. This can speed up building a
|
||||
large library in several steps. The resulting archive can not be used
|
||||
with the linker. In order to build a symbol table, you must omit the
|
||||
`\|\c
|
||||
.B S\c
|
||||
\|' modifier on the last execution of `\|\c
|
||||
.B ar\c
|
||||
\|', or you must run `\|\c
|
||||
.B ranlib\c
|
||||
\|' on the archive.
|
||||
|
||||
.TP
|
||||
.B u
|
||||
Normally, \c
|
||||
.B ar r\c
|
||||
\&.\|.\|. inserts all files
|
||||
listed into the archive. If you would like to insert \c
|
||||
.I only\c
|
||||
\& those
|
||||
of the files you list that are newer than existing members of the same
|
||||
names, use this modifier. The `\|\c
|
||||
.B u\c
|
||||
\|' modifier is allowed only for the
|
||||
operation `\|\c
|
||||
.B r\c
|
||||
\|' (replace). In particular, the combination `\|\c
|
||||
.B qu\c
|
||||
\|' is
|
||||
not allowed, since checking the timestamps would lose any speed
|
||||
advantage from the operation `\|\c
|
||||
.B q\c
|
||||
\|'.
|
||||
|
||||
.TP
|
||||
.B v
|
||||
This modifier requests the \c
|
||||
.I verbose\c
|
||||
\& version of an operation. Many
|
||||
operations display additional information, such as filenames processed,
|
||||
when the modifier `\|\c
|
||||
.B v\c
|
||||
\|' is appended.
|
||||
|
||||
.TP
|
||||
.B V
|
||||
This modifier shows the version number of
|
||||
.BR ar .
|
||||
|
||||
.PP
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.RB "`\|" binutils "\|'"
|
||||
entry in
|
||||
.B
|
||||
info\c
|
||||
\&;
|
||||
.I
|
||||
The GNU Binary Utilities\c
|
||||
, Roland H. Pesch (October 1991).
|
||||
.BR nm ( 1 )\c
|
||||
\&,
|
||||
.BR ranlib ( 1 )\c
|
||||
\&.
|
||||
|
||||
.SH COPYING
|
||||
Copyright (c) 1991, 1992, 1993, 1995, 1998, 1999 Free Software Foundation, Inc.
|
||||
.PP
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
.PP
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the
|
||||
entire resulting derived work is distributed under the terms of a
|
||||
permission notice identical to this one.
|
||||
.PP
|
||||
Permission is granted to copy and distribute translations of this
|
||||
manual into another language, under the above conditions for modified
|
||||
versions, except that this permission notice may be included in
|
||||
translations approved by the Free Software Foundation instead of in
|
||||
the original English.
|
||||
1407
binutils/ar.c
1407
binutils/ar.c
File diff suppressed because it is too large
Load Diff
@@ -1,83 +0,0 @@
|
||||
%{
|
||||
/* arlex.l - Strange script language lexer */
|
||||
|
||||
/* Copyright (C) 1992, 95, 1997 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
/* Contributed by Steve Chamberlain
|
||||
sac@cygnus.com
|
||||
|
||||
*/
|
||||
#define DONTDECLARE_MALLOC
|
||||
#include <ansidecl.h>
|
||||
#include "libiberty.h"
|
||||
#include "arparse.h"
|
||||
|
||||
int linenumber;
|
||||
%}
|
||||
%%
|
||||
|
||||
"ADDLIB" { return ADDLIB; }
|
||||
"ADDMOD" { return ADDMOD; }
|
||||
"CLEAR" { return CLEAR; }
|
||||
"CREATE" { return CREATE; }
|
||||
"DELETE" { return DELETE; }
|
||||
"DIRECTORY" { return DIRECTORY; }
|
||||
"END" { return END; }
|
||||
"EXTRACT" { return EXTRACT; }
|
||||
"FULLDIR" { return FULLDIR; }
|
||||
"HELP" { return HELP; }
|
||||
"LIST" { return LIST; }
|
||||
"OPEN" { return OPEN; }
|
||||
"REPLACE" { return REPLACE; }
|
||||
"VERBOSE" { return VERBOSE; }
|
||||
"SAVE" { return SAVE; }
|
||||
"addlib" { return ADDLIB; }
|
||||
"addmod" { return ADDMOD; }
|
||||
"clear" { return CLEAR; }
|
||||
"create" { return CREATE; }
|
||||
"delete" { return DELETE; }
|
||||
"directory" { return DIRECTORY; }
|
||||
"end" { return END; }
|
||||
"extract" { return EXTRACT; }
|
||||
"fulldir" { return FULLDIR; }
|
||||
"help" { return HELP; }
|
||||
"list" { return LIST; }
|
||||
"open" { return OPEN; }
|
||||
"replace" { return REPLACE; }
|
||||
"verbose" { return VERBOSE; }
|
||||
"save" { return SAVE; }
|
||||
"+\n" { linenumber ++; }
|
||||
"(" { return '('; }
|
||||
")" { return ')'; }
|
||||
"," { return ','; }
|
||||
[A-Za-z0-9/$:.\-\_]+ {
|
||||
yylval.name = xstrdup (yytext);
|
||||
return FILENAME;
|
||||
}
|
||||
"*".* { }
|
||||
";".* { }
|
||||
" " { }
|
||||
"\n" { linenumber ++; return NEWLINE; }
|
||||
|
||||
%%
|
||||
#ifndef yywrap
|
||||
/* Needed for lex, though not flex. */
|
||||
int yywrap() { return 1; }
|
||||
#endif
|
||||
@@ -1,202 +0,0 @@
|
||||
%{
|
||||
/* arparse.y - Stange script language parser */
|
||||
|
||||
/* Copyright (C) 1992, 93, 95, 97, 98, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
/* Contributed by Steve Chamberlain
|
||||
sac@cygnus.com
|
||||
|
||||
*/
|
||||
#define DONTDECLARE_MALLOC
|
||||
#include "bfd.h"
|
||||
#include "bucomm.h"
|
||||
#include "arsup.h"
|
||||
extern int verbose;
|
||||
extern int yylex PARAMS ((void));
|
||||
static int yyerror PARAMS ((const char *));
|
||||
%}
|
||||
|
||||
%union {
|
||||
char *name;
|
||||
struct list *list ;
|
||||
|
||||
};
|
||||
|
||||
%token NEWLINE
|
||||
%token VERBOSE
|
||||
%token <name> FILENAME
|
||||
%token ADDLIB
|
||||
%token LIST
|
||||
%token ADDMOD
|
||||
%token CLEAR
|
||||
%token CREATE
|
||||
%token DELETE
|
||||
%token DIRECTORY
|
||||
%token END
|
||||
%token EXTRACT
|
||||
%token FULLDIR
|
||||
%token HELP
|
||||
%token QUIT
|
||||
%token REPLACE
|
||||
%token SAVE
|
||||
%token OPEN
|
||||
|
||||
%type <list> modulelist
|
||||
%type <list> modulename
|
||||
%type <name> optional_filename
|
||||
%%
|
||||
|
||||
start:
|
||||
{ prompt(); } session
|
||||
;
|
||||
|
||||
session:
|
||||
session command_line
|
||||
|
|
||||
;
|
||||
|
||||
command_line:
|
||||
command NEWLINE { prompt(); }
|
||||
|
||||
command:
|
||||
open_command
|
||||
| create_command
|
||||
| verbose_command
|
||||
| directory_command
|
||||
| addlib_command
|
||||
| clear_command
|
||||
| addmod_command
|
||||
| save_command
|
||||
| extract_command
|
||||
| replace_command
|
||||
| delete_command
|
||||
| list_command
|
||||
| END { ar_end(); return 0; }
|
||||
| error
|
||||
| FILENAME { yyerror("foo"); }
|
||||
|
|
||||
;
|
||||
|
||||
|
||||
extract_command:
|
||||
EXTRACT modulename
|
||||
{ ar_extract($2); }
|
||||
;
|
||||
|
||||
replace_command:
|
||||
REPLACE modulename
|
||||
{ ar_replace($2); }
|
||||
;
|
||||
|
||||
clear_command:
|
||||
CLEAR
|
||||
{ ar_clear(); }
|
||||
;
|
||||
|
||||
delete_command:
|
||||
DELETE modulename
|
||||
{ ar_delete($2); }
|
||||
;
|
||||
addmod_command:
|
||||
ADDMOD modulename
|
||||
{ ar_addmod($2); }
|
||||
;
|
||||
|
||||
list_command:
|
||||
LIST
|
||||
{ ar_list(); }
|
||||
;
|
||||
|
||||
save_command:
|
||||
SAVE
|
||||
{ ar_save(); }
|
||||
;
|
||||
|
||||
|
||||
|
||||
open_command:
|
||||
OPEN FILENAME
|
||||
{ ar_open($2,0); }
|
||||
;
|
||||
|
||||
create_command:
|
||||
CREATE FILENAME
|
||||
{ ar_open($2,1); }
|
||||
;
|
||||
|
||||
|
||||
addlib_command:
|
||||
ADDLIB FILENAME modulelist
|
||||
{ ar_addlib($2,$3); }
|
||||
;
|
||||
directory_command:
|
||||
DIRECTORY FILENAME modulelist optional_filename
|
||||
{ ar_directory($2, $3, $4); }
|
||||
;
|
||||
|
||||
|
||||
|
||||
optional_filename:
|
||||
FILENAME
|
||||
{ $$ = $1; }
|
||||
| { $$ = 0; }
|
||||
;
|
||||
|
||||
modulelist:
|
||||
'(' modulename ')'
|
||||
{ $$ = $2; }
|
||||
|
|
||||
{ $$ = 0; }
|
||||
;
|
||||
|
||||
modulename:
|
||||
modulename optcomma FILENAME
|
||||
{ struct list *n = (struct list *) malloc(sizeof(struct list));
|
||||
n->next = $1;
|
||||
n->name = $3;
|
||||
$$ = n;
|
||||
}
|
||||
| { $$ = 0; }
|
||||
;
|
||||
|
||||
|
||||
optcomma:
|
||||
','
|
||||
|
|
||||
;
|
||||
|
||||
|
||||
verbose_command:
|
||||
VERBOSE
|
||||
{ verbose = !verbose; }
|
||||
;
|
||||
|
||||
|
||||
%%
|
||||
|
||||
static int
|
||||
yyerror (x)
|
||||
const char *x ATTRIBUTE_UNUSED;
|
||||
{
|
||||
extern int linenumber;
|
||||
|
||||
printf (_("Syntax error in archive script, line %d\n"), linenumber + 1);
|
||||
return 0;
|
||||
}
|
||||
457
binutils/arsup.c
457
binutils/arsup.c
@@ -1,457 +0,0 @@
|
||||
/* arsup.c - Archive support for MRI compatibility
|
||||
Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
/* Contributed by Steve Chamberlain
|
||||
sac@cygnus.com
|
||||
|
||||
This file looks after requests from arparse.y, to provide the MRI
|
||||
style librarian command syntax + 1 word LIST
|
||||
|
||||
*/
|
||||
|
||||
#include "bfd.h"
|
||||
#include "arsup.h"
|
||||
#include "libiberty.h"
|
||||
#include "bucomm.h"
|
||||
|
||||
static void map_over_list
|
||||
PARAMS ((bfd *, void (*function) (bfd *, bfd *), struct list *));
|
||||
static void ar_directory_doer PARAMS ((bfd *, bfd *));
|
||||
static void ar_addlib_doer PARAMS ((bfd *, bfd *));
|
||||
|
||||
extern int verbose;
|
||||
|
||||
static void
|
||||
map_over_list (arch, function, list)
|
||||
bfd *arch;
|
||||
void (*function) PARAMS ((bfd *, bfd *));
|
||||
struct list *list;
|
||||
{
|
||||
bfd *head;
|
||||
|
||||
if (list == NULL)
|
||||
{
|
||||
bfd *next;
|
||||
|
||||
head = arch->next;
|
||||
while (head != NULL)
|
||||
{
|
||||
next = head->next;
|
||||
function (head, (bfd *) NULL);
|
||||
head = next;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
struct list *ptr;
|
||||
|
||||
/* This may appear to be a baroque way of accomplishing what we
|
||||
want. however we have to iterate over the filenames in order
|
||||
to notice where a filename is requested but does not exist in
|
||||
the archive. Ditto mapping over each file each time -- we
|
||||
want to hack multiple references. */
|
||||
for (ptr = list; ptr; ptr = ptr->next)
|
||||
{
|
||||
boolean found = false;
|
||||
bfd *prev = arch;
|
||||
|
||||
for (head = arch->next; head; head = head->next)
|
||||
{
|
||||
if (head->filename != NULL
|
||||
&& strcmp (ptr->name, head->filename) == 0)
|
||||
{
|
||||
found = true;
|
||||
function (head, prev);
|
||||
}
|
||||
prev = head;
|
||||
}
|
||||
if (! found)
|
||||
fprintf (stderr, _("No entry %s in archive.\n"), ptr->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FILE *outfile;
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
ar_directory_doer (abfd, ignore)
|
||||
bfd *abfd;
|
||||
bfd *ignore ATTRIBUTE_UNUSED;
|
||||
{
|
||||
print_arelt_descr(outfile, abfd, verbose);
|
||||
}
|
||||
|
||||
void
|
||||
ar_directory (ar_name, list, output)
|
||||
char *ar_name;
|
||||
struct list *list;
|
||||
char *output;
|
||||
{
|
||||
bfd *arch;
|
||||
|
||||
arch = open_inarch (ar_name, (char *) NULL);
|
||||
if (output)
|
||||
{
|
||||
outfile = fopen(output,"w");
|
||||
if (outfile == 0)
|
||||
{
|
||||
outfile = stdout;
|
||||
fprintf (stderr,_("Can't open file %s\n"), output);
|
||||
output = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
outfile = stdout;
|
||||
|
||||
map_over_list (arch, ar_directory_doer, list);
|
||||
|
||||
bfd_close (arch);
|
||||
|
||||
if (output)
|
||||
fclose (outfile);
|
||||
}
|
||||
|
||||
void
|
||||
DEFUN_VOID(prompt)
|
||||
{
|
||||
extern int interactive;
|
||||
if (interactive)
|
||||
{
|
||||
printf("AR >");
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
maybequit ()
|
||||
{
|
||||
if (! interactive)
|
||||
xexit (9);
|
||||
}
|
||||
|
||||
|
||||
bfd *obfd;
|
||||
char *real_name ;
|
||||
void
|
||||
DEFUN(ar_open,(name, t),
|
||||
char *name AND
|
||||
int t)
|
||||
|
||||
{
|
||||
char *tname = (char *) xmalloc (strlen (name) + 10);
|
||||
real_name = name;
|
||||
sprintf(tname, "%s-tmp", name);
|
||||
obfd = bfd_openw(tname, NULL);
|
||||
|
||||
if (!obfd) {
|
||||
fprintf(stderr,_("%s: Can't open output archive %s\n"), program_name,
|
||||
tname);
|
||||
|
||||
maybequit();
|
||||
}
|
||||
else {
|
||||
if (!t) {
|
||||
bfd **ptr;
|
||||
bfd *element;
|
||||
bfd *ibfd;
|
||||
ibfd = bfd_openr(name, NULL);
|
||||
if (!ibfd) {
|
||||
fprintf(stderr,_("%s: Can't open input archive %s\n"),
|
||||
program_name, name);
|
||||
maybequit();
|
||||
return;
|
||||
}
|
||||
if (bfd_check_format(ibfd, bfd_archive) != true) {
|
||||
fprintf(stderr,_("%s: file %s is not an archive\n"), program_name,
|
||||
name);
|
||||
maybequit();
|
||||
return;
|
||||
}
|
||||
ptr = &(obfd->archive_head);
|
||||
element = bfd_openr_next_archived_file(ibfd, NULL);
|
||||
|
||||
while (element) {
|
||||
*ptr = element;
|
||||
ptr = &element->next;
|
||||
element = bfd_openr_next_archived_file(ibfd, element);
|
||||
}
|
||||
}
|
||||
|
||||
bfd_set_format(obfd, bfd_archive);
|
||||
|
||||
obfd->has_armap = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ar_addlib_doer (abfd, prev)
|
||||
bfd *abfd;
|
||||
bfd *prev;
|
||||
{
|
||||
/* Add this module to the output bfd */
|
||||
if (prev != NULL)
|
||||
prev->next = abfd->next;
|
||||
abfd->next = obfd->archive_head;
|
||||
obfd->archive_head = abfd;
|
||||
}
|
||||
|
||||
void
|
||||
ar_addlib (name, list)
|
||||
char *name;
|
||||
struct list *list;
|
||||
{
|
||||
if (obfd == NULL)
|
||||
{
|
||||
fprintf (stderr, _("%s: no output archive specified yet\n"), program_name);
|
||||
maybequit ();
|
||||
}
|
||||
else
|
||||
{
|
||||
bfd *arch;
|
||||
|
||||
arch = open_inarch (name, (char *) NULL);
|
||||
if (arch != NULL)
|
||||
map_over_list (arch, ar_addlib_doer, list);
|
||||
|
||||
/* Don't close the bfd, since it will make the elements disasppear */
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DEFUN(ar_addmod, (list),
|
||||
struct list *list)
|
||||
{
|
||||
if (!obfd) {
|
||||
fprintf(stderr, _("%s: no open output archive\n"), program_name);
|
||||
maybequit();
|
||||
}
|
||||
else
|
||||
{
|
||||
while (list) {
|
||||
bfd *abfd = bfd_openr(list->name, NULL);
|
||||
if (!abfd) {
|
||||
fprintf(stderr,_("%s: can't open file %s\n"), program_name,
|
||||
list->name);
|
||||
maybequit();
|
||||
}
|
||||
else {
|
||||
abfd->next = obfd->archive_head;
|
||||
obfd->archive_head = abfd;
|
||||
}
|
||||
list = list->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
DEFUN_VOID(ar_clear)
|
||||
{
|
||||
if (obfd)
|
||||
obfd->archive_head = 0;
|
||||
}
|
||||
|
||||
void
|
||||
DEFUN(ar_delete, (list),
|
||||
struct list *list)
|
||||
{
|
||||
if (!obfd) {
|
||||
fprintf(stderr, _("%s: no open output archive\n"), program_name);
|
||||
maybequit();
|
||||
}
|
||||
else
|
||||
{
|
||||
while (list) {
|
||||
/* Find this name in the archive */
|
||||
bfd *member = obfd->archive_head;
|
||||
bfd **prev = &(obfd->archive_head);
|
||||
int found = 0;
|
||||
while (member) {
|
||||
if (strcmp(member->filename, list->name) == 0) {
|
||||
*prev = member->next;
|
||||
found = 1;
|
||||
}
|
||||
else {
|
||||
prev = &(member->next);
|
||||
}
|
||||
member = member->next;
|
||||
}
|
||||
if (!found) {
|
||||
fprintf(stderr,_("%s: can't find module file %s\n"), program_name,
|
||||
list->name);
|
||||
maybequit();
|
||||
}
|
||||
list = list->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DEFUN_VOID(ar_save)
|
||||
{
|
||||
|
||||
if (!obfd) {
|
||||
fprintf(stderr, _("%s: no open output archive\n"), program_name);
|
||||
maybequit();
|
||||
}
|
||||
else {
|
||||
char *ofilename = xstrdup (bfd_get_filename (obfd));
|
||||
bfd_close(obfd);
|
||||
|
||||
rename (ofilename, real_name);
|
||||
obfd = 0;
|
||||
free(ofilename);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
DEFUN(ar_replace, (list),
|
||||
struct list *list)
|
||||
{
|
||||
if (!obfd) {
|
||||
fprintf(stderr, _("%s: no open output archive\n"), program_name);
|
||||
maybequit();
|
||||
}
|
||||
else
|
||||
{
|
||||
while (list) {
|
||||
/* Find this name in the archive */
|
||||
bfd *member = obfd->archive_head;
|
||||
bfd **prev = &(obfd->archive_head);
|
||||
int found = 0;
|
||||
while (member)
|
||||
{
|
||||
if (strcmp(member->filename, list->name) == 0)
|
||||
{
|
||||
/* Found the one to replace */
|
||||
bfd *abfd = bfd_openr(list->name, 0);
|
||||
if (!abfd)
|
||||
{
|
||||
fprintf(stderr, _("%s: can't open file %s\n"), program_name, list->name);
|
||||
maybequit();
|
||||
}
|
||||
else {
|
||||
*prev = abfd;
|
||||
abfd->next = member->next;
|
||||
found = 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
prev = &(member->next);
|
||||
}
|
||||
member = member->next;
|
||||
}
|
||||
if (!found) {
|
||||
bfd *abfd = bfd_openr(list->name, 0);
|
||||
fprintf(stderr,_("%s: can't find module file %s\n"), program_name,
|
||||
list->name);
|
||||
if (!abfd)
|
||||
{
|
||||
fprintf(stderr, _("%s: can't open file %s\n"), program_name, list->name);
|
||||
maybequit();
|
||||
}
|
||||
else
|
||||
{
|
||||
*prev = abfd;
|
||||
}
|
||||
}
|
||||
|
||||
list = list->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* And I added this one */
|
||||
void
|
||||
DEFUN_VOID(ar_list)
|
||||
{
|
||||
if (!obfd)
|
||||
{
|
||||
fprintf(stderr, _("%s: no open output archive\n"), program_name);
|
||||
maybequit();
|
||||
}
|
||||
else {
|
||||
bfd *abfd;
|
||||
outfile = stdout;
|
||||
verbose =1 ;
|
||||
printf(_("Current open archive is %s\n"), bfd_get_filename (obfd));
|
||||
for (abfd = obfd->archive_head;
|
||||
abfd != (bfd *)NULL;
|
||||
abfd = abfd->next)
|
||||
{
|
||||
ar_directory_doer (abfd, (bfd *) NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DEFUN_VOID(ar_end)
|
||||
{
|
||||
if (obfd)
|
||||
{
|
||||
fclose((FILE *)(obfd->iostream));
|
||||
unlink(bfd_get_filename (obfd));
|
||||
}
|
||||
}
|
||||
void
|
||||
DEFUN(ar_extract,(list),
|
||||
struct list *list)
|
||||
{
|
||||
if (!obfd)
|
||||
{
|
||||
|
||||
fprintf(stderr, _("%s: no open archive\n"), program_name);
|
||||
maybequit();
|
||||
}
|
||||
else
|
||||
{
|
||||
while (list) {
|
||||
/* Find this name in the archive */
|
||||
bfd *member = obfd->archive_head;
|
||||
int found = 0;
|
||||
while (member && !found)
|
||||
{
|
||||
if (strcmp(member->filename, list->name) == 0)
|
||||
{
|
||||
extract_file(member);
|
||||
found = 1;
|
||||
}
|
||||
|
||||
member = member->next;
|
||||
}
|
||||
if (!found) {
|
||||
bfd_openr(list->name, 0);
|
||||
fprintf(stderr,_("%s: can't find module file %s\n"), program_name,
|
||||
list->name);
|
||||
|
||||
}
|
||||
list = list->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
/* arsup.h - archive support header file
|
||||
Copyright 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
struct list {
|
||||
char *name;
|
||||
struct list *next;
|
||||
};
|
||||
|
||||
void
|
||||
maybequit PARAMS ((void));
|
||||
|
||||
void
|
||||
prompt PARAMS ((void));
|
||||
|
||||
void
|
||||
ar_clear PARAMS ((void));
|
||||
|
||||
void
|
||||
ar_replace PARAMS ((struct list *));
|
||||
|
||||
void
|
||||
ar_delete PARAMS ((struct list *));
|
||||
|
||||
void
|
||||
ar_save PARAMS ((void));
|
||||
|
||||
void
|
||||
ar_list PARAMS ((void));
|
||||
|
||||
void
|
||||
ar_open PARAMS ((char *, int));
|
||||
|
||||
void
|
||||
ar_directory PARAMS ((char *, struct list *, char *));
|
||||
|
||||
void
|
||||
ar_addmod PARAMS ((struct list *));
|
||||
|
||||
void
|
||||
ar_addlib PARAMS ((char *, struct list *));
|
||||
|
||||
void
|
||||
ar_end PARAMS ((void));
|
||||
|
||||
void
|
||||
ar_extract PARAMS ((struct list *));
|
||||
|
||||
bfd *
|
||||
open_inarch PARAMS ((const char *archive_filename, const char *));
|
||||
|
||||
int
|
||||
yyparse PARAMS ((void));
|
||||
|
||||
/* Functions from ar.c */
|
||||
|
||||
void
|
||||
extract_file PARAMS ((bfd * abfd));
|
||||
|
||||
extern int interactive;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,261 +0,0 @@
|
||||
/* bucomm.c -- Bin Utils COMmon code.
|
||||
Copyright (C) 1991, 92, 93, 94, 95, 97, 98, 2000
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of 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 2 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
/* We might put this in a library someday so it could be dynamically
|
||||
loaded, but for now it's not necessary. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "libiberty.h"
|
||||
#include "bucomm.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <time.h> /* ctime, maybe time_t */
|
||||
|
||||
#ifndef HAVE_TIME_T_IN_TIME_H
|
||||
#ifndef HAVE_TIME_T_IN_TYPES_H
|
||||
typedef long time_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Error reporting */
|
||||
|
||||
char *program_name;
|
||||
|
||||
void
|
||||
bfd_nonfatal (string)
|
||||
CONST char *string;
|
||||
{
|
||||
CONST char *errmsg = bfd_errmsg (bfd_get_error ());
|
||||
|
||||
if (string)
|
||||
fprintf (stderr, "%s: %s: %s\n", program_name, string, errmsg);
|
||||
else
|
||||
fprintf (stderr, "%s: %s\n", program_name, errmsg);
|
||||
}
|
||||
|
||||
void
|
||||
bfd_fatal (string)
|
||||
CONST char *string;
|
||||
{
|
||||
bfd_nonfatal (string);
|
||||
xexit (1);
|
||||
}
|
||||
|
||||
void
|
||||
report (format, args)
|
||||
const char * format;
|
||||
va_list args;
|
||||
{
|
||||
fprintf (stderr, "%s: ", program_name);
|
||||
vfprintf (stderr, format, args);
|
||||
putc ('\n', stderr);
|
||||
}
|
||||
|
||||
#ifdef ANSI_PROTOTYPES
|
||||
void
|
||||
fatal (const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start (args, format);
|
||||
report (format, args);
|
||||
va_end (args);
|
||||
xexit (1);
|
||||
}
|
||||
|
||||
void
|
||||
non_fatal (const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start (args, format);
|
||||
report (format, args);
|
||||
va_end (args);
|
||||
}
|
||||
#else
|
||||
void
|
||||
fatal (va_alist)
|
||||
va_dcl
|
||||
{
|
||||
char *Format;
|
||||
va_list args;
|
||||
|
||||
va_start (args);
|
||||
Format = va_arg (args, char *);
|
||||
report (Format, args);
|
||||
va_end (args);
|
||||
xexit (1);
|
||||
}
|
||||
|
||||
void
|
||||
non_fatal (va_alist)
|
||||
va_dcl
|
||||
{
|
||||
char *Format;
|
||||
va_list args;
|
||||
|
||||
va_start (args);
|
||||
Format = va_arg (args, char *);
|
||||
report (Format, args);
|
||||
va_end (args);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Set the default BFD target based on the configured target. Doing
|
||||
this permits the binutils to be configured for a particular target,
|
||||
and linked against a shared BFD library which was configured for a
|
||||
different target. */
|
||||
|
||||
void
|
||||
set_default_bfd_target ()
|
||||
{
|
||||
/* The macro TARGET is defined by Makefile. */
|
||||
const char *target = TARGET;
|
||||
|
||||
if (! bfd_set_default_target (target))
|
||||
fatal (_("can't set BFD default target to `%s': %s"),
|
||||
target, bfd_errmsg (bfd_get_error ()));
|
||||
}
|
||||
|
||||
/* After a false return from bfd_check_format_matches with
|
||||
bfd_get_error () == bfd_error_file_ambiguously_recognized, print
|
||||
the possible matching targets. */
|
||||
|
||||
void
|
||||
list_matching_formats (p)
|
||||
char **p;
|
||||
{
|
||||
fprintf (stderr, _("%s: Matching formats:"), program_name);
|
||||
while (*p)
|
||||
fprintf (stderr, " %s", *p++);
|
||||
fputc ('\n', stderr);
|
||||
}
|
||||
|
||||
/* List the supported targets. */
|
||||
|
||||
void
|
||||
list_supported_targets (name, f)
|
||||
const char *name;
|
||||
FILE *f;
|
||||
{
|
||||
extern bfd_target *bfd_target_vector[];
|
||||
int t;
|
||||
|
||||
if (name == NULL)
|
||||
fprintf (f, _("Supported targets:"));
|
||||
else
|
||||
fprintf (f, _("%s: supported targets:"), name);
|
||||
for (t = 0; bfd_target_vector[t] != NULL; t++)
|
||||
fprintf (f, " %s", bfd_target_vector[t]->name);
|
||||
fprintf (f, "\n");
|
||||
}
|
||||
|
||||
/* Display the archive header for an element as if it were an ls -l listing:
|
||||
|
||||
Mode User\tGroup\tSize\tDate Name */
|
||||
|
||||
void
|
||||
print_arelt_descr (file, abfd, verbose)
|
||||
FILE *file;
|
||||
bfd *abfd;
|
||||
boolean verbose;
|
||||
{
|
||||
struct stat buf;
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
if (bfd_stat_arch_elt (abfd, &buf) == 0)
|
||||
{
|
||||
char modebuf[11];
|
||||
char timebuf[40];
|
||||
time_t when = buf.st_mtime;
|
||||
CONST char *ctime_result = (CONST char *) ctime (&when);
|
||||
|
||||
/* POSIX format: skip weekday and seconds from ctime output. */
|
||||
sprintf (timebuf, "%.12s %.4s", ctime_result + 4, ctime_result + 20);
|
||||
|
||||
mode_string (buf.st_mode, modebuf);
|
||||
modebuf[10] = '\0';
|
||||
/* POSIX 1003.2/D11 says to skip first character (entry type). */
|
||||
fprintf (file, "%s %ld/%ld %6ld %s ", modebuf + 1,
|
||||
(long) buf.st_uid, (long) buf.st_gid,
|
||||
(long) buf.st_size, timebuf);
|
||||
}
|
||||
}
|
||||
|
||||
fprintf (file, "%s\n", bfd_get_filename (abfd));
|
||||
}
|
||||
|
||||
/* Return the name of a temporary file in the same directory as FILENAME. */
|
||||
|
||||
char *
|
||||
make_tempname (filename)
|
||||
char *filename;
|
||||
{
|
||||
static char template[] = "stXXXXXX";
|
||||
char *tmpname;
|
||||
char *slash = strrchr (filename, '/');
|
||||
|
||||
#if defined (__DJGPP__) || defined (__GO32__) || defined (_WIN32)
|
||||
if (slash == NULL)
|
||||
slash = strrchr (filename, '\\');
|
||||
#endif
|
||||
|
||||
if (slash != (char *) NULL)
|
||||
{
|
||||
char c;
|
||||
|
||||
c = *slash;
|
||||
*slash = 0;
|
||||
tmpname = xmalloc (strlen (filename) + sizeof (template) + 1);
|
||||
strcpy (tmpname, filename);
|
||||
strcat (tmpname, "/");
|
||||
strcat (tmpname, template);
|
||||
mktemp (tmpname);
|
||||
*slash = c;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmpname = xmalloc (sizeof (template));
|
||||
strcpy (tmpname, template);
|
||||
mktemp (tmpname);
|
||||
}
|
||||
return tmpname;
|
||||
}
|
||||
|
||||
/* Parse a string into a VMA, with a fatal error if it can't be
|
||||
parsed. */
|
||||
|
||||
bfd_vma
|
||||
parse_vma (s, arg)
|
||||
const char *s;
|
||||
const char *arg;
|
||||
{
|
||||
bfd_vma ret;
|
||||
const char *end;
|
||||
|
||||
ret = bfd_scan_vma (s, &end, 0);
|
||||
|
||||
if (*end != '\0')
|
||||
fatal (_("%s: bad number: %s"), arg, s);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1,192 +0,0 @@
|
||||
/* bucomm.h -- binutils common include file.
|
||||
Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _BUCOMM_H
|
||||
#define _BUCOMM_H
|
||||
|
||||
#include "ansidecl.h"
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "bin-bugs.h"
|
||||
|
||||
#ifdef ANSI_PROTOTYPES
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
|
||||
#ifdef USE_BINARY_FOPEN
|
||||
#include "fopen-bin.h"
|
||||
#else
|
||||
#include "fopen-same.h"
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#else
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#else
|
||||
extern char *strchr ();
|
||||
extern char *strrchr ();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#else
|
||||
#ifdef HAVE_SYS_FILE_H
|
||||
#include <sys/file.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NEED_DECLARATION_STRSTR
|
||||
extern char *strstr ();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SBRK
|
||||
#ifdef NEED_DECLARATION_SBRK
|
||||
extern char *sbrk ();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NEED_DECLARATION_GETENV
|
||||
extern char *getenv ();
|
||||
#endif
|
||||
|
||||
#ifdef NEED_DECLARATION_ENVIRON
|
||||
extern char **environ;
|
||||
#endif
|
||||
|
||||
#ifndef O_RDONLY
|
||||
#define O_RDONLY 0
|
||||
#endif
|
||||
|
||||
#ifndef O_RDWR
|
||||
#define O_RDWR 2
|
||||
#endif
|
||||
|
||||
#ifndef SEEK_SET
|
||||
#define SEEK_SET 0
|
||||
#endif
|
||||
#ifndef SEEK_CUR
|
||||
#define SEEK_CUR 1
|
||||
#endif
|
||||
#ifndef SEEK_END
|
||||
#define SEEK_END 2
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && !defined(C_ALLOCA)
|
||||
# undef alloca
|
||||
# define alloca __builtin_alloca
|
||||
#else
|
||||
# if defined(HAVE_ALLOCA_H) && !defined(C_ALLOCA)
|
||||
# include <alloca.h>
|
||||
# else
|
||||
# ifndef alloca /* predefined by HP cc +Olibcalls */
|
||||
# if !defined (__STDC__) && !defined (__hpux)
|
||||
char *alloca ();
|
||||
# else
|
||||
void *alloca ();
|
||||
# endif /* __STDC__, __hpux */
|
||||
# endif /* alloca */
|
||||
# endif /* HAVE_ALLOCA_H */
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LOCALE_H
|
||||
# include <locale.h>
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
# include <libintl.h>
|
||||
# define _(String) gettext (String)
|
||||
# ifdef gettext_noop
|
||||
# define N_(String) gettext_noop (String)
|
||||
# else
|
||||
# define N_(String) (String)
|
||||
# endif
|
||||
#else
|
||||
/* Stubs that do something close enough. */
|
||||
# define textdomain(String) (String)
|
||||
# define gettext(String) (String)
|
||||
# define dgettext(Domain,Message) (Message)
|
||||
# define dcgettext(Domain,Message,Type) (Message)
|
||||
# define bindtextdomain(Domain,Directory) (Domain)
|
||||
# define _(String) (String)
|
||||
# define N_(String) (String)
|
||||
#endif
|
||||
|
||||
/* bucomm.c */
|
||||
void bfd_nonfatal PARAMS ((const char *));
|
||||
|
||||
void bfd_fatal PARAMS ((const char *)) ATTRIBUTE_NORETURN;
|
||||
|
||||
void report PARAMS ((const char *, va_list));
|
||||
|
||||
void fatal PARAMS ((const char *, ...)) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
|
||||
|
||||
void non_fatal PARAMS ((const char *, ...)) ATTRIBUTE_PRINTF_1;
|
||||
|
||||
void set_default_bfd_target PARAMS ((void));
|
||||
|
||||
void list_matching_formats PARAMS ((char **p));
|
||||
|
||||
void list_supported_targets PARAMS ((const char *, FILE *));
|
||||
|
||||
void print_arelt_descr PARAMS ((FILE *file, bfd *abfd, boolean verbose));
|
||||
|
||||
char *make_tempname PARAMS ((char *));
|
||||
|
||||
bfd_vma parse_vma PARAMS ((const char *, const char *));
|
||||
|
||||
extern char *program_name;
|
||||
|
||||
/* filemode.c */
|
||||
void mode_string PARAMS ((unsigned long mode, char *buf));
|
||||
|
||||
/* version.c */
|
||||
extern void print_version PARAMS ((const char *));
|
||||
|
||||
/* rename.c */
|
||||
extern void set_times PARAMS ((const char *, const struct stat *));
|
||||
|
||||
extern int smart_rename PARAMS ((const char *, const char *, int));
|
||||
|
||||
/* libiberty */
|
||||
PTR xmalloc PARAMS ((size_t));
|
||||
|
||||
PTR xrealloc PARAMS ((PTR, size_t));
|
||||
|
||||
#endif /* _BUCOMM_H */
|
||||
@@ -1,58 +0,0 @@
|
||||
/* budbg.c -- Interfaces to the generic debugging information routines.
|
||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor <ian@cygnus.com>.
|
||||
|
||||
This file is part of 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 2 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#ifndef BUDBG_H
|
||||
#define BUDBG_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* Routine used to read generic debugging information. */
|
||||
|
||||
extern PTR read_debugging_info PARAMS ((bfd *, asymbol **, long));
|
||||
|
||||
/* Routine used to print generic debugging information. */
|
||||
|
||||
extern boolean print_debugging_info PARAMS ((FILE *, PTR));
|
||||
|
||||
/* Routines used to read and write stabs information. */
|
||||
|
||||
extern PTR start_stab PARAMS ((PTR, bfd *, boolean, asymbol **, long));
|
||||
|
||||
extern boolean finish_stab PARAMS ((PTR, PTR));
|
||||
|
||||
extern boolean parse_stab PARAMS ((PTR, PTR, int, int, bfd_vma, const char *));
|
||||
|
||||
extern boolean write_stabs_in_sections_debugging_info
|
||||
PARAMS ((bfd *, PTR, bfd_byte **, bfd_size_type *, bfd_byte **,
|
||||
bfd_size_type *));
|
||||
|
||||
/* Routines used to read and write IEEE debugging information. */
|
||||
|
||||
extern boolean parse_ieee
|
||||
PARAMS ((PTR, bfd *, const bfd_byte *, bfd_size_type));
|
||||
|
||||
extern boolean write_ieee_debugging_info PARAMS ((bfd *, PTR));
|
||||
|
||||
/* Routine used to read COFF debugging information. */
|
||||
|
||||
extern boolean parse_coff PARAMS ((bfd *, asymbol **, long, PTR));
|
||||
|
||||
#endif
|
||||
@@ -1,539 +0,0 @@
|
||||
/* Coff file dumper.
|
||||
Copyright (C) 1994, 95, 98, 99, 2000 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by Steve Chamberlain <sac@cygnus.com>
|
||||
|
||||
This module reads a type tree generated by coffgrok and prints
|
||||
it out so we can test the grokker.
|
||||
*/
|
||||
|
||||
#include <bfd.h>
|
||||
#include <getopt.h>
|
||||
#include <libiberty.h>
|
||||
|
||||
#include "coffgrok.h"
|
||||
#include "bucomm.h"
|
||||
|
||||
#define PROGRAM_VERSION "1.0"
|
||||
|
||||
static int atnl;
|
||||
static void dump_coff_scope ();
|
||||
|
||||
static void
|
||||
tab (x)
|
||||
int x;
|
||||
{
|
||||
static int indent;
|
||||
int i;
|
||||
|
||||
if (atnl)
|
||||
{
|
||||
if (x < 0)
|
||||
{
|
||||
printf (")");
|
||||
indent += x;
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf ("\n");
|
||||
atnl = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (x == -1)
|
||||
{
|
||||
for (i = 0; i < indent; i++)
|
||||
printf (" ");
|
||||
|
||||
indent += x;
|
||||
printf (")");
|
||||
return;
|
||||
}
|
||||
|
||||
indent += x;
|
||||
|
||||
for (i = 0; i < indent; i++)
|
||||
printf (" ");
|
||||
|
||||
if (x)
|
||||
{
|
||||
printf ("(");
|
||||
}
|
||||
}
|
||||
|
||||
static void nl ()
|
||||
{
|
||||
atnl = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
dump_coff_lines (p)
|
||||
struct coff_line *p;
|
||||
{
|
||||
int i;
|
||||
int online = 0;
|
||||
tab(1);
|
||||
printf(_("#lines %d "),p->nlines);
|
||||
for (i = 0; i < p->nlines; i++)
|
||||
{
|
||||
printf("(%d 0x%x)", p->lines[i], p->addresses[i]);
|
||||
online++;
|
||||
if (online > 6)
|
||||
{
|
||||
nl();
|
||||
tab(0);
|
||||
online = 0;
|
||||
}
|
||||
}
|
||||
nl();
|
||||
tab(-1);
|
||||
}
|
||||
|
||||
static void
|
||||
dump_coff_type (p)
|
||||
struct coff_type *p;
|
||||
{
|
||||
tab (1);
|
||||
printf ("size %d ", p->size);
|
||||
switch (p->type)
|
||||
{
|
||||
case coff_secdef_type:
|
||||
printf ("section definition at %x size %x\n",
|
||||
p->u.asecdef.address,
|
||||
p->u.asecdef.size);
|
||||
nl();
|
||||
break;
|
||||
case coff_pointer_type:
|
||||
printf ("pointer to");
|
||||
nl ();
|
||||
dump_coff_type (p->u.pointer.points_to);
|
||||
break;
|
||||
case coff_array_type:
|
||||
printf ("array [%d] of", p->u.array.dim);
|
||||
nl ();
|
||||
dump_coff_type (p->u.array.array_of);
|
||||
break;
|
||||
case coff_function_type:
|
||||
printf ("function returning");
|
||||
nl ();
|
||||
dump_coff_type (p->u.function.function_returns);
|
||||
dump_coff_lines (p->u.function.lines);
|
||||
printf ("arguments");
|
||||
nl ();
|
||||
dump_coff_scope (p->u.function.parameters);
|
||||
tab (0);
|
||||
printf ("code");
|
||||
nl ();
|
||||
dump_coff_scope (p->u.function.code);
|
||||
tab(0);
|
||||
break;
|
||||
case coff_structdef_type:
|
||||
printf ("structure definition");
|
||||
nl ();
|
||||
dump_coff_scope (p->u.astructdef.elements);
|
||||
break;
|
||||
case coff_structref_type:
|
||||
if (!p->u.aenumref.ref)
|
||||
printf ("structure ref to UNKNOWN struct");
|
||||
else
|
||||
printf ("structure ref to %s", p->u.aenumref.ref->name);
|
||||
break;
|
||||
case coff_enumref_type:
|
||||
printf ("enum ref to %s", p->u.astructref.ref->name);
|
||||
break;
|
||||
case coff_enumdef_type:
|
||||
printf ("enum definition");
|
||||
nl ();
|
||||
dump_coff_scope (p->u.aenumdef.elements);
|
||||
break;
|
||||
case coff_basic_type:
|
||||
switch (p->u.basic)
|
||||
{
|
||||
case T_NULL:
|
||||
printf ("NULL");
|
||||
break;
|
||||
case T_VOID:
|
||||
printf ("VOID");
|
||||
break;
|
||||
case T_CHAR:
|
||||
printf ("CHAR");
|
||||
break;
|
||||
case T_SHORT:
|
||||
printf ("SHORT");
|
||||
break;
|
||||
case T_INT:
|
||||
printf ("INT ");
|
||||
break;
|
||||
case T_LONG:
|
||||
printf ("LONG");
|
||||
break;
|
||||
case T_FLOAT:
|
||||
printf ("FLOAT");
|
||||
break;
|
||||
case T_DOUBLE:
|
||||
printf ("DOUBLE");
|
||||
break;
|
||||
case T_STRUCT:
|
||||
printf ("STRUCT");
|
||||
break;
|
||||
case T_UNION:
|
||||
printf ("UNION");
|
||||
break;
|
||||
case T_ENUM:
|
||||
printf ("ENUM");
|
||||
break;
|
||||
case T_MOE:
|
||||
printf ("MOE ");
|
||||
break;
|
||||
case T_UCHAR:
|
||||
printf ("UCHAR");
|
||||
break;
|
||||
case T_USHORT:
|
||||
printf ("USHORT");
|
||||
break;
|
||||
case T_UINT:
|
||||
printf ("UINT");
|
||||
break;
|
||||
case T_ULONG:
|
||||
printf ("ULONG");
|
||||
break;
|
||||
case T_LNGDBL:
|
||||
printf ("LNGDBL");
|
||||
break;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
nl ();
|
||||
tab (-1);
|
||||
}
|
||||
|
||||
static void
|
||||
dump_coff_where (p)
|
||||
struct coff_where *p;
|
||||
{
|
||||
tab (1);
|
||||
switch (p->where)
|
||||
{
|
||||
case coff_where_stack:
|
||||
printf ("Stack offset %x", p->offset);
|
||||
break;
|
||||
case coff_where_memory:
|
||||
printf ("Memory section %s+%x", p->section->name, p->offset);
|
||||
break;
|
||||
case coff_where_register:
|
||||
printf ("Register %d", p->offset);
|
||||
break;
|
||||
case coff_where_member_of_struct:
|
||||
printf ("Struct Member offset %x", p->offset);
|
||||
break;
|
||||
case coff_where_member_of_enum:
|
||||
printf ("Enum Member offset %x", p->offset);
|
||||
break;
|
||||
case coff_where_unknown:
|
||||
printf ("Undefined symbol");
|
||||
break;
|
||||
case coff_where_strtag:
|
||||
printf ("STRTAG");
|
||||
case coff_where_entag:
|
||||
printf ("ENTAG");
|
||||
break;
|
||||
case coff_where_typedef:
|
||||
printf ("TYPEDEF");
|
||||
break;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
nl ();
|
||||
tab (-1);
|
||||
}
|
||||
|
||||
static void
|
||||
dump_coff_visible (p)
|
||||
struct coff_visible *p;
|
||||
{
|
||||
tab (1);
|
||||
switch (p->type)
|
||||
{
|
||||
case coff_vis_ext_def:
|
||||
printf ("coff_vis_ext_def");
|
||||
break;
|
||||
case coff_vis_ext_ref:
|
||||
printf ("coff_vis_ext_ref");
|
||||
break;
|
||||
case coff_vis_int_def:
|
||||
printf ("coff_vis_int_def");
|
||||
break;
|
||||
case coff_vis_common:
|
||||
printf ("coff_vis_common");
|
||||
break;
|
||||
case coff_vis_auto:
|
||||
printf ("coff_vis_auto");
|
||||
break;
|
||||
case coff_vis_autoparam:
|
||||
printf ("coff_vis_autoparam");
|
||||
break;
|
||||
case coff_vis_regparam:
|
||||
printf ("coff_vis_regparam");
|
||||
break;
|
||||
case coff_vis_register:
|
||||
printf ("coff_vis_register");
|
||||
break;
|
||||
case coff_vis_tag:
|
||||
printf ("coff_vis_tag");
|
||||
break;
|
||||
case coff_vis_member_of_struct:
|
||||
printf ("coff_vis_member_of_struct");
|
||||
break;
|
||||
case coff_vis_member_of_enum:
|
||||
printf ("coff_vis_member_of_enum");
|
||||
break;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
nl ();
|
||||
tab (-1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dump_coff_symbol (p)
|
||||
struct coff_symbol *p;
|
||||
{
|
||||
tab (1);
|
||||
printf ("List of symbols");
|
||||
nl ();
|
||||
while (p)
|
||||
{
|
||||
tab (1);
|
||||
tab (1);
|
||||
printf ("Symbol %s, tag %d, number %d", p->name, p->tag, p->number);
|
||||
nl ();
|
||||
tab (-1);
|
||||
tab (1);
|
||||
printf ("Type");
|
||||
nl ();
|
||||
dump_coff_type (p->type);
|
||||
tab (-1);
|
||||
tab (1);
|
||||
printf ("Where");
|
||||
dump_coff_where (p->where);
|
||||
tab (-1);
|
||||
tab (1);
|
||||
printf ("Visible");
|
||||
dump_coff_visible (p->visible);
|
||||
tab (-1);
|
||||
p = p->next;
|
||||
tab (-1);
|
||||
}
|
||||
tab (-1);
|
||||
}
|
||||
|
||||
static void
|
||||
dump_coff_scope (p)
|
||||
struct coff_scope *p;
|
||||
{
|
||||
if (p) {
|
||||
tab (1);
|
||||
printf ("List of blocks %lx ",(unsigned long) p);
|
||||
|
||||
if (p->sec) {
|
||||
printf( " %s %x..%x", p->sec->name,p->offset, p->offset + p->size -1);
|
||||
}
|
||||
nl ();
|
||||
tab (0);
|
||||
printf ("*****************");
|
||||
nl ();
|
||||
while (p)
|
||||
{
|
||||
tab (0);
|
||||
printf ("vars %d", p->nvars);
|
||||
nl ();
|
||||
dump_coff_symbol (p->vars_head);
|
||||
printf ("blocks");
|
||||
nl ();
|
||||
dump_coff_scope (p->list_head);
|
||||
nl ();
|
||||
p = p->next;
|
||||
}
|
||||
|
||||
tab (0);
|
||||
printf ("*****************");
|
||||
nl ();
|
||||
tab (-1);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dump_coff_sfile (p)
|
||||
struct coff_sfile *p;
|
||||
{
|
||||
tab (1);
|
||||
printf ("List of source files");
|
||||
nl ();
|
||||
while (p)
|
||||
{
|
||||
tab (0);
|
||||
printf ("Source file %s", p->name);
|
||||
nl ();
|
||||
dump_coff_scope (p->scope);
|
||||
p = p->next;
|
||||
}
|
||||
tab (-1);
|
||||
}
|
||||
|
||||
static void
|
||||
dump_coff_section(ptr)
|
||||
struct coff_section *ptr;
|
||||
{
|
||||
int i;
|
||||
tab(1);
|
||||
printf("section %s %d %d address %x size %x number %d nrelocs %d",
|
||||
ptr->name, ptr->code, ptr->data, ptr->address,ptr->size, ptr->number, ptr->nrelocs);
|
||||
nl();
|
||||
|
||||
for (i = 0; i < ptr->nrelocs; i++)
|
||||
{
|
||||
tab(0);
|
||||
printf("(%x %s %x)",
|
||||
ptr->relocs[i].offset,
|
||||
ptr->relocs[i].symbol->name,
|
||||
ptr->relocs[i].addend);
|
||||
nl();
|
||||
}
|
||||
tab(-1);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
coff_dump (ptr)
|
||||
struct coff_ofile *ptr;
|
||||
{
|
||||
int i;
|
||||
printf ("Coff dump");
|
||||
nl ();
|
||||
printf ("#souces %d", ptr->nsources);
|
||||
nl ();
|
||||
dump_coff_sfile (ptr->source_head);
|
||||
for (i = 0; i < ptr->nsections; i++)
|
||||
dump_coff_section(ptr->sections + i);
|
||||
}
|
||||
|
||||
|
||||
|
||||
char * program_name;
|
||||
|
||||
static void
|
||||
show_usage (file, status)
|
||||
FILE *file;
|
||||
int status;
|
||||
{
|
||||
fprintf (file, "Usage: %s [-hV] in-file\n", program_name);
|
||||
exit (status);
|
||||
}
|
||||
|
||||
static void
|
||||
show_help ()
|
||||
{
|
||||
printf (_("%s: Print a human readable interpretation of a SYSROFF object file\n"),
|
||||
program_name);
|
||||
show_usage (stdout, 0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main (ac, av)
|
||||
int ac;
|
||||
char *av[];
|
||||
{
|
||||
bfd *abfd;
|
||||
struct coff_ofile *tree;
|
||||
char **matching;
|
||||
char *input_file = NULL;
|
||||
int opt;
|
||||
static struct option long_options[] =
|
||||
{
|
||||
{ "help", no_argument, 0, 'h' },
|
||||
{ "version", no_argument, 0, 'V' },
|
||||
{ NULL, no_argument, 0, 0 }
|
||||
};
|
||||
|
||||
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
|
||||
setlocale (LC_MESSAGES, "");
|
||||
#endif
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
program_name = av[0];
|
||||
xmalloc_set_program_name (program_name);
|
||||
|
||||
while ((opt = getopt_long (ac, av, "hV", long_options,
|
||||
(int *) NULL))
|
||||
!= EOF)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
case 'h':
|
||||
show_help ();
|
||||
/*NOTREACHED*/
|
||||
case 'V':
|
||||
printf (_("GNU %s version %s\n"), program_name, PROGRAM_VERSION);
|
||||
exit (0);
|
||||
/*NOTREACHED*/
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
show_usage (stderr, 1);
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
}
|
||||
|
||||
if (optind < ac)
|
||||
{
|
||||
input_file = av[optind];
|
||||
}
|
||||
|
||||
if (!input_file)
|
||||
{
|
||||
fatal (_("no input file specified"));
|
||||
}
|
||||
abfd = bfd_openr (input_file, 0);
|
||||
|
||||
if (!abfd)
|
||||
bfd_fatal (input_file);
|
||||
|
||||
if (! bfd_check_format_matches (abfd, bfd_object, &matching))
|
||||
{
|
||||
bfd_nonfatal (input_file);
|
||||
if (bfd_get_error () == bfd_error_file_ambiguously_recognized)
|
||||
{
|
||||
list_matching_formats (matching);
|
||||
free (matching);
|
||||
}
|
||||
exit (1);
|
||||
}
|
||||
|
||||
tree = coff_grok (abfd);
|
||||
|
||||
coff_dump(tree);
|
||||
printf("\n");
|
||||
return 0;
|
||||
}
|
||||
@@ -1,737 +0,0 @@
|
||||
/* coffgrok.c
|
||||
Copyright (C) 1994, 95, 97, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by Steve Chamberlain (sac@cygnus.com)
|
||||
|
||||
This module reads a coff file and builds a really simple type tree
|
||||
which can be read by other programs. The first application is a
|
||||
coff->sysroff converter. It can be tested with coffdump.c.
|
||||
|
||||
*/
|
||||
|
||||
#include <bfd.h>
|
||||
#include "bucomm.h"
|
||||
|
||||
#include "coff/internal.h"
|
||||
#include "../bfd/libcoff.h"
|
||||
#include "coffgrok.h"
|
||||
int lofile = 1;
|
||||
static struct coff_scope *top_scope;
|
||||
static struct coff_scope *file_scope;
|
||||
static struct coff_ofile *ofile;
|
||||
|
||||
struct coff_symbol *last_function_symbol;
|
||||
struct coff_type *last_function_type;
|
||||
struct coff_type *last_struct;
|
||||
struct coff_type *last_enum;
|
||||
struct coff_sfile *cur_sfile;
|
||||
|
||||
static struct coff_symbol **tindex;
|
||||
|
||||
|
||||
static asymbol **syms;
|
||||
static long symcount;
|
||||
|
||||
#define N(x) ((x)->_n._n_nptr[1])
|
||||
|
||||
static struct coff_ptr_struct *rawsyms;
|
||||
static int rawcount;
|
||||
static bfd *abfd;
|
||||
extern char *xcalloc ();
|
||||
#define PTR_SIZE 4
|
||||
#define SHORT_SIZE 2
|
||||
#define INT_SIZE 4
|
||||
#define LONG_SIZE 4
|
||||
#define FLOAT_SIZE 4
|
||||
#define DOUBLE_SIZE 8
|
||||
|
||||
#define INDEXOF(p) ((struct coff_ptr_struct *)(p)-(rawsyms))
|
||||
|
||||
static struct coff_scope *
|
||||
empty_scope ()
|
||||
{
|
||||
struct coff_scope *l;
|
||||
l = (struct coff_scope *) (xcalloc (sizeof (struct coff_scope), 1));
|
||||
return l;
|
||||
}
|
||||
|
||||
static struct coff_symbol *
|
||||
empty_symbol ()
|
||||
{
|
||||
return (struct coff_symbol *) (xcalloc (sizeof (struct coff_symbol), 1));
|
||||
}
|
||||
|
||||
/*int l;*/
|
||||
static void
|
||||
push_scope (link)
|
||||
int link;
|
||||
{
|
||||
struct coff_scope *n = empty_scope ();
|
||||
if (link)
|
||||
{
|
||||
if (top_scope)
|
||||
{
|
||||
if (top_scope->list_tail)
|
||||
{
|
||||
top_scope->list_tail->next = n;
|
||||
}
|
||||
else
|
||||
{
|
||||
top_scope->list_head = n;
|
||||
}
|
||||
top_scope->list_tail = n;
|
||||
}
|
||||
}
|
||||
n->parent = top_scope;
|
||||
|
||||
top_scope = n;
|
||||
}
|
||||
|
||||
static void
|
||||
pop_scope ()
|
||||
{
|
||||
top_scope = top_scope->parent;
|
||||
}
|
||||
|
||||
static void
|
||||
do_sections_p1 (head)
|
||||
struct coff_ofile *head;
|
||||
{
|
||||
asection *section;
|
||||
int idx;
|
||||
struct coff_section *all = (struct coff_section *) (xcalloc (abfd->section_count + 1,
|
||||
sizeof (struct coff_section)));
|
||||
head->nsections = abfd->section_count + 1;
|
||||
head->sections = all;
|
||||
|
||||
for (idx = 0, section = abfd->sections; section; section = section->next, idx++)
|
||||
{
|
||||
long relsize;
|
||||
int i = section->target_index;
|
||||
arelent **relpp;
|
||||
long relcount;
|
||||
|
||||
relsize = bfd_get_reloc_upper_bound (abfd, section);
|
||||
if (relsize < 0)
|
||||
bfd_fatal (bfd_get_filename (abfd));
|
||||
if (relsize == 0)
|
||||
continue;
|
||||
relpp = (arelent **) xmalloc (relsize);
|
||||
relcount = bfd_canonicalize_reloc (abfd, section, relpp, syms);
|
||||
if (relcount < 0)
|
||||
bfd_fatal (bfd_get_filename (abfd));
|
||||
|
||||
head->sections[i].name = (char *) (section->name);
|
||||
head->sections[i].code = section->flags & SEC_CODE;
|
||||
head->sections[i].data = section->flags & SEC_DATA;
|
||||
if (strcmp (section->name, ".bss") == 0)
|
||||
head->sections[i].data = 1;
|
||||
head->sections[i].address = section->lma;
|
||||
head->sections[i].size = section->_raw_size;
|
||||
head->sections[i].number = idx;
|
||||
head->sections[i].nrelocs = section->reloc_count;
|
||||
head->sections[i].relocs =
|
||||
(struct coff_reloc *) (xcalloc (section->reloc_count,
|
||||
sizeof (struct coff_reloc)));
|
||||
head->sections[i].bfd_section = section;
|
||||
}
|
||||
head->sections[0].name = "ABSOLUTE";
|
||||
head->sections[0].code = 0;
|
||||
head->sections[0].data = 0;
|
||||
head->sections[0].address = 0;
|
||||
head->sections[0].size = 0;
|
||||
head->sections[0].number = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
do_sections_p2 (head)
|
||||
struct coff_ofile *head;
|
||||
{
|
||||
asection *section;
|
||||
for (section = abfd->sections; section; section = section->next)
|
||||
{
|
||||
unsigned int j;
|
||||
|
||||
for (j = 0; j < section->reloc_count; j++)
|
||||
{
|
||||
int idx;
|
||||
int i = section->target_index;
|
||||
struct coff_reloc *r = head->sections[i].relocs + j;
|
||||
arelent *sr = section->relocation + j;
|
||||
r->offset = sr->address;
|
||||
r->addend = sr->addend;
|
||||
idx = ((coff_symbol_type *) (sr->sym_ptr_ptr[0]))->native - rawsyms;
|
||||
r->symbol = tindex[idx];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static struct coff_where *
|
||||
do_where (i)
|
||||
int i;
|
||||
{
|
||||
struct internal_syment *sym = &rawsyms[i].u.syment;
|
||||
struct coff_where *where =
|
||||
(struct coff_where *) (xmalloc (sizeof (struct coff_where)));
|
||||
where->offset = sym->n_value;
|
||||
|
||||
if (sym->n_scnum == -1)
|
||||
sym->n_scnum = 0;
|
||||
|
||||
switch (sym->n_sclass)
|
||||
{
|
||||
case C_FIELD:
|
||||
where->where = coff_where_member_of_struct;
|
||||
where->offset = sym->n_value / 8;
|
||||
where->bitoffset = sym->n_value % 8;
|
||||
where->bitsize = rawsyms[i + 1].u.auxent.x_sym.x_misc.x_lnsz.x_size;
|
||||
break;
|
||||
case C_MOE:
|
||||
where->where = coff_where_member_of_enum;
|
||||
break;
|
||||
case C_MOS:
|
||||
case C_MOU:
|
||||
where->where = coff_where_member_of_struct;
|
||||
break;
|
||||
case C_AUTO:
|
||||
case C_ARG:
|
||||
where->where = coff_where_stack;
|
||||
break;
|
||||
case C_EXT:
|
||||
case C_STAT:
|
||||
case C_EXTDEF:
|
||||
case C_LABEL:
|
||||
where->where = coff_where_memory;
|
||||
where->section = &ofile->sections[sym->n_scnum];
|
||||
break;
|
||||
case C_REG:
|
||||
case C_REGPARM:
|
||||
where->where = coff_where_register;
|
||||
break;
|
||||
case C_ENTAG:
|
||||
where->where = coff_where_entag;
|
||||
break;
|
||||
case C_STRTAG:
|
||||
case C_UNTAG:
|
||||
where->where = coff_where_strtag;
|
||||
break;
|
||||
case C_TPDEF:
|
||||
where->where = coff_where_typedef;
|
||||
break;
|
||||
default:
|
||||
abort ();
|
||||
break;
|
||||
}
|
||||
return where;
|
||||
}
|
||||
|
||||
static
|
||||
struct coff_line *
|
||||
do_lines (i, name)
|
||||
int i;
|
||||
char *name;
|
||||
{
|
||||
struct coff_line *res = (struct coff_line *) xcalloc (sizeof (struct coff_line), 1);
|
||||
asection *s;
|
||||
unsigned int l;
|
||||
|
||||
/* Find out if this function has any line numbers in the table */
|
||||
for (s = abfd->sections; s; s = s->next)
|
||||
{
|
||||
for (l = 0; l < s->lineno_count; l++)
|
||||
{
|
||||
if (s->lineno[l].line_number == 0)
|
||||
{
|
||||
if (rawsyms + i == ((coff_symbol_type *) (&(s->lineno[l].u.sym[0])))->native)
|
||||
{
|
||||
/* These lines are for this function - so count them and stick them on */
|
||||
int c = 0;
|
||||
/* Find the linenumber of the top of the function, since coff linenumbers
|
||||
are relative to the start of the function. */
|
||||
int start_line = rawsyms[i + 3].u.auxent.x_sym.x_misc.x_lnsz.x_lnno;
|
||||
|
||||
l++;
|
||||
for (c = 0; s->lineno[l + c + 1].line_number; c++)
|
||||
;
|
||||
|
||||
/* Add two extra records, one for the prologue and one for the epilogue */
|
||||
c += 1;
|
||||
res->nlines = c;
|
||||
res->lines = (int *) (xcalloc (sizeof (int), c));
|
||||
res->addresses = (int *) (xcalloc (sizeof (int), c));
|
||||
res->lines[0] = start_line;
|
||||
res->addresses[0] = rawsyms[i].u.syment.n_value - s->vma;
|
||||
for (c = 0; s->lineno[l + c + 1].line_number; c++)
|
||||
{
|
||||
res->lines[c + 1] = s->lineno[l + c].line_number + start_line - 1;
|
||||
res->addresses[c + 1] = s->lineno[l + c].u.offset;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static
|
||||
struct coff_type *
|
||||
do_type (i)
|
||||
int i;
|
||||
{
|
||||
struct internal_syment *sym = &rawsyms[i].u.syment;
|
||||
union internal_auxent *aux = &rawsyms[i + 1].u.auxent;
|
||||
struct coff_type *res =
|
||||
(struct coff_type *) xmalloc (sizeof (struct coff_type));
|
||||
int type = sym->n_type;
|
||||
int which_dt = 0;
|
||||
int dimind = 0;
|
||||
|
||||
res->type = coff_basic_type;
|
||||
res->u.basic = type & 0xf;
|
||||
|
||||
switch (type & 0xf)
|
||||
{
|
||||
case T_NULL:
|
||||
case T_VOID:
|
||||
if (sym->n_numaux && sym->n_sclass == C_STAT)
|
||||
{
|
||||
/* This is probably a section definition */
|
||||
res->type = coff_secdef_type;
|
||||
res->size = aux->x_scn.x_scnlen;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (type == 0)
|
||||
{
|
||||
/* Don't know what this is, let's make it a simple int */
|
||||
res->size = INT_SIZE;
|
||||
res->u.basic = T_UINT;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Else it could be a function or pointer to void */
|
||||
res->size = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
break;
|
||||
case T_UCHAR:
|
||||
case T_CHAR:
|
||||
res->size = 1;
|
||||
break;
|
||||
case T_USHORT:
|
||||
case T_SHORT:
|
||||
res->size = SHORT_SIZE;
|
||||
break;
|
||||
case T_UINT:
|
||||
case T_INT:
|
||||
res->size = INT_SIZE;
|
||||
break;
|
||||
case T_ULONG:
|
||||
case T_LONG:
|
||||
res->size = LONG_SIZE;
|
||||
break;
|
||||
case T_FLOAT:
|
||||
res->size = FLOAT_SIZE;
|
||||
break;
|
||||
case T_DOUBLE:
|
||||
res->size = DOUBLE_SIZE;
|
||||
break;
|
||||
case T_STRUCT:
|
||||
case T_UNION:
|
||||
if (sym->n_numaux)
|
||||
{
|
||||
if (aux->x_sym.x_tagndx.p)
|
||||
{
|
||||
/* Refering to a struct defined elsewhere */
|
||||
res->type = coff_structref_type;
|
||||
res->u.astructref.ref = tindex[INDEXOF (aux->x_sym.x_tagndx.p)];
|
||||
res->size = res->u.astructref.ref ?
|
||||
res->u.astructref.ref->type->size : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* A definition of a struct */
|
||||
last_struct = res;
|
||||
res->type = coff_structdef_type;
|
||||
res->u.astructdef.elements = empty_scope ();
|
||||
res->u.astructdef.idx = 0;
|
||||
res->u.astructdef.isstruct = (type & 0xf) == T_STRUCT;
|
||||
res->size = aux->x_sym.x_misc.x_lnsz.x_size;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No auxents - it's anonynmous */
|
||||
res->type = coff_structref_type;
|
||||
res->u.astructref.ref = 0;
|
||||
res->size = 0;
|
||||
}
|
||||
break;
|
||||
case T_ENUM:
|
||||
if (aux->x_sym.x_tagndx.p)
|
||||
{
|
||||
/* Refering to a enum defined elsewhere */
|
||||
res->type = coff_enumref_type;
|
||||
res->u.aenumref.ref = tindex[INDEXOF (aux->x_sym.x_tagndx.p)];
|
||||
res->size = res->u.aenumref.ref->type->size;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* A definition of an enum */
|
||||
last_enum = res;
|
||||
res->type = coff_enumdef_type;
|
||||
res->u.aenumdef.elements = empty_scope ();
|
||||
res->size = aux->x_sym.x_misc.x_lnsz.x_size;
|
||||
}
|
||||
break;
|
||||
case T_MOE:
|
||||
break;
|
||||
}
|
||||
|
||||
for (which_dt = 5; which_dt >= 0; which_dt--)
|
||||
{
|
||||
switch ((type >> ((which_dt * 2) + 4)) & 0x3)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case DT_ARY:
|
||||
{
|
||||
struct coff_type *ptr = ((struct coff_type *)
|
||||
xmalloc (sizeof (struct coff_type)));
|
||||
int els = (dimind < DIMNUM
|
||||
? aux->x_sym.x_fcnary.x_ary.x_dimen[dimind]
|
||||
: 0);
|
||||
++dimind;
|
||||
ptr->type = coff_array_type;
|
||||
ptr->size = els * res->size;
|
||||
ptr->u.array.dim = els;
|
||||
ptr->u.array.array_of = res;
|
||||
res = ptr;
|
||||
break;
|
||||
}
|
||||
case DT_PTR:
|
||||
{
|
||||
struct coff_type *ptr =
|
||||
(struct coff_type *) xmalloc (sizeof (struct coff_type));
|
||||
ptr->size = PTR_SIZE;
|
||||
ptr->type = coff_pointer_type;
|
||||
ptr->u.pointer.points_to = res;
|
||||
res = ptr;
|
||||
break;
|
||||
}
|
||||
case DT_FCN:
|
||||
{
|
||||
struct coff_type *ptr
|
||||
= (struct coff_type *) xmalloc (sizeof (struct coff_type));
|
||||
ptr->size = 0;
|
||||
ptr->type = coff_function_type;
|
||||
ptr->u.function.function_returns = res;
|
||||
ptr->u.function.parameters = empty_scope ();
|
||||
ptr->u.function.lines = do_lines (i, sym->_n._n_nptr[1]);
|
||||
ptr->u.function.code = 0;
|
||||
last_function_type = ptr;
|
||||
res = ptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static struct coff_visible *
|
||||
do_visible (i)
|
||||
int i;
|
||||
{
|
||||
struct internal_syment *sym = &rawsyms[i].u.syment;
|
||||
struct coff_visible *visible =
|
||||
(struct coff_visible *) (xmalloc (sizeof (struct coff_visible)));
|
||||
enum coff_vis_type t;
|
||||
switch (sym->n_sclass)
|
||||
{
|
||||
case C_MOS:
|
||||
case C_MOU:
|
||||
case C_FIELD:
|
||||
t = coff_vis_member_of_struct;
|
||||
break;
|
||||
case C_MOE:
|
||||
t = coff_vis_member_of_enum;
|
||||
break;
|
||||
|
||||
case C_REGPARM:
|
||||
t = coff_vis_regparam;
|
||||
break;
|
||||
|
||||
case C_REG:
|
||||
t = coff_vis_register;
|
||||
break;
|
||||
case C_STRTAG:
|
||||
case C_UNTAG:
|
||||
case C_ENTAG:
|
||||
case C_TPDEF:
|
||||
t = coff_vis_tag;
|
||||
break;
|
||||
case C_AUTOARG:
|
||||
case C_ARG:
|
||||
t = coff_vis_autoparam;
|
||||
break;
|
||||
case C_AUTO:
|
||||
|
||||
|
||||
t = coff_vis_auto;
|
||||
break;
|
||||
case C_LABEL:
|
||||
case C_STAT:
|
||||
t = coff_vis_int_def;
|
||||
break;
|
||||
case C_EXT:
|
||||
if (sym->n_scnum == N_UNDEF)
|
||||
{
|
||||
if (sym->n_value)
|
||||
t = coff_vis_common;
|
||||
else
|
||||
t = coff_vis_ext_ref;
|
||||
}
|
||||
else
|
||||
t = coff_vis_ext_def;
|
||||
break;
|
||||
default:
|
||||
abort ();
|
||||
break;
|
||||
|
||||
}
|
||||
visible->type = t;
|
||||
return visible;
|
||||
}
|
||||
|
||||
static int
|
||||
do_define (i, b)
|
||||
int i;
|
||||
struct coff_scope *b;
|
||||
{
|
||||
static int symbol_index;
|
||||
struct internal_syment *sym = &rawsyms[i].u.syment;
|
||||
|
||||
/* Define a symbol and attach to block b */
|
||||
struct coff_symbol *s = empty_symbol ();
|
||||
|
||||
s->number = ++symbol_index;
|
||||
s->name = sym->_n._n_nptr[1];
|
||||
s->sfile = cur_sfile;
|
||||
/* Glue onto the ofile list */
|
||||
if (lofile >= 0)
|
||||
{
|
||||
if (ofile->symbol_list_tail)
|
||||
ofile->symbol_list_tail->next_in_ofile_list = s;
|
||||
else
|
||||
ofile->symbol_list_head = s;
|
||||
ofile->symbol_list_tail = s;
|
||||
/* And the block list */
|
||||
}
|
||||
if (b->vars_tail)
|
||||
b->vars_tail->next = s;
|
||||
else
|
||||
b->vars_head = s;
|
||||
|
||||
b->vars_tail = s;
|
||||
b->nvars++;
|
||||
s->type = do_type (i);
|
||||
s->where = do_where (i);
|
||||
s->visible = do_visible (i);
|
||||
|
||||
tindex[i] = s;
|
||||
|
||||
/* We remember the lowest address in each section for each source file */
|
||||
|
||||
if (s->where->where == coff_where_memory
|
||||
&& s->type->type == coff_secdef_type)
|
||||
{
|
||||
struct coff_isection *is = cur_sfile->section + s->where->section->number;
|
||||
|
||||
if (!is->init)
|
||||
{
|
||||
is->low = s->where->offset;
|
||||
is->high = s->where->offset + s->type->size;
|
||||
is->init = 1;
|
||||
is->parent = s->where->section;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (s->type->type == coff_function_type)
|
||||
last_function_symbol = s;
|
||||
|
||||
return i + sym->n_numaux + 1;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
struct coff_ofile *
|
||||
doit ()
|
||||
{
|
||||
int i;
|
||||
int infile = 0;
|
||||
struct coff_ofile *head =
|
||||
(struct coff_ofile *) xmalloc (sizeof (struct coff_ofile));
|
||||
ofile = head;
|
||||
head->source_head = 0;
|
||||
head->source_tail = 0;
|
||||
head->nsources = 0;
|
||||
head->symbol_list_tail = 0;
|
||||
head->symbol_list_head = 0;
|
||||
do_sections_p1 (head);
|
||||
push_scope (1);
|
||||
|
||||
for (i = 0; i < rawcount;)
|
||||
{
|
||||
struct internal_syment *sym = &rawsyms[i].u.syment;
|
||||
switch (sym->n_sclass)
|
||||
{
|
||||
case C_FILE:
|
||||
{
|
||||
/* new source file announced */
|
||||
struct coff_sfile *n =
|
||||
(struct coff_sfile *) xmalloc (sizeof (struct coff_sfile));
|
||||
n->section = (struct coff_isection *) xcalloc (sizeof (struct coff_isection), abfd->section_count + 1);
|
||||
cur_sfile = n;
|
||||
n->name = sym->_n._n_nptr[1];
|
||||
n->next = 0;
|
||||
|
||||
if (infile)
|
||||
{
|
||||
pop_scope ();
|
||||
}
|
||||
infile = 1;
|
||||
push_scope (1);
|
||||
file_scope = n->scope = top_scope;
|
||||
|
||||
if (head->source_tail)
|
||||
head->source_tail->next = n;
|
||||
else
|
||||
head->source_head = n;
|
||||
head->source_tail = n;
|
||||
head->nsources++;
|
||||
i += sym->n_numaux + 1;
|
||||
}
|
||||
break;
|
||||
case C_FCN:
|
||||
{
|
||||
char *name = sym->_n._n_nptr[1];
|
||||
if (name[1] == 'b')
|
||||
{
|
||||
/* Function start */
|
||||
push_scope (0);
|
||||
last_function_type->u.function.code = top_scope;
|
||||
top_scope->sec = ofile->sections + sym->n_scnum;
|
||||
top_scope->offset = sym->n_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
top_scope->size = sym->n_value - top_scope->offset + 1;
|
||||
pop_scope ();
|
||||
|
||||
}
|
||||
i += sym->n_numaux + 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case C_BLOCK:
|
||||
{
|
||||
char *name = sym->_n._n_nptr[1];
|
||||
if (name[1] == 'b')
|
||||
{
|
||||
/* Block start */
|
||||
push_scope (1);
|
||||
top_scope->sec = ofile->sections + sym->n_scnum;
|
||||
top_scope->offset = sym->n_value;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
top_scope->size = sym->n_value - top_scope->offset + 1;
|
||||
pop_scope ();
|
||||
}
|
||||
i += sym->n_numaux + 1;
|
||||
}
|
||||
break;
|
||||
case C_REGPARM:
|
||||
case C_ARG:
|
||||
i = do_define (i, last_function_symbol->type->u.function.parameters);
|
||||
break;
|
||||
case C_MOS:
|
||||
case C_MOU:
|
||||
case C_FIELD:
|
||||
i = do_define (i, last_struct->u.astructdef.elements);
|
||||
break;
|
||||
case C_MOE:
|
||||
i = do_define (i, last_enum->u.aenumdef.elements);
|
||||
break;
|
||||
case C_STRTAG:
|
||||
case C_ENTAG:
|
||||
case C_UNTAG:
|
||||
/* Various definition */
|
||||
i = do_define (i, top_scope);
|
||||
break;
|
||||
case C_EXT:
|
||||
case C_LABEL:
|
||||
i = do_define (i, file_scope);
|
||||
break;
|
||||
case C_STAT:
|
||||
case C_TPDEF:
|
||||
case C_AUTO:
|
||||
case C_REG:
|
||||
i = do_define (i, top_scope);
|
||||
break;
|
||||
default:
|
||||
abort ();
|
||||
case C_EOS:
|
||||
i += sym->n_numaux + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
do_sections_p2 (head);
|
||||
return head;
|
||||
}
|
||||
|
||||
struct coff_ofile *
|
||||
coff_grok (inabfd)
|
||||
bfd *inabfd;
|
||||
{
|
||||
long storage;
|
||||
struct coff_ofile *p;
|
||||
abfd = inabfd;
|
||||
storage = bfd_get_symtab_upper_bound (abfd);
|
||||
|
||||
if (storage < 0)
|
||||
bfd_fatal (abfd->filename);
|
||||
|
||||
syms = (asymbol **) xmalloc (storage);
|
||||
symcount = bfd_canonicalize_symtab (abfd, syms);
|
||||
if (symcount < 0)
|
||||
bfd_fatal (abfd->filename);
|
||||
rawsyms = obj_raw_syments (abfd);
|
||||
rawcount = obj_raw_syment_count (abfd);;
|
||||
tindex = (struct coff_symbol **) (xcalloc (sizeof (struct coff_symbol *), rawcount));
|
||||
|
||||
p = doit ();
|
||||
return p;
|
||||
}
|
||||
@@ -1,206 +0,0 @@
|
||||
#define T_NULL 0
|
||||
#define T_VOID 1 /* function argument (only used by compiler) */
|
||||
#define T_CHAR 2 /* character */
|
||||
#define T_SHORT 3 /* short integer */
|
||||
#define T_INT 4 /* integer */
|
||||
#define T_LONG 5 /* long integer */
|
||||
#define T_FLOAT 6 /* floating point */
|
||||
#define T_DOUBLE 7 /* double word */
|
||||
#define T_STRUCT 8 /* structure */
|
||||
#define T_UNION 9 /* union */
|
||||
#define T_ENUM 10 /* enumeration */
|
||||
#define T_MOE 11 /* member of enumeration*/
|
||||
#define T_UCHAR 12 /* unsigned character */
|
||||
#define T_USHORT 13 /* unsigned short */
|
||||
#define T_UINT 14 /* unsigned integer */
|
||||
#define T_ULONG 15 /* unsigned long */
|
||||
#define T_LNGDBL 16 /* long double */
|
||||
|
||||
|
||||
struct coff_reloc
|
||||
{
|
||||
int offset;
|
||||
struct coff_symbol *symbol;
|
||||
int addend;
|
||||
};
|
||||
|
||||
struct coff_section
|
||||
{
|
||||
char *name;
|
||||
int code;
|
||||
int data;
|
||||
int address;
|
||||
int number; /* 0..n, .text = 0 */
|
||||
int nrelocs;
|
||||
int size;
|
||||
struct coff_reloc *relocs;
|
||||
struct sec *bfd_section;
|
||||
};
|
||||
|
||||
struct coff_ofile
|
||||
{
|
||||
int nsources;
|
||||
struct coff_sfile *source_head;
|
||||
struct coff_sfile *source_tail;
|
||||
int nsections;
|
||||
struct coff_section *sections;
|
||||
struct coff_symbol *symbol_list_head;
|
||||
struct coff_symbol *symbol_list_tail;
|
||||
};
|
||||
|
||||
struct coff_isection {
|
||||
int low;
|
||||
int high;
|
||||
int init;
|
||||
struct coff_section *parent;
|
||||
};
|
||||
|
||||
struct coff_sfile
|
||||
{
|
||||
char *name;
|
||||
struct coff_scope *scope;
|
||||
struct coff_sfile *next;
|
||||
|
||||
/* Vector which maps where in each output section
|
||||
the input file has it's data */
|
||||
struct coff_isection *section;
|
||||
|
||||
};
|
||||
|
||||
|
||||
struct coff_type
|
||||
{
|
||||
int size;
|
||||
enum
|
||||
{
|
||||
coff_pointer_type, coff_function_type, coff_array_type, coff_structdef_type, coff_basic_type,
|
||||
coff_structref_type, coff_enumref_type, coff_enumdef_type, coff_secdef_type
|
||||
} type;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
int address;
|
||||
int size;
|
||||
} asecdef;
|
||||
|
||||
struct
|
||||
{
|
||||
int isstruct;
|
||||
struct coff_scope *elements;
|
||||
int idx;
|
||||
}
|
||||
astructdef;
|
||||
struct
|
||||
{
|
||||
struct coff_symbol *ref;
|
||||
} astructref;
|
||||
|
||||
struct
|
||||
{
|
||||
struct coff_scope *elements;
|
||||
int idx;
|
||||
} aenumdef;
|
||||
struct
|
||||
{
|
||||
struct coff_symbol *ref;
|
||||
} aenumref;
|
||||
|
||||
struct
|
||||
{
|
||||
struct coff_type *points_to;
|
||||
} pointer;
|
||||
struct
|
||||
{
|
||||
int dim;
|
||||
struct coff_type *array_of;
|
||||
} array;
|
||||
|
||||
struct
|
||||
{
|
||||
struct coff_type *function_returns;
|
||||
struct coff_scope *parameters;
|
||||
struct coff_scope *code;
|
||||
struct coff_line *lines;
|
||||
} function;
|
||||
int basic; /* One of T_VOID.. T_UINT */
|
||||
} u;
|
||||
};
|
||||
|
||||
|
||||
struct coff_line
|
||||
{
|
||||
int nlines;
|
||||
int *lines;
|
||||
int *addresses;
|
||||
};
|
||||
|
||||
|
||||
struct coff_scope
|
||||
{
|
||||
struct coff_section *sec; /* What section */
|
||||
int offset; /* where */
|
||||
int size; /* How big */
|
||||
struct coff_scope *parent; /* one up */
|
||||
|
||||
struct coff_scope *next; /*next along */
|
||||
|
||||
int nvars;
|
||||
|
||||
struct coff_symbol *vars_head; /* symbols */
|
||||
struct coff_symbol *vars_tail;
|
||||
|
||||
struct coff_scope *list_head; /* children */
|
||||
struct coff_scope *list_tail;
|
||||
|
||||
};
|
||||
|
||||
|
||||
struct coff_visible
|
||||
{
|
||||
enum coff_vis_type
|
||||
{
|
||||
coff_vis_ext_def,
|
||||
coff_vis_ext_ref,
|
||||
coff_vis_int_def,
|
||||
coff_vis_common,
|
||||
coff_vis_auto,
|
||||
coff_vis_register,
|
||||
coff_vis_tag,
|
||||
coff_vis_member_of_struct,
|
||||
coff_vis_member_of_enum,
|
||||
coff_vis_autoparam,
|
||||
coff_vis_regparam,
|
||||
} type;
|
||||
};
|
||||
|
||||
struct coff_where
|
||||
{
|
||||
enum
|
||||
{
|
||||
coff_where_stack, coff_where_memory, coff_where_register, coff_where_unknown,
|
||||
coff_where_strtag, coff_where_member_of_struct,
|
||||
coff_where_member_of_enum, coff_where_entag, coff_where_typedef
|
||||
|
||||
} where;
|
||||
int offset;
|
||||
int bitoffset;
|
||||
int bitsize;
|
||||
struct coff_section *section;
|
||||
};
|
||||
|
||||
struct coff_symbol
|
||||
{
|
||||
char *name;
|
||||
int tag;
|
||||
struct coff_type *type;
|
||||
struct coff_where *where;
|
||||
struct coff_visible *visible;
|
||||
struct coff_symbol *next;
|
||||
struct coff_symbol *next_in_ofile_list; /* For the ofile list */
|
||||
int number;
|
||||
int er_number;
|
||||
struct coff_sfile *sfile;
|
||||
};
|
||||
|
||||
struct coff_ofile *coff_grok();
|
||||
@@ -1,189 +0,0 @@
|
||||
/* config.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Define if using alloca.c. */
|
||||
#undef C_ALLOCA
|
||||
|
||||
/* Define to empty if the keyword does not work. */
|
||||
#undef const
|
||||
|
||||
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
|
||||
This function is required for alloca.c support on those systems. */
|
||||
#undef CRAY_STACKSEG_END
|
||||
|
||||
/* Define if you have alloca, as a function or macro. */
|
||||
#undef HAVE_ALLOCA
|
||||
|
||||
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
|
||||
#undef HAVE_ALLOCA_H
|
||||
|
||||
/* Define if you have a working `mmap' system call. */
|
||||
#undef HAVE_MMAP
|
||||
|
||||
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||
#undef HAVE_SYS_WAIT_H
|
||||
|
||||
/* Define as __inline if that's what the C compiler calls it. */
|
||||
#undef inline
|
||||
|
||||
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||
#undef off_t
|
||||
|
||||
/* Define if you need to in order for stat and other things to work. */
|
||||
#undef _POSIX_SOURCE
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||
#undef size_t
|
||||
|
||||
/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at run-time.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown
|
||||
*/
|
||||
#undef STACK_DIRECTION
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define if lex declares yytext as a char * by default, not a char[]. */
|
||||
#undef YYTEXT_POINTER
|
||||
|
||||
/* Define if you have the __argz_count function. */
|
||||
#undef HAVE___ARGZ_COUNT
|
||||
|
||||
/* Define if you have the __argz_next function. */
|
||||
#undef HAVE___ARGZ_NEXT
|
||||
|
||||
/* Define if you have the __argz_stringify function. */
|
||||
#undef HAVE___ARGZ_STRINGIFY
|
||||
|
||||
/* Define if you have the dcgettext function. */
|
||||
#undef HAVE_DCGETTEXT
|
||||
|
||||
/* Define if you have the getcwd function. */
|
||||
#undef HAVE_GETCWD
|
||||
|
||||
/* Define if you have the getpagesize function. */
|
||||
#undef HAVE_GETPAGESIZE
|
||||
|
||||
/* Define if you have the munmap function. */
|
||||
#undef HAVE_MUNMAP
|
||||
|
||||
/* Define if you have the putenv function. */
|
||||
#undef HAVE_PUTENV
|
||||
|
||||
/* Define if you have the sbrk function. */
|
||||
#undef HAVE_SBRK
|
||||
|
||||
/* Define if you have the setenv function. */
|
||||
#undef HAVE_SETENV
|
||||
|
||||
/* Define if you have the setlocale function. */
|
||||
#undef HAVE_SETLOCALE
|
||||
|
||||
/* Define if you have the stpcpy function. */
|
||||
#undef HAVE_STPCPY
|
||||
|
||||
/* Define if you have the strcasecmp function. */
|
||||
#undef HAVE_STRCASECMP
|
||||
|
||||
/* Define if you have the strchr function. */
|
||||
#undef HAVE_STRCHR
|
||||
|
||||
/* Define if you have the utimes function. */
|
||||
#undef HAVE_UTIMES
|
||||
|
||||
/* Define if you have the <argz.h> header file. */
|
||||
#undef HAVE_ARGZ_H
|
||||
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define if you have the <limits.h> header file. */
|
||||
#undef HAVE_LIMITS_H
|
||||
|
||||
/* Define if you have the <locale.h> header file. */
|
||||
#undef HAVE_LOCALE_H
|
||||
|
||||
/* Define if you have the <malloc.h> header file. */
|
||||
#undef HAVE_MALLOC_H
|
||||
|
||||
/* Define if you have the <nl_types.h> header file. */
|
||||
#undef HAVE_NL_TYPES_H
|
||||
|
||||
/* Define if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define if you have the <sys/file.h> header file. */
|
||||
#undef HAVE_SYS_FILE_H
|
||||
|
||||
/* Define if you have the <sys/param.h> header file. */
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define if you have the <values.h> header file. */
|
||||
#undef HAVE_VALUES_H
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define if you have the stpcpy function */
|
||||
#undef HAVE_STPCPY
|
||||
|
||||
/* Define if your locale.h file contains LC_MESSAGES. */
|
||||
#undef HAVE_LC_MESSAGES
|
||||
|
||||
/* Define to 1 if NLS is requested */
|
||||
#undef ENABLE_NLS
|
||||
|
||||
/* Define as 1 if you have gettext and don't want to use GNU gettext. */
|
||||
#undef HAVE_GETTEXT
|
||||
|
||||
/* Does the platform use an executable suffix? */
|
||||
#undef HAVE_EXECUTABLE_SUFFIX
|
||||
|
||||
/* Suffix used for executables, if any. */
|
||||
#undef EXECUTABLE_SUFFIX
|
||||
|
||||
/* Is the type time_t defined in <time.h>? */
|
||||
#undef HAVE_TIME_T_IN_TIME_H
|
||||
|
||||
/* Is the type time_t defined in <sys/types.h>? */
|
||||
#undef HAVE_TIME_T_IN_TYPES_H
|
||||
|
||||
/* Does <utime.h> define struct utimbuf? */
|
||||
#undef HAVE_GOOD_UTIME_H
|
||||
|
||||
/* Define if fprintf is not declared in system header files. */
|
||||
#undef NEED_DECLARATION_FPRINTF
|
||||
|
||||
/* Define if strstr is not declared in system header files. */
|
||||
#undef NEED_DECLARATION_STRSTR
|
||||
|
||||
/* Define if sbrk is not declared in system header files. */
|
||||
#undef NEED_DECLARATION_SBRK
|
||||
|
||||
/* Define if getenv is not declared in system header files. */
|
||||
#undef NEED_DECLARATION_GETENV
|
||||
|
||||
/* Define if environ is not declared in system header files. */
|
||||
#undef NEED_DECLARATION_ENVIRON
|
||||
|
||||
/* Use b modifier when opening binary files? */
|
||||
#undef USE_BINARY_FOPEN
|
||||
|
||||
/* Configured target name. */
|
||||
#undef TARGET
|
||||
|
||||
5357
binutils/configure
vendored
5357
binutils/configure
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,76 +0,0 @@
|
||||
$!
|
||||
$! This file configures binutils for use with openVMS/Alpha
|
||||
$! We do not use the configure script, since we do not have /bin/sh
|
||||
$! to execute it.
|
||||
$!
|
||||
$! Written by Klaus K"ampf (kkaempf@rmi.de)
|
||||
$!
|
||||
$arch_indx = 1 + ((f$getsyi("CPU").ge.128).and.1) ! vax==1, alpha==2
|
||||
$arch = f$element(arch_indx,"|","|VAX|Alpha|")
|
||||
$!
|
||||
$!
|
||||
$! Generate config.h
|
||||
$!
|
||||
$ create []config.h
|
||||
/* config.h. Generated automatically by configure. */
|
||||
/* config.in. Generated automatically from configure.in by autoheader. */
|
||||
/* Is the type time_t defined in <time.h>? */
|
||||
#define HAVE_TIME_T_IN_TIME_H 1
|
||||
/* Is the type time_t defined in <sys/types.h>? */
|
||||
#define HAVE_TIME_T_IN_TYPES_H 1
|
||||
/* Does <utime.h> define struct utimbuf? */
|
||||
#define HAVE_GOOD_UTIME_H 1
|
||||
/* Whether fprintf must be declared even if <stdio.h> is included. */
|
||||
#define NEED_DECLARATION_FPRINTF 1
|
||||
/* Whether sbrk must be declared even if <unistd.h> is included. */
|
||||
#undef NEED_DECLARATION_SBRK
|
||||
/* Do we need to use the b modifier when opening binary files? */
|
||||
/* #undef USE_BINARY_FOPEN */
|
||||
/* Define if you have the sbrk function. */
|
||||
/* #undef HAVE_SBRK 1 */
|
||||
/* Define if you have the utimes function. */
|
||||
#define HAVE_UTIMES 1
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H 1
|
||||
/* Define if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
/* Define if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
/* Define if you have the <strings.h> header file. */
|
||||
#define HAVE_STRINGS_H 1
|
||||
/* Define if you have the <sys/file.h> header file. */
|
||||
#define HAVE_SYS_FILE_H 1
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
$ write sys$output "Generated `config.h'"
|
||||
$!
|
||||
$!
|
||||
$! Edit VERSION in makefile.vms-in
|
||||
$!
|
||||
$ edit/tpu/nojournal/nosection/nodisplay/command=sys$input -
|
||||
[]makefile.vms-in /output=[]makefile.vms
|
||||
$DECK
|
||||
!
|
||||
! Get VERSION from configure.in
|
||||
!
|
||||
mfile := CREATE_BUFFER("mfile", "CONFIGURE.IN");
|
||||
rang := CREATE_RANGE(BEGINNING_OF(mfile), END_OF(mfile));
|
||||
match_pos := SEARCH_QUIETLY('AM_INIT_AUTOMAKE(binutils, ', FORWARD, EXACT, rang);
|
||||
IF match_pos <> 0 THEN;
|
||||
POSITION(BEGINNING_OF(match_pos));
|
||||
ERASE(match_pos);
|
||||
vers := CURRENT_LINE-")";
|
||||
ELSE;
|
||||
vers := "unknown";
|
||||
ENDIF;
|
||||
|
||||
file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
|
||||
rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file));
|
||||
match_pos := SEARCH_QUIETLY('@VERSION@', FORWARD, EXACT, rang);
|
||||
POSITION(BEGINNING_OF(match_pos));
|
||||
ERASE(match_pos);
|
||||
COPY_TEXT(vers);
|
||||
WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
|
||||
QUIT
|
||||
$ EOD
|
||||
$ write sys$output "Created `makefile.vms'"
|
||||
@@ -1,281 +0,0 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl
|
||||
AC_PREREQ(2.13)
|
||||
AC_INIT(ar.c)
|
||||
|
||||
AC_CANONICAL_SYSTEM
|
||||
|
||||
AM_INIT_AUTOMAKE(binutils, 2.9.5)
|
||||
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
AC_ARG_ENABLE(targets,
|
||||
[ --enable-targets alternative target configurations],
|
||||
[case "${enableval}" in
|
||||
yes | "") AC_ERROR(enable-targets option must specify target names or 'all')
|
||||
;;
|
||||
no) enable_targets= ;;
|
||||
*) enable_targets=$enableval ;;
|
||||
esac])dnl
|
||||
AC_ARG_ENABLE(commonbfdlib,
|
||||
[ --enable-commonbfdlib build shared BFD/opcodes/libiberty library],
|
||||
[case "${enableval}" in
|
||||
yes) commonbfdlib=true ;;
|
||||
no) commonbfdlib=false ;;
|
||||
*) AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;;
|
||||
esac])dnl
|
||||
|
||||
build_warnings="-W -Wall"
|
||||
AC_ARG_ENABLE(build-warnings,
|
||||
[ --enable-build-warnings Enable build-time compiler warnings if gcc is used],
|
||||
[case "${enableval}" in
|
||||
yes) ;;
|
||||
no) build_warnings="-w";;
|
||||
,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
|
||||
build_warnings="${build_warnings} ${t}";;
|
||||
*,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
|
||||
build_warnings="${t} ${build_warnings}";;
|
||||
*) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
|
||||
echo "Setting warning flags = $build_warnings" 6>&1
|
||||
fi])dnl
|
||||
WARN_CFLAGS=""
|
||||
if test "x${build_warnings}" != x -a "x$GCC" = xyes ; then
|
||||
WARN_CFLAGS="${build_warnings}"
|
||||
fi
|
||||
AC_SUBST(WARN_CFLAGS)
|
||||
|
||||
AM_CONFIG_HEADER(config.h:config.in)
|
||||
|
||||
if test -z "$target" ; then
|
||||
AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
|
||||
fi
|
||||
if test -z "$host" ; then
|
||||
AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
|
||||
fi
|
||||
|
||||
AC_PROG_CC
|
||||
|
||||
AC_PROG_YACC
|
||||
AM_PROG_LEX
|
||||
|
||||
ALL_LINGUAS=
|
||||
CY_GNU_GETTEXT
|
||||
|
||||
AM_MAINTAINER_MODE
|
||||
AC_EXEEXT
|
||||
if test -n "$EXEEXT"; then
|
||||
AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
|
||||
[Does the platform use an executable suffix?])
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
|
||||
[Suffix used for executables, if any.])
|
||||
|
||||
# host-specific stuff:
|
||||
|
||||
HDEFINES=
|
||||
|
||||
. ${srcdir}/../bfd/configure.host
|
||||
|
||||
AC_SUBST(HDEFINES)
|
||||
AR=${AR-ar}
|
||||
AC_SUBST(AR)
|
||||
AC_PROG_RANLIB
|
||||
AC_PROG_INSTALL
|
||||
|
||||
BFD_CC_FOR_BUILD
|
||||
|
||||
DEMANGLER_NAME=c++filt
|
||||
case "${host}" in
|
||||
*-*-go32* | *-*-msdos*)
|
||||
DEMANGLER_NAME=cxxfilt
|
||||
esac
|
||||
AC_SUBST(DEMANGLER_NAME)
|
||||
|
||||
AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h)
|
||||
AC_HEADER_SYS_WAIT
|
||||
AC_FUNC_ALLOCA
|
||||
AC_CHECK_FUNCS(sbrk utimes)
|
||||
|
||||
# Some systems have frexp only in -lm, not in -lc.
|
||||
AC_SEARCH_LIBS(frexp, m)
|
||||
|
||||
AC_MSG_CHECKING(for time_t in time.h)
|
||||
AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
|
||||
[AC_TRY_COMPILE([#include <time.h>], [time_t i;],
|
||||
bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
|
||||
AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
|
||||
if test $bu_cv_decl_time_t_time_h = yes; then
|
||||
AC_DEFINE([HAVE_TIME_T_IN_TIME_H], 1,
|
||||
[Is the type time_t defined in <time.h>?])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(for time_t in sys/types.h)
|
||||
AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
|
||||
[AC_TRY_COMPILE([#include <sys/types.h>], [time_t i;],
|
||||
bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
|
||||
AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
|
||||
if test $bu_cv_decl_time_t_types_h = yes; then
|
||||
AC_DEFINE([HAVE_TIME_T_IN_TYPES_H], 1,
|
||||
[Is the type time_t defined in <sys/types.h>?])
|
||||
fi
|
||||
|
||||
# Under Next 3.2 <utime.h> apparently does not define struct utimbuf
|
||||
# by default.
|
||||
AC_MSG_CHECKING([for utime.h])
|
||||
AC_CACHE_VAL(bu_cv_header_utime_h,
|
||||
[AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#ifdef HAVE_TIME_H
|
||||
#include <time.h>
|
||||
#endif
|
||||
#include <utime.h>],
|
||||
[struct utimbuf s;],
|
||||
bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
|
||||
AC_MSG_RESULT($bu_cv_header_utime_h)
|
||||
if test $bu_cv_header_utime_h = yes; then
|
||||
AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
|
||||
fi
|
||||
|
||||
BFD_NEED_DECLARATION(fprintf)
|
||||
BFD_NEED_DECLARATION(strstr)
|
||||
BFD_NEED_DECLARATION(sbrk)
|
||||
BFD_NEED_DECLARATION(getenv)
|
||||
BFD_NEED_DECLARATION(environ)
|
||||
|
||||
BFD_BINARY_FOPEN
|
||||
|
||||
# target-specific stuff:
|
||||
|
||||
# Canonicalize the secondary target names.
|
||||
if test -n "$enable_targets"; then
|
||||
for targ in `echo $enable_targets | sed 's/,/ /g'`
|
||||
do
|
||||
result=`$ac_config_sub $targ 2>/dev/null`
|
||||
if test -n "$result"; then
|
||||
canon_targets="$canon_targets $result"
|
||||
else
|
||||
# Allow targets that config.sub doesn't recognize, like "all".
|
||||
canon_targets="$canon_targets $targ"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
all_targets=false
|
||||
BUILD_NLMCONV=
|
||||
NLMCONV_DEFS=
|
||||
BUILD_SRCONV=
|
||||
BUILD_DLLTOOL=
|
||||
DLLTOOL_DEFS=
|
||||
BUILD_WINDRES=
|
||||
BUILD_DLLWRAP=
|
||||
BUILD_MISC=
|
||||
|
||||
for targ in $target $canon_targets
|
||||
do
|
||||
if test "x$targ" = "xall"; then
|
||||
all_targets=true
|
||||
BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
|
||||
BUILD_SRCONV='$(SRCONV_PROG)'
|
||||
NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
|
||||
else
|
||||
case $targ in
|
||||
changequote(,)dnl
|
||||
i[3456]86*-*-netware*)
|
||||
changequote([,])dnl
|
||||
BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
|
||||
NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386"
|
||||
;;
|
||||
alpha*-*-netware*)
|
||||
BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
|
||||
NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA"
|
||||
;;
|
||||
powerpc*-*-netware*)
|
||||
BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
|
||||
NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC"
|
||||
;;
|
||||
sparc*-*-netware*)
|
||||
BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
|
||||
NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC"
|
||||
;;
|
||||
esac
|
||||
case $targ in
|
||||
*-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
|
||||
esac
|
||||
case $targ in
|
||||
arm-*pe* | arm-*-wince)
|
||||
BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
|
||||
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
|
||||
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
|
||||
;;
|
||||
thumb-*pe*)
|
||||
BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
|
||||
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
|
||||
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
|
||||
;;
|
||||
changequote(,)dnl
|
||||
i[3-6]86-*pe* | i[3-6]86-*-cygwin* | i[3-6]86-*-mingw32*)
|
||||
changequote([,])dnl
|
||||
BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
|
||||
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
|
||||
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
|
||||
BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
|
||||
;;
|
||||
i[3-6]86-*-interix)
|
||||
BUILD_DLLTOOL='$(DLLTOOL_PROG)'
|
||||
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
|
||||
;;
|
||||
powerpc*-*-*pe* | powerpc*-*-cygwin*)
|
||||
BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
|
||||
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
|
||||
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
|
||||
;;
|
||||
sh*-*-*pe)
|
||||
BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
|
||||
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
|
||||
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
|
||||
;;
|
||||
mips*-*-*pe)
|
||||
BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
|
||||
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS"
|
||||
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
|
||||
;;
|
||||
mcore-*pe)
|
||||
BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
|
||||
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
|
||||
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
|
||||
;;
|
||||
mcore-*elf)
|
||||
BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
|
||||
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
|
||||
AC_SUBST(NLMCONV_DEFS)
|
||||
AC_SUBST(BUILD_NLMCONV)
|
||||
AC_SUBST(BUILD_SRCONV)
|
||||
AC_SUBST(BUILD_DLLTOOL)
|
||||
AC_SUBST(DLLTOOL_DEFS)
|
||||
AC_SUBST(BUILD_WINDRES)
|
||||
AC_SUBST(BUILD_DLLWRAP)
|
||||
AC_SUBST(BUILD_MISC)
|
||||
|
||||
AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
|
||||
|
||||
targ=$target
|
||||
. $srcdir/../bfd/config.bfd
|
||||
if test "x$targ_underscore" = "xyes"; then
|
||||
UNDERSCORE=1
|
||||
else
|
||||
UNDERSCORE=0
|
||||
fi
|
||||
AC_SUBST(UNDERSCORE)
|
||||
|
||||
AC_OUTPUT(Makefile po/Makefile.in:po/Make-in,
|
||||
[
|
||||
case "x$CONFIG_FILES" in
|
||||
*) sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile ;;
|
||||
esac
|
||||
])
|
||||
@@ -1,114 +0,0 @@
|
||||
.\" Copyright (c) 1991 Free Software Foundation
|
||||
.\" See section COPYING for conditions for redistribution
|
||||
.TH @PROGRAM@ 1 "June 1993" "cygnus support" "GNU Development Tools"
|
||||
.de BP
|
||||
.sp
|
||||
.ti \-.2i
|
||||
\(**
|
||||
..
|
||||
|
||||
.SH NAME
|
||||
@PROGRAM@ \- demangle C++ symbols
|
||||
|
||||
.SH SYNOPSIS
|
||||
.hy 0
|
||||
.na
|
||||
.TP
|
||||
.B @PROGRAM@
|
||||
.RB "[\|" \-_ | \-\-strip-underscores "\|]"
|
||||
.RB "[\|" "\-s {gnu,lucid,arm} " | " \-\-format={gnu,lucid,arm}" "\|]"
|
||||
.RB "[\|" \-\-help "\|]"
|
||||
.RB "[\|" \-\-version "\|]"
|
||||
.RB "[\|" symbol "...\|]"
|
||||
.SH DESCRIPTION
|
||||
The C++ language provides function overloading, which means that you can
|
||||
write many functions with the same name (providing each takes parameters
|
||||
of different types). All C++ function names are encoded into a
|
||||
low-level assembly label (this process is known as
|
||||
.I mangling\c
|
||||
). The
|
||||
.B @PROGRAM@
|
||||
program does the inverse mapping: it decodes (\fIdemangles\fR)
|
||||
low-level names into user-level names so that the linker can keep
|
||||
these overloaded functions from clashing.
|
||||
.PP
|
||||
Every alphanumeric word (consisting of letters, digits, underscores,
|
||||
dollars, or periods) seen in the input is a potential label. If the
|
||||
label decodes into a C++ name, the C++ name replaces the low-level
|
||||
name in the output.
|
||||
.PP
|
||||
You can use
|
||||
.B @PROGRAM@
|
||||
to decipher individual symbols by specifying these symbols on the
|
||||
command line.
|
||||
.PP
|
||||
If no
|
||||
.B symbol
|
||||
arguments are given,
|
||||
.B @PROGRAM@
|
||||
reads symbol names from the standard input and writes the demangled
|
||||
names to the standard output. All results are printed on the standard
|
||||
output.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-_
|
||||
.TP
|
||||
.B \-\-strip\-underscores
|
||||
On some systems, both the C and C++ compilers put an
|
||||
underscore in front of every name. For example, the C name
|
||||
.B foo
|
||||
gets the low-level name
|
||||
.BR _foo .
|
||||
This option removes the leading underscore.
|
||||
|
||||
.TP
|
||||
.B "\-s {gnu,lucid,arm}"
|
||||
.TP
|
||||
.B \-\-format={gnu,lucid,arm}
|
||||
GNU
|
||||
.B nm
|
||||
can decode three different methods of mangling, used by different C++
|
||||
compilers. This option selects which method it uses: the one used by
|
||||
the GNU compiler, the one used by the Lucid compiler, or the one
|
||||
specified by the C++ Annotated Reference Manual. The default is the
|
||||
GNU style.
|
||||
|
||||
.TP
|
||||
.B \-\-help
|
||||
Print a summary of the options to
|
||||
.B @PROGRAM@
|
||||
and exit.
|
||||
|
||||
.TP
|
||||
.B \-\-version
|
||||
Print the version number of
|
||||
.B @PROGRAM@
|
||||
and exit.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.RB "`\|" binutils "\|'"
|
||||
entry in
|
||||
.B
|
||||
info\c
|
||||
\&;
|
||||
.I
|
||||
The GNU Binary Utilities\c
|
||||
\&, Roland H. Pesch (June 1993).
|
||||
|
||||
.SH COPYING
|
||||
Copyright (c) 1993 Free Software Foundation, Inc.
|
||||
.PP
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
.PP
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the
|
||||
entire resulting derived work is distributed under the terms of a
|
||||
permission notice identical to this one.
|
||||
.PP
|
||||
Permission is granted to copy and distribute translations of this
|
||||
manual into another language, under the above conditions for modified
|
||||
versions, except that this permission notice may be included in
|
||||
translations approved by the Free Software Foundation instead of in
|
||||
the original English.
|
||||
3567
binutils/debug.c
3567
binutils/debug.c
File diff suppressed because it is too large
Load Diff
798
binutils/debug.h
798
binutils/debug.h
@@ -1,798 +0,0 @@
|
||||
/* debug.h -- Describe generic debugging information.
|
||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor <ian@cygnus.com>.
|
||||
|
||||
This file is part of 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 2 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#ifndef DEBUG_H
|
||||
#define DEBUG_H
|
||||
|
||||
/* This header file describes a generic debugging information format.
|
||||
We may eventually have readers which convert different formats into
|
||||
this generic format, and writers which write it out. The initial
|
||||
impetus for this was writing a convertor from stabs to HP IEEE-695
|
||||
debugging format. */
|
||||
|
||||
/* Different kinds of types. */
|
||||
|
||||
enum debug_type_kind
|
||||
{
|
||||
/* Not used. */
|
||||
DEBUG_KIND_ILLEGAL,
|
||||
/* Indirect via a pointer. */
|
||||
DEBUG_KIND_INDIRECT,
|
||||
/* Void. */
|
||||
DEBUG_KIND_VOID,
|
||||
/* Integer. */
|
||||
DEBUG_KIND_INT,
|
||||
/* Floating point. */
|
||||
DEBUG_KIND_FLOAT,
|
||||
/* Complex. */
|
||||
DEBUG_KIND_COMPLEX,
|
||||
/* Boolean. */
|
||||
DEBUG_KIND_BOOL,
|
||||
/* Struct. */
|
||||
DEBUG_KIND_STRUCT,
|
||||
/* Union. */
|
||||
DEBUG_KIND_UNION,
|
||||
/* Class. */
|
||||
DEBUG_KIND_CLASS,
|
||||
/* Union class (can this really happen?). */
|
||||
DEBUG_KIND_UNION_CLASS,
|
||||
/* Enumeration type. */
|
||||
DEBUG_KIND_ENUM,
|
||||
/* Pointer. */
|
||||
DEBUG_KIND_POINTER,
|
||||
/* Function. */
|
||||
DEBUG_KIND_FUNCTION,
|
||||
/* Reference. */
|
||||
DEBUG_KIND_REFERENCE,
|
||||
/* Range. */
|
||||
DEBUG_KIND_RANGE,
|
||||
/* Array. */
|
||||
DEBUG_KIND_ARRAY,
|
||||
/* Set. */
|
||||
DEBUG_KIND_SET,
|
||||
/* Based pointer. */
|
||||
DEBUG_KIND_OFFSET,
|
||||
/* Method. */
|
||||
DEBUG_KIND_METHOD,
|
||||
/* Const qualified type. */
|
||||
DEBUG_KIND_CONST,
|
||||
/* Volatile qualified type. */
|
||||
DEBUG_KIND_VOLATILE,
|
||||
/* Named type. */
|
||||
DEBUG_KIND_NAMED,
|
||||
/* Tagged type. */
|
||||
DEBUG_KIND_TAGGED
|
||||
};
|
||||
|
||||
/* Different kinds of variables. */
|
||||
|
||||
enum debug_var_kind
|
||||
{
|
||||
/* Not used. */
|
||||
DEBUG_VAR_ILLEGAL,
|
||||
/* A global variable. */
|
||||
DEBUG_GLOBAL,
|
||||
/* A static variable. */
|
||||
DEBUG_STATIC,
|
||||
/* A local static variable. */
|
||||
DEBUG_LOCAL_STATIC,
|
||||
/* A local variable. */
|
||||
DEBUG_LOCAL,
|
||||
/* A register variable. */
|
||||
DEBUG_REGISTER
|
||||
};
|
||||
|
||||
/* Different kinds of function parameters. */
|
||||
|
||||
enum debug_parm_kind
|
||||
{
|
||||
/* Not used. */
|
||||
DEBUG_PARM_ILLEGAL,
|
||||
/* A stack based parameter. */
|
||||
DEBUG_PARM_STACK,
|
||||
/* A register parameter. */
|
||||
DEBUG_PARM_REG,
|
||||
/* A stack based reference parameter. */
|
||||
DEBUG_PARM_REFERENCE,
|
||||
/* A register reference parameter. */
|
||||
DEBUG_PARM_REF_REG
|
||||
};
|
||||
|
||||
/* Different kinds of visibility. */
|
||||
|
||||
enum debug_visibility
|
||||
{
|
||||
/* A public field (e.g., a field in a C struct). */
|
||||
DEBUG_VISIBILITY_PUBLIC,
|
||||
/* A protected field. */
|
||||
DEBUG_VISIBILITY_PROTECTED,
|
||||
/* A private field. */
|
||||
DEBUG_VISIBILITY_PRIVATE,
|
||||
/* A field which should be ignored. */
|
||||
DEBUG_VISIBILITY_IGNORE
|
||||
};
|
||||
|
||||
/* A type. */
|
||||
|
||||
typedef struct debug_type *debug_type;
|
||||
|
||||
#define DEBUG_TYPE_NULL ((debug_type) NULL)
|
||||
|
||||
/* A field in a struct or union. */
|
||||
|
||||
typedef struct debug_field *debug_field;
|
||||
|
||||
#define DEBUG_FIELD_NULL ((debug_field) NULL)
|
||||
|
||||
/* A base class for an object. */
|
||||
|
||||
typedef struct debug_baseclass *debug_baseclass;
|
||||
|
||||
#define DEBUG_BASECLASS_NULL ((debug_baseclass) NULL)
|
||||
|
||||
/* A method of an object. */
|
||||
|
||||
typedef struct debug_method *debug_method;
|
||||
|
||||
#define DEBUG_METHOD_NULL ((debug_method) NULL)
|
||||
|
||||
/* The arguments to a method function of an object. These indicate
|
||||
which method to run. */
|
||||
|
||||
typedef struct debug_method_variant *debug_method_variant;
|
||||
|
||||
#define DEBUG_METHOD_VARIANT_NULL ((debug_method_variant) NULL)
|
||||
|
||||
/* This structure is passed to debug_write. It holds function
|
||||
pointers that debug_write will call based on the accumulated
|
||||
debugging information. */
|
||||
|
||||
struct debug_write_fns
|
||||
{
|
||||
/* This is called at the start of each new compilation unit with the
|
||||
name of the main file in the new unit. */
|
||||
boolean (*start_compilation_unit) PARAMS ((PTR, const char *));
|
||||
|
||||
/* This is called at the start of each source file within a
|
||||
compilation unit, before outputting any global information for
|
||||
that file. The argument is the name of the file. */
|
||||
boolean (*start_source) PARAMS ((PTR, const char *));
|
||||
|
||||
/* Each writer must keep a stack of types. */
|
||||
|
||||
/* Push an empty type onto the type stack. This type can appear if
|
||||
there is a reference to a type which is never defined. */
|
||||
boolean (*empty_type) PARAMS ((PTR));
|
||||
|
||||
/* Push a void type onto the type stack. */
|
||||
boolean (*void_type) PARAMS ((PTR));
|
||||
|
||||
/* Push an integer type onto the type stack, given the size and
|
||||
whether it is unsigned. */
|
||||
boolean (*int_type) PARAMS ((PTR, unsigned int, boolean));
|
||||
|
||||
/* Push a floating type onto the type stack, given the size. */
|
||||
boolean (*float_type) PARAMS ((PTR, unsigned int));
|
||||
|
||||
/* Push a complex type onto the type stack, given the size. */
|
||||
boolean (*complex_type) PARAMS ((PTR, unsigned int));
|
||||
|
||||
/* Push a boolean type onto the type stack, given the size. */
|
||||
boolean (*bool_type) PARAMS ((PTR, unsigned int));
|
||||
|
||||
/* Push an enum type onto the type stack, given the tag, a NULL
|
||||
terminated array of names and the associated values. If there is
|
||||
no tag, the tag argument will be NULL. If this is an undefined
|
||||
enum, the names and values arguments will be NULL. */
|
||||
boolean (*enum_type) PARAMS ((PTR, const char *, const char **,
|
||||
bfd_signed_vma *));
|
||||
|
||||
/* Pop the top type on the type stack, and push a pointer to that
|
||||
type onto the type stack. */
|
||||
boolean (*pointer_type) PARAMS ((PTR));
|
||||
|
||||
/* Push a function type onto the type stack. The second argument
|
||||
indicates the number of argument types that have been pushed onto
|
||||
the stack. If the number of argument types is passed as -1, then
|
||||
the argument types of the function are unknown, and no types have
|
||||
been pushed onto the stack. The third argument is true if the
|
||||
function takes a variable number of arguments. The return type
|
||||
of the function is pushed onto the type stack below the argument
|
||||
types, if any. */
|
||||
boolean (*function_type) PARAMS ((PTR, int, boolean));
|
||||
|
||||
/* Pop the top type on the type stack, and push a reference to that
|
||||
type onto the type stack. */
|
||||
boolean (*reference_type) PARAMS ((PTR));
|
||||
|
||||
/* Pop the top type on the type stack, and push a range of that type
|
||||
with the given lower and upper bounds onto the type stack. */
|
||||
boolean (*range_type) PARAMS ((PTR, bfd_signed_vma, bfd_signed_vma));
|
||||
|
||||
/* Push an array type onto the type stack. The top type on the type
|
||||
stack is the range, and the next type on the type stack is the
|
||||
element type. These should be popped before the array type is
|
||||
pushed. The arguments are the lower bound, the upper bound, and
|
||||
whether the array is a string. */
|
||||
boolean (*array_type) PARAMS ((PTR, bfd_signed_vma, bfd_signed_vma,
|
||||
boolean));
|
||||
|
||||
/* Pop the top type on the type stack, and push a set of that type
|
||||
onto the type stack. The argument indicates whether this set is
|
||||
a bitstring. */
|
||||
boolean (*set_type) PARAMS ((PTR, boolean));
|
||||
|
||||
/* Push an offset type onto the type stack. The top type on the
|
||||
type stack is the target type, and the next type on the type
|
||||
stack is the base type. These should be popped before the offset
|
||||
type is pushed. */
|
||||
boolean (*offset_type) PARAMS ((PTR));
|
||||
|
||||
/* Push a method type onto the type stack. If the second argument
|
||||
is true, the top type on the stack is the class to which the
|
||||
method belongs; otherwise, the class must be determined by the
|
||||
class to which the method is attached. The third argument is the
|
||||
number of argument types; these are pushed onto the type stack in
|
||||
reverse order (the first type popped is the last argument to the
|
||||
method). A value of -1 for the third argument means that no
|
||||
argument information is available. The fourth argument is true
|
||||
if the function takes a variable number of arguments. The next
|
||||
type on the type stack below the domain and the argument types is
|
||||
the return type of the method. All these types must be popped,
|
||||
and then the method type must be pushed. */
|
||||
boolean (*method_type) PARAMS ((PTR, boolean, int, boolean));
|
||||
|
||||
/* Pop the top type off the type stack, and push a const qualified
|
||||
version of that type onto the type stack. */
|
||||
boolean (*const_type) PARAMS ((PTR));
|
||||
|
||||
/* Pop the top type off the type stack, and push a volatile
|
||||
qualified version of that type onto the type stack. */
|
||||
boolean (*volatile_type) PARAMS ((PTR));
|
||||
|
||||
/* Start building a struct. This is followed by calls to the
|
||||
struct_field function, and finished by a call to the
|
||||
end_struct_type function. The second argument is the tag; this
|
||||
will be NULL if there isn't one. If the second argument is NULL,
|
||||
the third argument is a constant identifying this struct for use
|
||||
with tag_type. The fourth argument is true for a struct, false
|
||||
for a union. The fifth argument is the size. If this is an
|
||||
undefined struct or union, the size will be 0 and struct_field
|
||||
will not be called before end_struct_type is called. */
|
||||
boolean (*start_struct_type) PARAMS ((PTR, const char *, unsigned int,
|
||||
boolean, unsigned int));
|
||||
|
||||
/* Add a field to the struct type currently being built. The type
|
||||
of the field should be popped off the type stack. The arguments
|
||||
are the name, the bit position, the bit size (may be zero if the
|
||||
field is not packed), and the visibility. */
|
||||
boolean (*struct_field) PARAMS ((PTR, const char *, bfd_vma, bfd_vma,
|
||||
enum debug_visibility));
|
||||
|
||||
/* Finish building a struct, and push it onto the type stack. */
|
||||
boolean (*end_struct_type) PARAMS ((PTR));
|
||||
|
||||
/* Start building a class. This is followed by calls to several
|
||||
functions: struct_field, class_static_member, class_baseclass,
|
||||
class_start_method, class_method_variant,
|
||||
class_static_method_variant, and class_end_method. The class is
|
||||
finished by a call to end_class_type. The first five arguments
|
||||
are the same as for start_struct_type. The sixth argument is
|
||||
true if there is a virtual function table; if there is, the
|
||||
seventh argument is true if the virtual function table can be
|
||||
found in the type itself, and is false if the type of the object
|
||||
holding the virtual function table should be popped from the type
|
||||
stack. */
|
||||
boolean (*start_class_type) PARAMS ((PTR, const char *, unsigned int,
|
||||
boolean, unsigned int, boolean,
|
||||
boolean));
|
||||
|
||||
/* Add a static member to the class currently being built. The
|
||||
arguments are the field name, the physical name, and the
|
||||
visibility. The type must be popped off the type stack. */
|
||||
boolean (*class_static_member) PARAMS ((PTR, const char *, const char *,
|
||||
enum debug_visibility));
|
||||
|
||||
/* Add a baseclass to the class currently being built. The type of
|
||||
the baseclass must be popped off the type stack. The arguments
|
||||
are the bit position, whether the class is virtual, and the
|
||||
visibility. */
|
||||
boolean (*class_baseclass) PARAMS ((PTR, bfd_vma, boolean,
|
||||
enum debug_visibility));
|
||||
|
||||
/* Start adding a method to the class currently being built. This
|
||||
is followed by calls to class_method_variant and
|
||||
class_static_method_variant to describe different variants of the
|
||||
method which take different arguments. The method is finished
|
||||
with a call to class_end_method. The argument is the method
|
||||
name. */
|
||||
boolean (*class_start_method) PARAMS ((PTR, const char *));
|
||||
|
||||
/* Describe a variant to the class method currently being built.
|
||||
The type of the variant must be popped off the type stack. The
|
||||
second argument is the physical name of the function. The
|
||||
following arguments are the visibility, whether the variant is
|
||||
const, whether the variant is volatile, the offset in the virtual
|
||||
function table, and whether the context is on the type stack
|
||||
(below the variant type). */
|
||||
boolean (*class_method_variant) PARAMS ((PTR, const char *,
|
||||
enum debug_visibility,
|
||||
boolean, boolean,
|
||||
bfd_vma, boolean));
|
||||
|
||||
/* Describe a static variant to the class method currently being
|
||||
built. The arguments are the same as for class_method_variant,
|
||||
except that the last two arguments are omitted. The type of the
|
||||
variant must be popped off the type stack. */
|
||||
boolean (*class_static_method_variant) PARAMS ((PTR, const char *,
|
||||
enum debug_visibility,
|
||||
boolean, boolean));
|
||||
|
||||
/* Finish describing a class method. */
|
||||
boolean (*class_end_method) PARAMS ((PTR));
|
||||
|
||||
/* Finish describing a class, and push it onto the type stack. */
|
||||
boolean (*end_class_type) PARAMS ((PTR));
|
||||
|
||||
/* Push a type on the stack which was given a name by an earlier
|
||||
call to typdef. */
|
||||
boolean (*typedef_type) PARAMS ((PTR, const char *));
|
||||
|
||||
/* Push a tagged type on the stack which was defined earlier. If
|
||||
the second argument is not NULL, the type was defined by a call
|
||||
to tag. If the second argument is NULL, the type was defined by
|
||||
a call to start_struct_type or start_class_type with a tag of
|
||||
NULL and the number of the third argument. Either way, the
|
||||
fourth argument is the tag kind. Note that this may be called
|
||||
for a struct (class) being defined, in between the call to
|
||||
start_struct_type (start_class_type) and the call to
|
||||
end_struct_type (end_class_type). */
|
||||
boolean (*tag_type) PARAMS ((PTR, const char *, unsigned int,
|
||||
enum debug_type_kind));
|
||||
|
||||
/* Pop the type stack, and typedef it to the given name. */
|
||||
boolean (*typdef) PARAMS ((PTR, const char *));
|
||||
|
||||
/* Pop the type stack, and declare it as a tagged struct or union or
|
||||
enum or whatever. The tag passed down here is redundant, since
|
||||
was also passed when enum_type, start_struct_type, or
|
||||
start_class_type was called. */
|
||||
boolean (*tag) PARAMS ((PTR, const char *));
|
||||
|
||||
/* This is called to record a named integer constant. */
|
||||
boolean (*int_constant) PARAMS ((PTR, const char *, bfd_vma));
|
||||
|
||||
/* This is called to record a named floating point constant. */
|
||||
boolean (*float_constant) PARAMS ((PTR, const char *, double));
|
||||
|
||||
/* This is called to record a typed integer constant. The type is
|
||||
popped off the type stack. */
|
||||
boolean (*typed_constant) PARAMS ((PTR, const char *, bfd_vma));
|
||||
|
||||
/* This is called to record a variable. The type is popped off the
|
||||
type stack. */
|
||||
boolean (*variable) PARAMS ((PTR, const char *, enum debug_var_kind,
|
||||
bfd_vma));
|
||||
|
||||
/* Start writing out a function. The return type must be popped off
|
||||
the stack. The boolean is true if the function is global. This
|
||||
is followed by calls to function_parameter, followed by block
|
||||
information. */
|
||||
boolean (*start_function) PARAMS ((PTR, const char *, boolean));
|
||||
|
||||
/* Record a function parameter for the current function. The type
|
||||
must be popped off the stack. */
|
||||
boolean (*function_parameter) PARAMS ((PTR, const char *,
|
||||
enum debug_parm_kind, bfd_vma));
|
||||
|
||||
/* Start writing out a block. There is at least one top level block
|
||||
per function. Blocks may be nested. The argument is the
|
||||
starting address of the block. */
|
||||
boolean (*start_block) PARAMS ((PTR, bfd_vma));
|
||||
|
||||
/* Finish writing out a block. The argument is the ending address
|
||||
of the block. */
|
||||
boolean (*end_block) PARAMS ((PTR, bfd_vma));
|
||||
|
||||
/* Finish writing out a function. */
|
||||
boolean (*end_function) PARAMS ((PTR));
|
||||
|
||||
/* Record line number information for the current compilation unit. */
|
||||
boolean (*lineno) PARAMS ((PTR, const char *, unsigned long, bfd_vma));
|
||||
};
|
||||
|
||||
/* Exported functions. */
|
||||
|
||||
/* The first argument to most of these functions is a handle. This
|
||||
handle is returned by the debug_init function. The purpose of the
|
||||
handle is to permit the debugging routines to not use static
|
||||
variables, and hence to be reentrant. This would be useful for a
|
||||
program which wanted to handle two executables simultaneously. */
|
||||
|
||||
/* Return a debugging handle. */
|
||||
|
||||
extern PTR debug_init PARAMS ((void));
|
||||
|
||||
/* Set the source filename. This implicitly starts a new compilation
|
||||
unit. */
|
||||
|
||||
extern boolean debug_set_filename PARAMS ((PTR, const char *));
|
||||
|
||||
/* Change source files to the given file name. This is used for
|
||||
include files in a single compilation unit. */
|
||||
|
||||
extern boolean debug_start_source PARAMS ((PTR, const char *));
|
||||
|
||||
/* Record a function definition. This implicitly starts a function
|
||||
block. The debug_type argument is the type of the return value.
|
||||
The boolean indicates whether the function is globally visible.
|
||||
The bfd_vma is the address of the start of the function. Currently
|
||||
the parameter types are specified by calls to
|
||||
debug_record_parameter. */
|
||||
|
||||
extern boolean debug_record_function
|
||||
PARAMS ((PTR, const char *, debug_type, boolean, bfd_vma));
|
||||
|
||||
/* Record a parameter for the current function. */
|
||||
|
||||
extern boolean debug_record_parameter
|
||||
PARAMS ((PTR, const char *, debug_type, enum debug_parm_kind, bfd_vma));
|
||||
|
||||
/* End a function definition. The argument is the address where the
|
||||
function ends. */
|
||||
|
||||
extern boolean debug_end_function PARAMS ((PTR, bfd_vma));
|
||||
|
||||
/* Start a block in a function. All local information will be
|
||||
recorded in this block, until the matching call to debug_end_block.
|
||||
debug_start_block and debug_end_block may be nested. The argument
|
||||
is the address at which this block starts. */
|
||||
|
||||
extern boolean debug_start_block PARAMS ((PTR, bfd_vma));
|
||||
|
||||
/* Finish a block in a function. This matches the call to
|
||||
debug_start_block. The argument is the address at which this block
|
||||
ends. */
|
||||
|
||||
extern boolean debug_end_block PARAMS ((PTR, bfd_vma));
|
||||
|
||||
/* Associate a line number in the current source file with a given
|
||||
address. */
|
||||
|
||||
extern boolean debug_record_line PARAMS ((PTR, unsigned long, bfd_vma));
|
||||
|
||||
/* Start a named common block. This is a block of variables that may
|
||||
move in memory. */
|
||||
|
||||
extern boolean debug_start_common_block PARAMS ((PTR, const char *));
|
||||
|
||||
/* End a named common block. */
|
||||
|
||||
extern boolean debug_end_common_block PARAMS ((PTR, const char *));
|
||||
|
||||
/* Record a named integer constant. */
|
||||
|
||||
extern boolean debug_record_int_const PARAMS ((PTR, const char *, bfd_vma));
|
||||
|
||||
/* Record a named floating point constant. */
|
||||
|
||||
extern boolean debug_record_float_const PARAMS ((PTR, const char *, double));
|
||||
|
||||
/* Record a typed constant with an integral value. */
|
||||
|
||||
extern boolean debug_record_typed_const
|
||||
PARAMS ((PTR, const char *, debug_type, bfd_vma));
|
||||
|
||||
/* Record a label. */
|
||||
|
||||
extern boolean debug_record_label
|
||||
PARAMS ((PTR, const char *, debug_type, bfd_vma));
|
||||
|
||||
/* Record a variable. */
|
||||
|
||||
extern boolean debug_record_variable
|
||||
PARAMS ((PTR, const char *, debug_type, enum debug_var_kind, bfd_vma));
|
||||
|
||||
/* Make an indirect type. The first argument is a pointer to the
|
||||
location where the real type will be placed. The second argument
|
||||
is the type tag, if there is one; this may be NULL; the only
|
||||
purpose of this argument is so that debug_get_type_name can return
|
||||
something useful. This function may be used when a type is
|
||||
referenced before it is defined. */
|
||||
|
||||
extern debug_type debug_make_indirect_type
|
||||
PARAMS ((PTR, debug_type *, const char *));
|
||||
|
||||
/* Make a void type. */
|
||||
|
||||
extern debug_type debug_make_void_type PARAMS ((PTR));
|
||||
|
||||
/* Make an integer type of a given size. The boolean argument is true
|
||||
if the integer is unsigned. */
|
||||
|
||||
extern debug_type debug_make_int_type PARAMS ((PTR, unsigned int, boolean));
|
||||
|
||||
/* Make a floating point type of a given size. FIXME: On some
|
||||
platforms, like an Alpha, you probably need to be able to specify
|
||||
the format. */
|
||||
|
||||
extern debug_type debug_make_float_type PARAMS ((PTR, unsigned int));
|
||||
|
||||
/* Make a boolean type of a given size. */
|
||||
|
||||
extern debug_type debug_make_bool_type PARAMS ((PTR, unsigned int));
|
||||
|
||||
/* Make a complex type of a given size. */
|
||||
|
||||
extern debug_type debug_make_complex_type PARAMS ((PTR, unsigned int));
|
||||
|
||||
/* Make a structure type. The second argument is true for a struct,
|
||||
false for a union. The third argument is the size of the struct.
|
||||
The fourth argument is a NULL terminated array of fields. */
|
||||
|
||||
extern debug_type debug_make_struct_type
|
||||
PARAMS ((PTR, boolean, bfd_vma, debug_field *));
|
||||
|
||||
/* Make an object type. The first three arguments after the handle
|
||||
are the same as for debug_make_struct_type. The next arguments are
|
||||
a NULL terminated array of base classes, a NULL terminated array of
|
||||
methods, the type of the object holding the virtual function table
|
||||
if it is not this object, and a boolean which is true if this
|
||||
object has its own virtual function table. */
|
||||
|
||||
extern debug_type debug_make_object_type
|
||||
PARAMS ((PTR, boolean, bfd_vma, debug_field *, debug_baseclass *,
|
||||
debug_method *, debug_type, boolean));
|
||||
|
||||
/* Make an enumeration type. The arguments are a null terminated
|
||||
array of strings, and an array of corresponding values. */
|
||||
|
||||
extern debug_type debug_make_enum_type
|
||||
PARAMS ((PTR, const char **, bfd_signed_vma *));
|
||||
|
||||
/* Make a pointer to a given type. */
|
||||
|
||||
extern debug_type debug_make_pointer_type
|
||||
PARAMS ((PTR, debug_type));
|
||||
|
||||
/* Make a function type. The second argument is the return type. The
|
||||
third argument is a NULL terminated array of argument types. The
|
||||
fourth argument is true if the function takes a variable number of
|
||||
arguments. If the third argument is NULL, then the argument types
|
||||
are unknown. */
|
||||
|
||||
extern debug_type debug_make_function_type
|
||||
PARAMS ((PTR, debug_type, debug_type *, boolean));
|
||||
|
||||
/* Make a reference to a given type. */
|
||||
|
||||
extern debug_type debug_make_reference_type PARAMS ((PTR, debug_type));
|
||||
|
||||
/* Make a range of a given type from a lower to an upper bound. */
|
||||
|
||||
extern debug_type debug_make_range_type
|
||||
PARAMS ((PTR, debug_type, bfd_signed_vma, bfd_signed_vma));
|
||||
|
||||
/* Make an array type. The second argument is the type of an element
|
||||
of the array. The third argument is the type of a range of the
|
||||
array. The fourth and fifth argument are the lower and upper
|
||||
bounds, respectively (if the bounds are not known, lower should be
|
||||
0 and upper should be -1). The sixth argument is true if this
|
||||
array is actually a string, as in C. */
|
||||
|
||||
extern debug_type debug_make_array_type
|
||||
PARAMS ((PTR, debug_type, debug_type, bfd_signed_vma, bfd_signed_vma,
|
||||
boolean));
|
||||
|
||||
/* Make a set of a given type. For example, a Pascal set type. The
|
||||
boolean argument is true if this set is actually a bitstring, as in
|
||||
CHILL. */
|
||||
|
||||
extern debug_type debug_make_set_type PARAMS ((PTR, debug_type, boolean));
|
||||
|
||||
/* Make a type for a pointer which is relative to an object. The
|
||||
second argument is the type of the object to which the pointer is
|
||||
relative. The third argument is the type that the pointer points
|
||||
to. */
|
||||
|
||||
extern debug_type debug_make_offset_type
|
||||
PARAMS ((PTR, debug_type, debug_type));
|
||||
|
||||
/* Make a type for a method function. The second argument is the
|
||||
return type. The third argument is the domain. The fourth
|
||||
argument is a NULL terminated array of argument types. The fifth
|
||||
argument is true if the function takes a variable number of
|
||||
arguments, in which case the array of argument types indicates the
|
||||
types of the first arguments. The domain and the argument array
|
||||
may be NULL, in which case this is a stub method and that
|
||||
information is not available. Stabs debugging uses this, and gets
|
||||
the argument types from the mangled name. */
|
||||
|
||||
extern debug_type debug_make_method_type
|
||||
PARAMS ((PTR, debug_type, debug_type, debug_type *, boolean));
|
||||
|
||||
/* Make a const qualified version of a given type. */
|
||||
|
||||
extern debug_type debug_make_const_type PARAMS ((PTR, debug_type));
|
||||
|
||||
/* Make a volatile qualified version of a given type. */
|
||||
|
||||
extern debug_type debug_make_volatile_type PARAMS ((PTR, debug_type));
|
||||
|
||||
/* Make an undefined tagged type. For example, a struct which has
|
||||
been mentioned, but not defined. */
|
||||
|
||||
extern debug_type debug_make_undefined_tagged_type
|
||||
PARAMS ((PTR, const char *, enum debug_type_kind));
|
||||
|
||||
/* Make a base class for an object. The second argument is the base
|
||||
class type. The third argument is the bit position of this base
|
||||
class in the object. The fourth argument is whether this is a
|
||||
virtual class. The fifth argument is the visibility of the base
|
||||
class. */
|
||||
|
||||
extern debug_baseclass debug_make_baseclass
|
||||
PARAMS ((PTR, debug_type, bfd_vma, boolean, enum debug_visibility));
|
||||
|
||||
/* Make a field for a struct. The second argument is the name. The
|
||||
third argument is the type of the field. The fourth argument is
|
||||
the bit position of the field. The fifth argument is the size of
|
||||
the field (it may be zero). The sixth argument is the visibility
|
||||
of the field. */
|
||||
|
||||
extern debug_field debug_make_field
|
||||
PARAMS ((PTR, const char *, debug_type, bfd_vma, bfd_vma,
|
||||
enum debug_visibility));
|
||||
|
||||
/* Make a static member of an object. The second argument is the
|
||||
name. The third argument is the type of the member. The fourth
|
||||
argument is the physical name of the member (i.e., the name as a
|
||||
global variable). The fifth argument is the visibility of the
|
||||
member. */
|
||||
|
||||
extern debug_field debug_make_static_member
|
||||
PARAMS ((PTR, const char *, debug_type, const char *,
|
||||
enum debug_visibility));
|
||||
|
||||
/* Make a method. The second argument is the name, and the third
|
||||
argument is a NULL terminated array of method variants. Each
|
||||
method variant is a method with this name but with different
|
||||
argument types. */
|
||||
|
||||
extern debug_method debug_make_method
|
||||
PARAMS ((PTR, const char *, debug_method_variant *));
|
||||
|
||||
/* Make a method variant. The second argument is the physical name of
|
||||
the function. The third argument is the type of the function,
|
||||
probably constructed by debug_make_method_type. The fourth
|
||||
argument is the visibility. The fifth argument is whether this is
|
||||
a const function. The sixth argument is whether this is a volatile
|
||||
function. The seventh argument is the index in the virtual
|
||||
function table, if any. The eighth argument is the virtual
|
||||
function context. */
|
||||
|
||||
extern debug_method_variant debug_make_method_variant
|
||||
PARAMS ((PTR, const char *, debug_type, enum debug_visibility, boolean,
|
||||
boolean, bfd_vma, debug_type));
|
||||
|
||||
/* Make a static method argument. The arguments are the same as for
|
||||
debug_make_method_variant, except that the last two are omitted
|
||||
since a static method can not also be virtual. */
|
||||
|
||||
extern debug_method_variant debug_make_static_method_variant
|
||||
PARAMS ((PTR, const char *, debug_type, enum debug_visibility, boolean,
|
||||
boolean));
|
||||
|
||||
/* Name a type. This returns a new type with an attached name. */
|
||||
|
||||
extern debug_type debug_name_type PARAMS ((PTR, const char *, debug_type));
|
||||
|
||||
/* Give a tag to a type, such as a struct or union. This returns a
|
||||
new type with an attached tag. */
|
||||
|
||||
extern debug_type debug_tag_type PARAMS ((PTR, const char *, debug_type));
|
||||
|
||||
/* Record the size of a given type. */
|
||||
|
||||
extern boolean debug_record_type_size PARAMS ((PTR, debug_type, unsigned int));
|
||||
|
||||
/* Find a named type. */
|
||||
|
||||
extern debug_type debug_find_named_type PARAMS ((PTR, const char *));
|
||||
|
||||
/* Find a tagged type. */
|
||||
|
||||
extern debug_type debug_find_tagged_type
|
||||
PARAMS ((PTR, const char *, enum debug_type_kind));
|
||||
|
||||
/* Get the kind of a type. */
|
||||
|
||||
extern enum debug_type_kind debug_get_type_kind PARAMS ((PTR, debug_type));
|
||||
|
||||
/* Get the name of a type. */
|
||||
|
||||
extern const char *debug_get_type_name PARAMS ((PTR, debug_type));
|
||||
|
||||
/* Get the size of a type. */
|
||||
|
||||
extern bfd_vma debug_get_type_size PARAMS ((PTR, debug_type));
|
||||
|
||||
/* Get the return type of a function or method type. */
|
||||
|
||||
extern debug_type debug_get_return_type PARAMS ((PTR, debug_type));
|
||||
|
||||
/* Get the NULL terminated array of parameter types for a function or
|
||||
method type (actually, parameter types are not currently stored for
|
||||
function types). This may be used to determine whether a method
|
||||
type is a stub method or not. The last argument points to a
|
||||
boolean which is set to true if the function takes a variable
|
||||
number of arguments. */
|
||||
|
||||
extern const debug_type *debug_get_parameter_types PARAMS ((PTR,
|
||||
debug_type,
|
||||
boolean *));
|
||||
|
||||
/* Get the target type of a pointer or reference or const or volatile
|
||||
type. */
|
||||
|
||||
extern debug_type debug_get_target_type PARAMS ((PTR, debug_type));
|
||||
|
||||
/* Get the NULL terminated array of fields for a struct, union, or
|
||||
class. */
|
||||
|
||||
extern const debug_field *debug_get_fields PARAMS ((PTR, debug_type));
|
||||
|
||||
/* Get the type of a field. */
|
||||
|
||||
extern debug_type debug_get_field_type PARAMS ((PTR, debug_field));
|
||||
|
||||
/* Get the name of a field. */
|
||||
|
||||
extern const char *debug_get_field_name PARAMS ((PTR, debug_field));
|
||||
|
||||
/* Get the bit position of a field within the containing structure.
|
||||
If the field is a static member, this will return (bfd_vma) -1. */
|
||||
|
||||
extern bfd_vma debug_get_field_bitpos PARAMS ((PTR, debug_field));
|
||||
|
||||
/* Get the bit size of a field. If the field is a static member, this
|
||||
will return (bfd_vma) -1. */
|
||||
|
||||
extern bfd_vma debug_get_field_bitsize PARAMS ((PTR, debug_field));
|
||||
|
||||
/* Get the visibility of a field. */
|
||||
|
||||
extern enum debug_visibility debug_get_field_visibility
|
||||
PARAMS ((PTR, debug_field));
|
||||
|
||||
/* Get the physical name of a field, if it is a static member. If the
|
||||
field is not a static member, this will return NULL. */
|
||||
|
||||
extern const char *debug_get_field_physname PARAMS ((PTR, debug_field));
|
||||
|
||||
/* Write out the recorded debugging information. This takes a set of
|
||||
function pointers which are called to do the actual writing. The
|
||||
first PTR is the debugging handle. The second PTR is a handle
|
||||
which is passed to the functions. */
|
||||
|
||||
extern boolean debug_write PARAMS ((PTR, const struct debug_write_fns *, PTR));
|
||||
|
||||
#endif /* DEBUG_H */
|
||||
@@ -1,93 +0,0 @@
|
||||
%{/* deflex.l - Lexer for .def files */
|
||||
|
||||
/* Copyright (C) 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
/* Contributed by Steve Chamberlain
|
||||
sac@cygnus.com
|
||||
|
||||
*/
|
||||
#define DONTDECLARE_MALLOC
|
||||
#include "libiberty.h"
|
||||
#include "defparse.h"
|
||||
#include "dlltool.h"
|
||||
|
||||
int linenumber;
|
||||
|
||||
%}
|
||||
%%
|
||||
"NAME" { return NAME;}
|
||||
"LIBRARY" { return LIBRARY;}
|
||||
"DESCRIPTION" { return DESCRIPTION;}
|
||||
"STACKSIZE" { return STACKSIZE;}
|
||||
"HEAPSIZE" { return HEAPSIZE;}
|
||||
"CODE" { return CODE;}
|
||||
"DATA" { return DATA;}
|
||||
"SECTIONS" { return SECTIONS;}
|
||||
"EXPORTS" { return EXPORTS;}
|
||||
"IMPORTS" { return IMPORTS;}
|
||||
"VERSION" { return VERSIONK;}
|
||||
"BASE" { return BASE;}
|
||||
"CONSTANT" { return CONSTANT; }
|
||||
"NONAME" { return NONAME; }
|
||||
"READ" { return READ;}
|
||||
"WRITE" { return WRITE;}
|
||||
"EXECUTE" { return EXECUTE;}
|
||||
"SHARED" { return SHARED;}
|
||||
"NONSHARED" { return NONSHARED;}
|
||||
"SINGLE" { return SINGLE;}
|
||||
"MULTIPLE" { return MULTIPLE;}
|
||||
"INITINSTANCE" { return INITINSTANCE;}
|
||||
"INITGLOBAL" { return INITGLOBAL;}
|
||||
"TERMINSTANCE" { return TERMINSTANCE;}
|
||||
"TERMGLOBAL" { return TERMGLOBAL;}
|
||||
|
||||
[0-9][x0-9A-Fa-f]* { yylval.number = strtol (yytext,0,0);
|
||||
return NUMBER; }
|
||||
|
||||
[A-Za-z$:\-\_?][A-Za-z0-9/$:\-\_@?]* {
|
||||
yylval.id = xstrdup (yytext);
|
||||
return ID;
|
||||
}
|
||||
|
||||
"\""[^\"]*"\"" {
|
||||
yylval.id = xstrdup (yytext+1);
|
||||
yylval.id[yyleng-2] = 0;
|
||||
return ID;
|
||||
}
|
||||
|
||||
"\'"[^\']*"\'" {
|
||||
yylval.id = xstrdup (yytext+1);
|
||||
yylval.id[yyleng-2] = 0;
|
||||
return ID;
|
||||
}
|
||||
"*".* { }
|
||||
";".* { }
|
||||
" " { }
|
||||
"\t" { }
|
||||
"\n" { linenumber ++ ;}
|
||||
"=" { return '=';}
|
||||
"." { return '.';}
|
||||
"@" { return '@';}
|
||||
"," { return ',';}
|
||||
%%
|
||||
#ifndef yywrap
|
||||
/* Needed for lex, though not flex. */
|
||||
int yywrap() { return 1; }
|
||||
#endif
|
||||
@@ -1,169 +0,0 @@
|
||||
%{ /* defparse.y - parser for .def files */
|
||||
|
||||
/* Copyright (C) 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "bucomm.h"
|
||||
#include "dlltool.h"
|
||||
%}
|
||||
|
||||
%union {
|
||||
char *id;
|
||||
int number;
|
||||
};
|
||||
|
||||
%token NAME, LIBRARY, DESCRIPTION, STACKSIZE, HEAPSIZE, CODE, DATA
|
||||
%token SECTIONS, EXPORTS, IMPORTS, VERSIONK, BASE, CONSTANT
|
||||
%token READ WRITE EXECUTE SHARED NONSHARED NONAME
|
||||
%token SINGLE MULTIPLE INITINSTANCE INITGLOBAL TERMINSTANCE TERMGLOBAL
|
||||
%token <id> ID
|
||||
%token <number> NUMBER
|
||||
%type <number> opt_base opt_ordinal opt_NONAME opt_CONSTANT opt_DATA
|
||||
%type <number> attr attr_list opt_number
|
||||
%type <id> opt_name opt_equal_name
|
||||
|
||||
%%
|
||||
|
||||
start: start command
|
||||
| command
|
||||
;
|
||||
|
||||
command:
|
||||
NAME opt_name opt_base { def_name ($2, $3); }
|
||||
| LIBRARY opt_name opt_base option_list { def_library ($2, $3); }
|
||||
| EXPORTS explist
|
||||
| DESCRIPTION ID { def_description ($2);}
|
||||
| STACKSIZE NUMBER opt_number { def_stacksize ($2, $3);}
|
||||
| HEAPSIZE NUMBER opt_number { def_heapsize ($2, $3);}
|
||||
| CODE attr_list { def_code ($2);}
|
||||
| DATA attr_list { def_data ($2);}
|
||||
| SECTIONS seclist
|
||||
| IMPORTS implist
|
||||
| VERSIONK NUMBER { def_version ($2,0);}
|
||||
| VERSIONK NUMBER '.' NUMBER { def_version ($2,$4);}
|
||||
;
|
||||
|
||||
|
||||
explist:
|
||||
/* EMPTY */
|
||||
| explist expline
|
||||
;
|
||||
|
||||
expline:
|
||||
ID opt_equal_name opt_ordinal opt_NONAME opt_CONSTANT opt_DATA
|
||||
{ def_exports ($1, $2, $3, $4, $5, $6);}
|
||||
;
|
||||
implist:
|
||||
implist impline
|
||||
| impline
|
||||
;
|
||||
|
||||
impline:
|
||||
ID '=' ID '.' ID '.' ID { def_import ($1,$3,$5,$7, 0); }
|
||||
| ID '=' ID '.' ID '.' NUMBER { def_import ($1,$3,$5, 0,$7); }
|
||||
| ID '=' ID '.' ID { def_import ($1,$3, 0,$5, 0); }
|
||||
| ID '=' ID '.' NUMBER { def_import ($1,$3, 0, 0,$5); }
|
||||
| ID '.' ID '.' ID { def_import ( 0,$1,$3,$5, 0); }
|
||||
| ID '.' ID '.' NUMBER { def_import ( 0,$1,$3, 0,$5); }
|
||||
| ID '.' ID { def_import ( 0,$1, 0,$3, 0); }
|
||||
| ID '.' NUMBER { def_import ( 0,$1, 0, 0,$3); }
|
||||
;
|
||||
|
||||
seclist:
|
||||
seclist secline
|
||||
| secline
|
||||
;
|
||||
|
||||
secline:
|
||||
ID attr_list { def_section ($1,$2);}
|
||||
;
|
||||
|
||||
attr_list:
|
||||
attr_list opt_comma attr
|
||||
| attr
|
||||
;
|
||||
|
||||
opt_comma:
|
||||
','
|
||||
|
|
||||
;
|
||||
opt_number: ',' NUMBER { $$=$2;}
|
||||
| { $$=-1;}
|
||||
;
|
||||
|
||||
attr:
|
||||
READ { $$ = 1; }
|
||||
| WRITE { $$ = 2; }
|
||||
| EXECUTE { $$ = 4; }
|
||||
| SHARED { $$ = 8; }
|
||||
| NONSHARED { $$ = 0; }
|
||||
| SINGLE { $$ = 0; }
|
||||
| MULTIPLE { $$ = 0; }
|
||||
;
|
||||
|
||||
opt_CONSTANT:
|
||||
CONSTANT {$$=1;}
|
||||
| {$$=0;}
|
||||
;
|
||||
|
||||
opt_NONAME:
|
||||
NONAME {$$=1;}
|
||||
| {$$=0;}
|
||||
;
|
||||
|
||||
opt_DATA:
|
||||
DATA { $$ = 1; }
|
||||
| { $$ = 0; }
|
||||
;
|
||||
|
||||
opt_name: ID { $$ =$1; }
|
||||
| ID '.' ID
|
||||
{
|
||||
char *name = xmalloc (strlen ($1) + 1 + strlen ($3) + 1);
|
||||
sprintf (name, "%s.%s", $1, $3);
|
||||
$$ = name;
|
||||
}
|
||||
| { $$=""; }
|
||||
;
|
||||
|
||||
opt_ordinal:
|
||||
'@' NUMBER { $$=$2;}
|
||||
| { $$=-1;}
|
||||
;
|
||||
|
||||
opt_equal_name:
|
||||
'=' ID { $$ = $2; }
|
||||
| { $$ = 0; }
|
||||
;
|
||||
|
||||
opt_base: BASE '=' NUMBER { $$= $3;}
|
||||
| { $$=-1;}
|
||||
;
|
||||
|
||||
option_list:
|
||||
/* empty */
|
||||
| option_list opt_comma option
|
||||
;
|
||||
|
||||
option:
|
||||
INITINSTANCE
|
||||
| INITGLOBAL
|
||||
| TERMINSTANCE
|
||||
| TERMGLOBAL
|
||||
;
|
||||
@@ -1,17 +0,0 @@
|
||||
:loop
|
||||
/\\$/N
|
||||
/\\$/b loop
|
||||
|
||||
s!@INCDIR@!$(INCDIR)!g
|
||||
s!@BFDDIR@!$(BFDDIR)!g
|
||||
s!@SRCDIR@/!!g
|
||||
s!@OBJDIR@/!!g
|
||||
|
||||
s/\\\n */ /g
|
||||
|
||||
s/ *$//
|
||||
s/ */ /g
|
||||
/:$/d
|
||||
|
||||
s/\(.\{50\}[^ ]*\) /\1 \\\
|
||||
/g
|
||||
3611
binutils/dlltool.c
3611
binutils/dlltool.c
File diff suppressed because it is too large
Load Diff
@@ -1,42 +0,0 @@
|
||||
/* dlltool.h -- header file for dlltool
|
||||
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of 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 2 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#include "ansidecl.h"
|
||||
#include <stdio.h>
|
||||
|
||||
extern void def_code PARAMS ((int));
|
||||
extern void def_data PARAMS ((int));
|
||||
extern void def_description PARAMS ((const char *));
|
||||
extern void def_exports
|
||||
PARAMS ((const char *, const char *, int, int, int, int));
|
||||
extern void def_heapsize PARAMS ((int, int));
|
||||
extern void def_import
|
||||
PARAMS ((const char *, const char *, const char *, const char *, int));
|
||||
extern void def_library PARAMS ((const char *, int));
|
||||
extern void def_name PARAMS ((const char *, int));
|
||||
extern void def_section PARAMS ((const char *, int));
|
||||
extern void def_stacksize PARAMS ((int, int));
|
||||
extern void def_version PARAMS ((int, int));
|
||||
extern int yyparse PARAMS ((void));
|
||||
extern int yyerror PARAMS ((const char *));
|
||||
extern int yydebug;
|
||||
extern int yylex PARAMS ((void));
|
||||
extern FILE *yyin;
|
||||
extern int linenumber;
|
||||
1249
binutils/dllwrap.c
1249
binutils/dllwrap.c
File diff suppressed because it is too large
Load Diff
@@ -1,107 +0,0 @@
|
||||
/* An abstract string datatype.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Contributed by Mark Mitchell (mark@markmitchell.com).
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU CC 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* This file lives in at least two places: binutils and gcc.
|
||||
Don't change one without the other. */
|
||||
|
||||
#include "config.h"
|
||||
#ifdef IN_GCC
|
||||
#include "system.h"
|
||||
#include "gansidecl.h"
|
||||
#else
|
||||
#include "ansidecl.h"
|
||||
#endif
|
||||
#include "dyn-string.h"
|
||||
|
||||
extern char *xmalloc ();
|
||||
extern char *xrealloc ();
|
||||
|
||||
/* Create a new dynamic string capable of holding at least SPACE
|
||||
characters, including the terminating NUL. If SPACE is 0, it
|
||||
will be silently increased to 1. */
|
||||
|
||||
dyn_string_t
|
||||
dyn_string_new (space)
|
||||
int space;
|
||||
{
|
||||
dyn_string_t result = (dyn_string_t) xmalloc (sizeof (struct dyn_string));
|
||||
|
||||
if (space == 0)
|
||||
/* We need at least one byte in which to store the terminating
|
||||
NUL. */
|
||||
space = 1;
|
||||
|
||||
result->allocated = space;
|
||||
result->s = (char*) xmalloc (space);
|
||||
result->length = 0;
|
||||
result->s[0] = '\0';
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Free the memory used by DS. */
|
||||
|
||||
void
|
||||
dyn_string_delete (ds)
|
||||
dyn_string_t ds;
|
||||
{
|
||||
free (ds->s);
|
||||
free (ds);
|
||||
}
|
||||
|
||||
/* Append the NUL-terminated string S to DS, resizing DS if
|
||||
necessary. */
|
||||
|
||||
dyn_string_t
|
||||
dyn_string_append (ds, s)
|
||||
dyn_string_t ds;
|
||||
char *s;
|
||||
{
|
||||
int len = strlen (s);
|
||||
dyn_string_resize (ds, ds->length + len + 1 /* '\0' */);
|
||||
strcpy (ds->s + ds->length, s);
|
||||
ds->length += len;
|
||||
|
||||
return ds;
|
||||
}
|
||||
|
||||
/* Increase the capacity of DS so that it can hold at least SPACE
|
||||
characters, including the terminating NUL. This function will not
|
||||
(at present) reduce the capacity of DS. */
|
||||
|
||||
dyn_string_t
|
||||
dyn_string_resize (ds, space)
|
||||
dyn_string_t ds;
|
||||
int space;
|
||||
{
|
||||
int new_allocated = ds->allocated;
|
||||
|
||||
while (space > new_allocated)
|
||||
new_allocated *= 2;
|
||||
|
||||
if (new_allocated != ds->allocated)
|
||||
{
|
||||
/* We actually need more space. */
|
||||
ds->allocated = new_allocated;
|
||||
ds->s = (char*) xrealloc (ds->s, ds->allocated);
|
||||
}
|
||||
|
||||
return ds;
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/* An abstract string datatype.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Contributed by Mark Mitchell (mark@markmitchell.com).
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU CC 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* This file lives in at least two places: binutils and gcc.
|
||||
Don't change one without the other. */
|
||||
|
||||
typedef struct dyn_string
|
||||
{
|
||||
int allocated; /* The amount of space allocated for the string. */
|
||||
int length; /* The actual length of the string. */
|
||||
char *s; /* The string itself, NUL-terminated. */
|
||||
}* dyn_string_t;
|
||||
|
||||
extern dyn_string_t dyn_string_new PARAMS((int));
|
||||
extern void dyn_string_delete PARAMS((dyn_string_t));
|
||||
extern dyn_string_t dyn_string_append PARAMS((dyn_string_t, char*));
|
||||
extern dyn_string_t dyn_string_resize PARAMS((dyn_string_t, int));
|
||||
@@ -1,266 +0,0 @@
|
||||
/* filemode.c -- make a string describing file modes
|
||||
Copyright (C) 1985, 90, 91, 94, 95, 97, 1999 Free Software Foundation, Inc.
|
||||
|
||||
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 2, 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "bucomm.h"
|
||||
|
||||
static char ftypelet PARAMS ((unsigned long));
|
||||
static void setst PARAMS ((unsigned long, char *));
|
||||
|
||||
/* filemodestring - fill in string STR with an ls-style ASCII
|
||||
representation of the st_mode field of file stats block STATP.
|
||||
10 characters are stored in STR; no terminating null is added.
|
||||
The characters stored in STR are:
|
||||
|
||||
0 File type. 'd' for directory, 'c' for character
|
||||
special, 'b' for block special, 'm' for multiplex,
|
||||
'l' for symbolic link, 's' for socket, 'p' for fifo,
|
||||
'-' for any other file type
|
||||
|
||||
1 'r' if the owner may read, '-' otherwise.
|
||||
|
||||
2 'w' if the owner may write, '-' otherwise.
|
||||
|
||||
3 'x' if the owner may execute, 's' if the file is
|
||||
set-user-id, '-' otherwise.
|
||||
'S' if the file is set-user-id, but the execute
|
||||
bit isn't set.
|
||||
|
||||
4 'r' if group members may read, '-' otherwise.
|
||||
|
||||
5 'w' if group members may write, '-' otherwise.
|
||||
|
||||
6 'x' if group members may execute, 's' if the file is
|
||||
set-group-id, '-' otherwise.
|
||||
'S' if it is set-group-id but not executable.
|
||||
|
||||
7 'r' if any user may read, '-' otherwise.
|
||||
|
||||
8 'w' if any user may write, '-' otherwise.
|
||||
|
||||
9 'x' if any user may execute, 't' if the file is "sticky"
|
||||
(will be retained in swap space after execution), '-'
|
||||
otherwise.
|
||||
'T' if the file is sticky but not executable. */
|
||||
|
||||
#if 0
|
||||
|
||||
/* This is not used; only mode_string is used. */
|
||||
|
||||
void
|
||||
filemodestring (statp, str)
|
||||
struct stat *statp;
|
||||
char *str;
|
||||
{
|
||||
mode_string ((unsigned long) statp->st_mode, str);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Get definitions for the file permission bits. */
|
||||
|
||||
#ifndef S_IRWXU
|
||||
#define S_IRWXU 0700
|
||||
#endif
|
||||
#ifndef S_IRUSR
|
||||
#define S_IRUSR 0400
|
||||
#endif
|
||||
#ifndef S_IWUSR
|
||||
#define S_IWUSR 0200
|
||||
#endif
|
||||
#ifndef S_IXUSR
|
||||
#define S_IXUSR 0100
|
||||
#endif
|
||||
|
||||
#ifndef S_IRWXG
|
||||
#define S_IRWXG 0070
|
||||
#endif
|
||||
#ifndef S_IRGRP
|
||||
#define S_IRGRP 0040
|
||||
#endif
|
||||
#ifndef S_IWGRP
|
||||
#define S_IWGRP 0020
|
||||
#endif
|
||||
#ifndef S_IXGRP
|
||||
#define S_IXGRP 0010
|
||||
#endif
|
||||
|
||||
#ifndef S_IRWXO
|
||||
#define S_IRWXO 0007
|
||||
#endif
|
||||
#ifndef S_IROTH
|
||||
#define S_IROTH 0004
|
||||
#endif
|
||||
#ifndef S_IWOTH
|
||||
#define S_IWOTH 0002
|
||||
#endif
|
||||
#ifndef S_IXOTH
|
||||
#define S_IXOTH 0001
|
||||
#endif
|
||||
|
||||
/* Like filemodestring, but only the relevant part of the `struct stat'
|
||||
is given as an argument. */
|
||||
|
||||
void
|
||||
mode_string (mode, str)
|
||||
unsigned long mode;
|
||||
char *str;
|
||||
{
|
||||
str[0] = ftypelet ((unsigned long) mode);
|
||||
str[1] = (mode & S_IRUSR) != 0 ? 'r' : '-';
|
||||
str[2] = (mode & S_IWUSR) != 0 ? 'w' : '-';
|
||||
str[3] = (mode & S_IXUSR) != 0 ? 'x' : '-';
|
||||
str[4] = (mode & S_IRGRP) != 0 ? 'r' : '-';
|
||||
str[5] = (mode & S_IWGRP) != 0 ? 'w' : '-';
|
||||
str[6] = (mode & S_IXGRP) != 0 ? 'x' : '-';
|
||||
str[7] = (mode & S_IROTH) != 0 ? 'r' : '-';
|
||||
str[8] = (mode & S_IWOTH) != 0 ? 'w' : '-';
|
||||
str[9] = (mode & S_IXOTH) != 0 ? 'x' : '-';
|
||||
setst ((unsigned long) mode, str);
|
||||
}
|
||||
|
||||
/* Return a character indicating the type of file described by
|
||||
file mode BITS:
|
||||
'd' for directories
|
||||
'b' for block special files
|
||||
'c' for character special files
|
||||
'm' for multiplexor files
|
||||
'l' for symbolic links
|
||||
's' for sockets
|
||||
'p' for fifos
|
||||
'-' for any other file type. */
|
||||
|
||||
#ifndef S_ISDIR
|
||||
#ifdef S_IFDIR
|
||||
#define S_ISDIR(i) (((i) & S_IFMT) == S_IFDIR)
|
||||
#else /* ! defined (S_IFDIR) */
|
||||
#define S_ISDIR(i) (((i) & 0170000) == 040000)
|
||||
#endif /* ! defined (S_IFDIR) */
|
||||
#endif /* ! defined (S_ISDIR) */
|
||||
|
||||
#ifndef S_ISBLK
|
||||
#ifdef S_IFBLK
|
||||
#define S_ISBLK(i) (((i) & S_IFMT) == S_IFBLK)
|
||||
#else /* ! defined (S_IFBLK) */
|
||||
#define S_ISBLK(i) 0
|
||||
#endif /* ! defined (S_IFBLK) */
|
||||
#endif /* ! defined (S_ISBLK) */
|
||||
|
||||
#ifndef S_ISCHR
|
||||
#ifdef S_IFCHR
|
||||
#define S_ISCHR(i) (((i) & S_IFMT) == S_IFCHR)
|
||||
#else /* ! defined (S_IFCHR) */
|
||||
#define S_ISCHR(i) 0
|
||||
#endif /* ! defined (S_IFCHR) */
|
||||
#endif /* ! defined (S_ISCHR) */
|
||||
|
||||
#ifndef S_ISFIFO
|
||||
#ifdef S_IFIFO
|
||||
#define S_ISFIFO(i) (((i) & S_IFMT) == S_IFIFO)
|
||||
#else /* ! defined (S_IFIFO) */
|
||||
#define S_ISFIFO(i) 0
|
||||
#endif /* ! defined (S_IFIFO) */
|
||||
#endif /* ! defined (S_ISFIFO) */
|
||||
|
||||
#ifndef S_ISSOCK
|
||||
#ifdef S_IFSOCK
|
||||
#define S_ISSOCK(i) (((i) & S_IFMT) == S_IFSOCK)
|
||||
#else /* ! defined (S_IFSOCK) */
|
||||
#define S_ISSOCK(i) 0
|
||||
#endif /* ! defined (S_IFSOCK) */
|
||||
#endif /* ! defined (S_ISSOCK) */
|
||||
|
||||
#ifndef S_ISLNK
|
||||
#ifdef S_IFLNK
|
||||
#define S_ISLNK(i) (((i) & S_IFMT) == S_IFLNK)
|
||||
#else /* ! defined (S_IFLNK) */
|
||||
#define S_ISLNK(i) 0
|
||||
#endif /* ! defined (S_IFLNK) */
|
||||
#endif /* ! defined (S_ISLNK) */
|
||||
|
||||
static char
|
||||
ftypelet (bits)
|
||||
unsigned long bits;
|
||||
{
|
||||
if (S_ISDIR (bits))
|
||||
return 'd';
|
||||
if (S_ISLNK (bits))
|
||||
return 'l';
|
||||
if (S_ISBLK (bits))
|
||||
return 'b';
|
||||
if (S_ISCHR (bits))
|
||||
return 'c';
|
||||
if (S_ISSOCK (bits))
|
||||
return 's';
|
||||
if (S_ISFIFO (bits))
|
||||
return 'p';
|
||||
|
||||
#ifdef S_IFMT
|
||||
#ifdef S_IFMPC
|
||||
if ((bits & S_IFMT) == S_IFMPC
|
||||
|| (bits & S_IFMT) == S_IFMPB)
|
||||
return 'm';
|
||||
#endif
|
||||
#ifdef S_IFNWK
|
||||
if ((bits & S_IFMT) == S_IFNWK)
|
||||
return 'n';
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return '-';
|
||||
}
|
||||
|
||||
/* Set the 's' and 't' flags in file attributes string CHARS,
|
||||
according to the file mode BITS. */
|
||||
|
||||
static void
|
||||
setst (bits, chars)
|
||||
unsigned long bits ATTRIBUTE_UNUSED;
|
||||
char *chars ATTRIBUTE_UNUSED;
|
||||
{
|
||||
#ifdef S_ISUID
|
||||
if (bits & S_ISUID)
|
||||
{
|
||||
if (chars[3] != 'x')
|
||||
/* Set-uid, but not executable by owner. */
|
||||
chars[3] = 'S';
|
||||
else
|
||||
chars[3] = 's';
|
||||
}
|
||||
#endif
|
||||
#ifdef S_ISGID
|
||||
if (bits & S_ISGID)
|
||||
{
|
||||
if (chars[6] != 'x')
|
||||
/* Set-gid, but not executable by group. */
|
||||
chars[6] = 'S';
|
||||
else
|
||||
chars[6] = 's';
|
||||
}
|
||||
#endif
|
||||
#ifdef S_ISVTX
|
||||
if (bits & S_ISVTX)
|
||||
{
|
||||
if (chars[9] != 'x')
|
||||
/* Sticky, but not executable by others. */
|
||||
chars[9] = 'T';
|
||||
else
|
||||
chars[9] = 't';
|
||||
}
|
||||
#endif
|
||||
}
|
||||
7609
binutils/ieee.c
7609
binutils/ieee.c
File diff suppressed because it is too large
Load Diff
@@ -1,3 +0,0 @@
|
||||
/* Linked with ar.o to flag that this program is 'ranlib' (not 'ar'). */
|
||||
|
||||
int is_ranlib = 1;
|
||||
@@ -1,4 +0,0 @@
|
||||
/* Linked with objcopy.o to flag that this program is 'strip' (not
|
||||
'objcopy'). */
|
||||
|
||||
int is_strip = 1;
|
||||
@@ -1,42 +0,0 @@
|
||||
/* Resources for GNU binutils. */
|
||||
|
||||
#include "SysTypes.r"
|
||||
|
||||
/* Version resources. */
|
||||
|
||||
resource 'vers' (1) {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
verUs,
|
||||
VERSION_STRING,
|
||||
VERSION_STRING " (C) 1986-95 FSF, Inc."
|
||||
};
|
||||
|
||||
resource 'vers' (2, purgeable) {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
verUs,
|
||||
VERSION_STRING,
|
||||
"binutils " VERSION_STRING " for MPW"
|
||||
};
|
||||
|
||||
#ifdef WANT_CFRG
|
||||
|
||||
#include "CodeFragmentTypes.r"
|
||||
|
||||
resource 'cfrg' (0) {
|
||||
{
|
||||
kPowerPC,
|
||||
kFullLib,
|
||||
kNoVersionNum, kNoVersionNum,
|
||||
0,0,
|
||||
kIsApp, kOnDiskFlat, kZeroOffset, kWholeFork,
|
||||
PROG_NAME
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* WANT_CFRG */
|
||||
@@ -1,98 +0,0 @@
|
||||
#
|
||||
# Makefile for binutils under openVMS (Alpha and Vax)
|
||||
#
|
||||
# For use with gnu-make for vms
|
||||
#
|
||||
# Created by Klaus K"ampf, kkaempf@rmi.de
|
||||
#
|
||||
#
|
||||
|
||||
# Distribution version, filled in by configure.com
|
||||
VERSION=@VERSION@
|
||||
|
||||
ifeq ($(ARCH),ALPHA)
|
||||
TARGET=""vms-alpha""
|
||||
else
|
||||
TARGET=""vms-vax""
|
||||
endif
|
||||
|
||||
ifeq ($(CC),gcc)
|
||||
CFLAGS=/include=([],[-.include],[-.bfd])$(DEFS)
|
||||
DEFS=/define=("TARGET=$(TARGET)")
|
||||
LIBS=,gnu_cc_library:libgcc/lib,sys$$library:vaxcrtl.olb/lib,gnu_cc_library:crt0.obj
|
||||
else
|
||||
CFLAGS=/noopt/debug/include=([],[-.include],[-.bfd])$(DEFS)\
|
||||
/warnings=disable=(missingreturn,implicitfunc,longextern)
|
||||
DEFS=/define=("TARGET=$(TARGET)","const=","unlink=remove")
|
||||
LIBS=,sys$$library:vaxcrtl.olb/lib
|
||||
endif
|
||||
|
||||
BFDLIB = [-.bfd]libbfd.olb/lib
|
||||
BFDLIB_DEP = [-.bfd]libbfd.olb
|
||||
LIBIBERTY_DEP = [-.libiberty]libiberty.olb
|
||||
LIBIBERTY = [-.libiberty]libiberty.olb/lib
|
||||
OPCODES_DEP = [-.opcodes]libopcodes.olb
|
||||
OPCODES = [-.opcodes]libopcodes.olb/lib
|
||||
|
||||
DEBUG_OBJS = rddbg.obj,debug.obj,stabs.obj,ieee.obj,rdcoff.obj
|
||||
|
||||
WRITE_DEBUG_OBJS = $(DEBUG_OBJS),wrstabs.obj
|
||||
|
||||
BULIBS = []bucomm.obj,version.obj,filemode.obj
|
||||
|
||||
ADDL_DEPS = $(BULIBS),$(BFDLIB_DEP),$(LIBIBERTY_DEP)
|
||||
ADDL_LIBS = $(BULIBS),$(BFDLIB),$(LIBIBERTY)
|
||||
|
||||
SIZEOBJS = $(ADDL_DEPS),size.obj
|
||||
|
||||
STRINGSOBJS = $(ADDL_DEPS),strings.obj
|
||||
|
||||
NMOBJS = $(ADDL_DEPS),nm.obj
|
||||
|
||||
OBJDUMPOBJS = $(ADDL_DEPS),objdump.obj,prdbg.obj,$(DEBUG_OBJS),$(OPCODES_DEP)
|
||||
|
||||
all: config.h size.exe strings.exe objdump.exe nm.exe
|
||||
|
||||
size.exe: $(SIZEOBJS)
|
||||
link/exe=$@ size.obj,$(ADDL_LIBS)$(LIBS)
|
||||
|
||||
strings.exe: $(STRINGSOBJS)
|
||||
link/exe=$@ strings.obj,$(ADDL_LIBS)$(LIBS)
|
||||
|
||||
nm.exe: $(NMOBJS)
|
||||
link/exe=$@ nm.obj,$(ADDL_LIBS)$(LIBS)
|
||||
|
||||
objdump.exe: $(OBJDUMPOBJS)
|
||||
link/exe=$@ objdump.obj,prdbg.obj,$(DEBUG_OBJS),$(BFDLIB),$(OPCODES),$(ADDL_LIBS)$(LIBS)
|
||||
|
||||
|
||||
version.obj: version.c
|
||||
$(CC) $(CFLAGS)/define=(VERSION="""$(VERSION)""") $<
|
||||
|
||||
config.h:
|
||||
$$ @configure
|
||||
$(MAKE) -f makefile.vms "CC=$(CC)"
|
||||
|
||||
[-.bfd]libbfd.olb:
|
||||
$(CD) [-.bfd]
|
||||
$(MAKE) -f makefile.vms "CC=$(CC)"
|
||||
$(CD) [-.binutils]
|
||||
|
||||
[-.libiberty]libiberty.olb:
|
||||
$(CD) [-.libiberty]
|
||||
$(MAKE) -f makefile.vms "CC=$(CC)"
|
||||
$(CD) [-.binutils]
|
||||
|
||||
[-.opcodes]libopcodes.olb:
|
||||
$(CD) [-.opcodes]
|
||||
$(MAKE) -f makefile.vms "CC=$(CC)"
|
||||
$(CD) [-.binutils]
|
||||
|
||||
clean:
|
||||
$$ purge
|
||||
$(RM) *.obj;
|
||||
$(RM) *.exe;
|
||||
|
||||
distclean: clean
|
||||
$(RM) config.h;
|
||||
$(RM) makefile.vms;
|
||||
@@ -1,4 +0,0 @@
|
||||
/* Linked with ar.o to flag that this program decides at runtime
|
||||
(using argv[0] if it is is 'ar' or 'ranlib'. */
|
||||
|
||||
int is_ranlib = -1;
|
||||
@@ -1,4 +0,0 @@
|
||||
/* Linked with objcopy.o to flag that this program decides at runtime
|
||||
(using argv[0] if it is is 'strip' or 'objcopy'. */
|
||||
|
||||
int is_strip = -1;
|
||||
@@ -1,27 +0,0 @@
|
||||
# Configuration fragment for binutils.
|
||||
|
||||
Set target_arch `echo {target_canonical} | sed -e 's/-.*-.*//'`
|
||||
|
||||
# (should canonicalize arch name) */
|
||||
|
||||
Set archname ARCH_{target_arch}
|
||||
|
||||
Set underscore 0
|
||||
|
||||
If "{target_canonical}" =~ /sh-hitachi-hms/
|
||||
Set underscore 1
|
||||
End If
|
||||
|
||||
Echo '# From mpw-config.in' > "{o}"mk.tmp
|
||||
Echo "ARCHDEFS = -d" {archname} >> "{o}"mk.tmp
|
||||
Echo "UNDERSCORE = " {underscore} >> "{o}"mk.tmp
|
||||
Echo "BUILD_NLMCONV = " >> "{o}"mk.tmp
|
||||
Echo "BUILD_SRCONV = " >> "{o}"mk.tmp
|
||||
Echo "SYSINFO_PROG = " >> "{o}"mk.tmp
|
||||
Echo "BUILD_DLLTOOL = " >> "{o}"mk.tmp
|
||||
Echo '# End from mpw-config.in' >> "{o}"mk.tmp
|
||||
|
||||
Echo '/* config.h. Generated by mpw-configure. */' > "{o}"config.new
|
||||
Echo '#include "mpw.h"' >> "{o}"config.new
|
||||
|
||||
MoveIfChange "{o}"config.new "{o}"config.h
|
||||
@@ -1,115 +0,0 @@
|
||||
# Sed commands to finish translating the binutils Unix makefile into MPW syntax.
|
||||
|
||||
# Add a rule.
|
||||
/^#### .*/a\
|
||||
\
|
||||
"{o}"underscore.c.o \\Option-f "{o}"underscore.c\
|
||||
|
||||
# Comment out any alias settings.
|
||||
/^host_alias =/s/^/#/
|
||||
/^target_alias =/s/^/#/
|
||||
|
||||
# Whack out unused host define bits.
|
||||
/HDEFINES/s/@HDEFINES@//
|
||||
|
||||
# Don't build specialized tools.
|
||||
/BUILD_NLMCONV/s/@BUILD_NLMCONV@//
|
||||
/BUILD_SRCONV/s/@BUILD_SRCONV@//
|
||||
/BUILD_DLLTOOL/s/@BUILD_DLLTOOL@//
|
||||
|
||||
/UNDERSCORE/s/@UNDERSCORE@/{UNDERSCORE}/
|
||||
|
||||
# Don't need this.
|
||||
/@HLDFLAGS@/s/@HLDFLAGS@//
|
||||
|
||||
# Point at the libraries directly.
|
||||
/@BFDLIB@/s/@BFDLIB@/::bfd:libbfd.o/
|
||||
/@OPCODES@/s/@OPCODES@/::opcodes:libopcodes.o/
|
||||
|
||||
# Whack out target makefile fragment.
|
||||
/target_makefile_fragment/s/target_makefile_fragment@//
|
||||
|
||||
# Fix and add to the include paths.
|
||||
/^INCLUDES = .*$/s/$/ -i "{INCDIR}":mpw: -i ::extra-include:/
|
||||
/BFDDIR/s/-i {BFDDIR} /-i "{BFDDIR}": /
|
||||
/INCDIR/s/-i {INCDIR} /-i "{INCDIR}": /
|
||||
|
||||
# Use byacc instead of bison (for now anyway).
|
||||
/BISON/s/^BISON =.*$/BISON = byacc/
|
||||
#/BISONFLAGS/s/^BISONFLAGS =.*$/BISONFLAGS = /
|
||||
|
||||
# Embed the version in symbolic doublequotes that will expand to
|
||||
# the right thing for each compiler.
|
||||
/VERSION/s/'"{VERSION}"'/{dq}{VERSION}{dq}/
|
||||
|
||||
# '+' is a special char to MPW, don't use it ever.
|
||||
/c++filt/s/c++filt/cplusfilt/
|
||||
|
||||
# All of the binutils use the same Rez file, change names to refer to it.
|
||||
/^{[A-Z]*_PROG}/s/$/ "{s}"mac-binutils.r/
|
||||
/{[A-Z]*_PROG}\.r/s/{[A-Z]*_PROG}\.r/mac-binutils.r/
|
||||
|
||||
# There are auto-generated references to BFD .h files that are not
|
||||
# in the objdir (like bfd.h) but are in the source dir.
|
||||
/::bfd:lib/s/::bfd:lib\([a-z]*\)\.h/{BFDDIR}:lib\1.h/g
|
||||
|
||||
# Fix the locations of generated files.
|
||||
/config/s/"{s}"config\.h/"{o}"config.h/g
|
||||
/config/s/^config\.h/"{o}"config\.h/
|
||||
/underscore/s/"{s}"underscore\.c/"{o}"underscore.c/g
|
||||
/underscore/s/^underscore\.c/"{o}"underscore\.c/
|
||||
|
||||
# Fix paths to generated source files.
|
||||
/lex.yy.c/s/"{s}"lex\.yy\.c/"{o}"lex.yy.c/g
|
||||
/lex.yy.c/s/^lex\.yy\.c/"{o}"lex.yy.c/
|
||||
/arlex.c/s/"{s}"arlex\.c/"{o}"arlex.c/g
|
||||
/arlex.c/s/^arlex\.c/"{o}"arlex.c/
|
||||
/y.tab.c/s/"{s}"y\.tab\.c/"{o}"y.tab.c/g
|
||||
/y.tab.c/s/^y\.tab\.c/"{o}"y.tab.c/
|
||||
/arparse.c/s/"{s}"arparse\.c/"{o}"arparse.c/g
|
||||
/arparse.c/s/^arparse\.c/"{o}"arparse.c/
|
||||
/y.tab.h/s/"{s}"y\.tab\.h/"{o}"y.tab.h/g
|
||||
/y.tab.h/s/^y\.tab\.h/"{o}"y.tab.h/
|
||||
/arparse.h/s/"{s}"arparse\.h/"{o}"arparse.h/g
|
||||
/arparse.h/s/^arparse\.h/"{o}"arparse.h/
|
||||
|
||||
/"{s}"{INCDIR}/s/"{s}"{INCDIR}/"{INCDIR}"/g
|
||||
|
||||
# The generated lexer may include an ifdef for older Mac compilers that
|
||||
# needs to work with newer compilers also.
|
||||
/lex.yy.c/s/Rename -y \([^ ]*\) \([^ ]*\)$/sed -e 's,ifdef macintosh,if defined(macintosh) || defined(__MWERKS__),' \1 > \2/
|
||||
|
||||
# Fix an over-eagerness.
|
||||
/echo.*WARNING.*This file/s/'.*'/' '/
|
||||
|
||||
# Add a "stamps" target.
|
||||
$a\
|
||||
stamps \\Option-f stamp-under\
|
||||
|
||||
/^install \\Option-f /,/^$/c\
|
||||
install \\Option-f all install-only\
|
||||
\
|
||||
install-only \\Option-f\
|
||||
NewFolderRecursive "{bindir}"\
|
||||
# Need to copy all the tools\
|
||||
For prog in {PROGS}\
|
||||
Set progname `echo {prog} | sed -e 's/.new//'`\
|
||||
Duplicate -y :{prog} "{bindir}"{progname}\
|
||||
End For\
|
||||
|
||||
|
||||
/true/s/ ; @true$//
|
||||
|
||||
# dot files are trouble, remove them and their actions.
|
||||
/^\.dep/,/^$/d
|
||||
|
||||
# Remove un-useful targets.
|
||||
/^Makefile \\Option-f/,/^$/d
|
||||
/^"{o}"config.h \\Option-f/,/^$/d
|
||||
/^config.status \\Option-f/,/^$/d
|
||||
|
||||
# Don't try to make the demangler's man page, it's useless.
|
||||
/^{DEMANGLER_PROG}\.1 \\Option-f/,/^$/d
|
||||
# Don't depend on it either.
|
||||
/{DEMANGLER_PROG}/s/ {DEMANGLER_PROG}\.1//
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
.\" Copyright (c) 1991, 1996 Free Software Foundation
|
||||
.\" See section COPYING for conditions for redistribution
|
||||
.TH nlmconv 1 "March 1996" "cygnus support" "GNU Development Tools"
|
||||
.de BP
|
||||
.sp
|
||||
.ti \-.2i
|
||||
\(**
|
||||
..
|
||||
|
||||
.SH NAME
|
||||
nlmconv \- converts object code into an NLM
|
||||
|
||||
.SH SYNOPSIS
|
||||
.hy 0
|
||||
.na
|
||||
.TP
|
||||
.B nlmconv
|
||||
.RB "[\|" \-I\ \fIbfdname\fB\ |\ \-\-input\-target=\fIbfdname\fR "\|]"
|
||||
.RB "[\|" \-O\ \fIbfdname\fB\ |\ \-\-output\-target=\fIbfdname\fR "\|]"
|
||||
.RB "[\|" \-T\ \fIheaderfile\fB\ |\ \-\-header\-file=\fIheaderfile\fR "\|]"
|
||||
.RB "[\|" \-V\ |\ \-\-version\fR "\|]"
|
||||
.RB "[\|" \-\-help\fR "\|]"
|
||||
.B infile
|
||||
.B outfile
|
||||
.SH DESCRIPTION
|
||||
.B nlmconv
|
||||
converts the relocatable object file
|
||||
.B infile
|
||||
into the NetWare Loadable Module
|
||||
.BR outfile ,
|
||||
optionally reading
|
||||
.I headerfile
|
||||
for NLM header information. For instructions on writing the NLM
|
||||
command file language used in header files, see
|
||||
.IR "The NetWare Tool Maker Specification Manual" ,
|
||||
available from Novell, Inc.
|
||||
.B nlmconv
|
||||
currently works with i386 object files in
|
||||
.BR COFF ,
|
||||
.BR ELF ,
|
||||
or
|
||||
.B a.out
|
||||
format, and with SPARC object files in
|
||||
.B ELF
|
||||
or
|
||||
.B a.out
|
||||
format.
|
||||
.br
|
||||
.B nlmconv
|
||||
uses the GNU Binary File Descriptor library to read
|
||||
.IR infile .
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-I \fIbfdname\fR, \fB\-\-input\-target=\fIbfdname
|
||||
Consider the source file's object format to be
|
||||
.IR bfdname ,
|
||||
rather than attempting to deduce it.
|
||||
.TP
|
||||
.B \-O \fIbfdname\fR, \fB\-\-output\-target=\fIbfdname
|
||||
Write the output file using the object format
|
||||
.IR bfdname .
|
||||
.B nlmconv
|
||||
infers the output format based on the input format, e.g. for an i386
|
||||
input file the output format is
|
||||
.IR nlm32\-i386 .
|
||||
.TP
|
||||
.B \-T \fIheaderfile\fR, \fB\-\-header\-file=\fIheaderfile
|
||||
Reads
|
||||
.I headerfile
|
||||
for NLM header information. For instructions on writing the NLM
|
||||
command file language used in header files, see
|
||||
.IR "The NetWare Tool Maker Specification Manual" ,
|
||||
available from Novell, Inc.
|
||||
.TP
|
||||
.B \-V\fR, \fB\-\-version
|
||||
Show the version number of
|
||||
.B nlmconv
|
||||
and exit.
|
||||
.TP
|
||||
.B \-h\fR, \fB\-\-help
|
||||
Show a summary of the options to
|
||||
.B nlmconv
|
||||
and exit.
|
||||
.SH "SEE ALSO"
|
||||
.RB "`\|" binutils "\|'"
|
||||
entry in
|
||||
.B
|
||||
info\c
|
||||
\&;
|
||||
.I
|
||||
The GNU Binary Utilities\c
|
||||
\&, Roland H. Pesch (June 1993).
|
||||
|
||||
.SH COPYING
|
||||
Copyright (c) 1993 Free Software Foundation, Inc.
|
||||
.PP
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
.PP
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the
|
||||
entire resulting derived work is distributed under the terms of a
|
||||
permission notice identical to this one.
|
||||
.PP
|
||||
Permission is granted to copy and distribute translations of this
|
||||
manual into another language, under the above conditions for modified
|
||||
versions, except that this permission notice may be included in
|
||||
translations approved by the Free Software Foundation instead of in
|
||||
the original English.
|
||||
2186
binutils/nlmconv.c
2186
binutils/nlmconv.c
File diff suppressed because it is too large
Load Diff
@@ -1,84 +0,0 @@
|
||||
/* nlmconv.h -- header file for NLM conversion program
|
||||
Copyright (C) 1993 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by Ian Lance Taylor <ian@cygnus.com>.
|
||||
|
||||
bfd.h, nlm/common.h and nlm/internal.h must be included before this
|
||||
file. */
|
||||
|
||||
/* A linked list of strings. */
|
||||
|
||||
struct string_list
|
||||
{
|
||||
struct string_list *next;
|
||||
char *string;
|
||||
};
|
||||
|
||||
/* The NLM header parser in nlmheader.y stores information in the
|
||||
following variables. */
|
||||
|
||||
extern Nlm_Internal_Fixed_Header *fixed_hdr;
|
||||
extern Nlm_Internal_Variable_Header *var_hdr;
|
||||
extern Nlm_Internal_Version_Header *version_hdr;
|
||||
extern Nlm_Internal_Copyright_Header *copyright_hdr;
|
||||
extern Nlm_Internal_Extended_Header *extended_hdr;
|
||||
|
||||
/* Procedure named by CHECK. */
|
||||
extern char *check_procedure;
|
||||
/* File named by CUSTOM. */
|
||||
extern char *custom_file;
|
||||
/* Whether to generate debugging information (DEBUG). */
|
||||
extern boolean debug_info;
|
||||
/* Procedure named by EXIT. */
|
||||
extern char *exit_procedure;
|
||||
/* Exported symbols (EXPORT). */
|
||||
extern struct string_list *export_symbols;
|
||||
/* List of files from INPUT. */
|
||||
extern struct string_list *input_files;
|
||||
/* Map file name (MAP, FULLMAP). */
|
||||
extern char *map_file;
|
||||
/* Whether a full map has been requested (FULLMAP). */
|
||||
extern boolean full_map;
|
||||
/* File named by HELP. */
|
||||
extern char *help_file;
|
||||
/* Imported symbols (IMPORT). */
|
||||
extern struct string_list *import_symbols;
|
||||
/* File named by MESSAGES. */
|
||||
extern char *message_file;
|
||||
/* Autoload module list (MODULE). */
|
||||
extern struct string_list *modules;
|
||||
/* File named by OUTPUT. */
|
||||
extern char *output_file;
|
||||
/* File named by SHARELIB. */
|
||||
extern char *sharelib_file;
|
||||
/* Start procedure name (START). */
|
||||
extern char *start_procedure;
|
||||
/* VERBOSE. */
|
||||
extern boolean verbose;
|
||||
/* RPC description file (XDCDATA). */
|
||||
extern char *rpc_file;
|
||||
|
||||
/* The number of serious parse errors. */
|
||||
extern int parse_errors;
|
||||
|
||||
/* The parser. */
|
||||
extern int yyparse PARAMS ((void));
|
||||
|
||||
/* Tell the lexer what file to read. */
|
||||
extern boolean nlmlex_file PARAMS ((const char *));
|
||||
@@ -1,978 +0,0 @@
|
||||
%{/* nlmheader.y - parse NLM header specification keywords.
|
||||
Copyright (C) 1993, 94, 95, 97, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by Ian Lance Taylor <ian@cygnus.com>.
|
||||
|
||||
This bison file parses the commands recognized by the NetWare NLM
|
||||
linker, except for lists of object files. It stores the
|
||||
information in global variables.
|
||||
|
||||
This implementation is based on the description in the NetWare Tool
|
||||
Maker Specification manual, edition 1.0. */
|
||||
|
||||
#include <ansidecl.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include "bfd.h"
|
||||
#include "bucomm.h"
|
||||
#include "nlm/common.h"
|
||||
#include "nlm/internal.h"
|
||||
#include "nlmconv.h"
|
||||
|
||||
/* Information is stored in the structures pointed to by these
|
||||
variables. */
|
||||
|
||||
Nlm_Internal_Fixed_Header *fixed_hdr;
|
||||
Nlm_Internal_Variable_Header *var_hdr;
|
||||
Nlm_Internal_Version_Header *version_hdr;
|
||||
Nlm_Internal_Copyright_Header *copyright_hdr;
|
||||
Nlm_Internal_Extended_Header *extended_hdr;
|
||||
|
||||
/* Procedure named by CHECK. */
|
||||
char *check_procedure;
|
||||
/* File named by CUSTOM. */
|
||||
char *custom_file;
|
||||
/* Whether to generate debugging information (DEBUG). */
|
||||
boolean debug_info;
|
||||
/* Procedure named by EXIT. */
|
||||
char *exit_procedure;
|
||||
/* Exported symbols (EXPORT). */
|
||||
struct string_list *export_symbols;
|
||||
/* List of files from INPUT. */
|
||||
struct string_list *input_files;
|
||||
/* Map file name (MAP, FULLMAP). */
|
||||
char *map_file;
|
||||
/* Whether a full map has been requested (FULLMAP). */
|
||||
boolean full_map;
|
||||
/* File named by HELP. */
|
||||
char *help_file;
|
||||
/* Imported symbols (IMPORT). */
|
||||
struct string_list *import_symbols;
|
||||
/* File named by MESSAGES. */
|
||||
char *message_file;
|
||||
/* Autoload module list (MODULE). */
|
||||
struct string_list *modules;
|
||||
/* File named by OUTPUT. */
|
||||
char *output_file;
|
||||
/* File named by SHARELIB. */
|
||||
char *sharelib_file;
|
||||
/* Start procedure name (START). */
|
||||
char *start_procedure;
|
||||
/* VERBOSE. */
|
||||
boolean verbose;
|
||||
/* RPC description file (XDCDATA). */
|
||||
char *rpc_file;
|
||||
|
||||
/* The number of serious errors that have occurred. */
|
||||
int parse_errors;
|
||||
|
||||
/* The current symbol prefix when reading a list of import or export
|
||||
symbols. */
|
||||
static char *symbol_prefix;
|
||||
|
||||
/* Parser error message handler. */
|
||||
#define yyerror(msg) nlmheader_error (msg);
|
||||
|
||||
/* Local functions. */
|
||||
static int yylex PARAMS ((void));
|
||||
static void nlmlex_file_push PARAMS ((const char *));
|
||||
static boolean nlmlex_file_open PARAMS ((const char *));
|
||||
static int nlmlex_buf_init PARAMS ((void));
|
||||
static char nlmlex_buf_add PARAMS ((int));
|
||||
static long nlmlex_get_number PARAMS ((const char *));
|
||||
static void nlmheader_identify PARAMS ((void));
|
||||
static void nlmheader_warn PARAMS ((const char *, int));
|
||||
static void nlmheader_error PARAMS ((const char *));
|
||||
static struct string_list * string_list_cons PARAMS ((char *,
|
||||
struct string_list *));
|
||||
static struct string_list * string_list_append PARAMS ((struct string_list *,
|
||||
struct string_list *));
|
||||
static struct string_list * string_list_append1 PARAMS ((struct string_list *,
|
||||
char *));
|
||||
static char *xstrdup PARAMS ((const char *));
|
||||
|
||||
%}
|
||||
|
||||
%union
|
||||
{
|
||||
char *string;
|
||||
struct string_list *list;
|
||||
};
|
||||
|
||||
/* The reserved words. */
|
||||
|
||||
%token CHECK CODESTART COPYRIGHT CUSTOM DATE DEBUG DESCRIPTION EXIT
|
||||
%token EXPORT FLAG_ON FLAG_OFF FULLMAP HELP IMPORT INPUT MAP MESSAGES
|
||||
%token MODULE MULTIPLE OS_DOMAIN OUTPUT PSEUDOPREEMPTION REENTRANT
|
||||
%token SCREENNAME SHARELIB STACK START SYNCHRONIZE
|
||||
%token THREADNAME TYPE VERBOSE VERSIONK XDCDATA
|
||||
|
||||
/* Arguments. */
|
||||
|
||||
%token <string> STRING
|
||||
%token <string> QUOTED_STRING
|
||||
|
||||
/* Typed non-terminals. */
|
||||
%type <list> symbol_list_opt symbol_list string_list
|
||||
%type <string> symbol
|
||||
|
||||
%%
|
||||
|
||||
/* Keywords must start in the leftmost column of the file. Arguments
|
||||
may appear anywhere else. The lexer uses this to determine what
|
||||
token to return, so we don't have to worry about it here. */
|
||||
|
||||
/* The entire file is just a list of commands. */
|
||||
|
||||
file:
|
||||
commands
|
||||
;
|
||||
|
||||
/* A possibly empty list of commands. */
|
||||
|
||||
commands:
|
||||
/* May be empty. */
|
||||
| command commands
|
||||
;
|
||||
|
||||
/* A single command. There is where most of the work takes place. */
|
||||
|
||||
command:
|
||||
CHECK STRING
|
||||
{
|
||||
check_procedure = $2;
|
||||
}
|
||||
| CODESTART STRING
|
||||
{
|
||||
nlmheader_warn (_("CODESTART is not implemented; sorry"), -1);
|
||||
free ($2);
|
||||
}
|
||||
| COPYRIGHT QUOTED_STRING
|
||||
{
|
||||
int len;
|
||||
|
||||
strncpy (copyright_hdr->stamp, "CoPyRiGhT=", 10);
|
||||
len = strlen ($2);
|
||||
if (len >= NLM_MAX_COPYRIGHT_MESSAGE_LENGTH)
|
||||
{
|
||||
nlmheader_warn (_("copyright string is too long"),
|
||||
NLM_MAX_COPYRIGHT_MESSAGE_LENGTH - 1);
|
||||
len = NLM_MAX_COPYRIGHT_MESSAGE_LENGTH - 1;
|
||||
}
|
||||
copyright_hdr->copyrightMessageLength = len;
|
||||
strncpy (copyright_hdr->copyrightMessage, $2, len);
|
||||
copyright_hdr->copyrightMessage[len] = '\0';
|
||||
free ($2);
|
||||
}
|
||||
| CUSTOM STRING
|
||||
{
|
||||
custom_file = $2;
|
||||
}
|
||||
| DATE STRING STRING STRING
|
||||
{
|
||||
/* We don't set the version stamp here, because we use the
|
||||
version stamp to detect whether the required VERSION
|
||||
keyword was given. */
|
||||
version_hdr->month = nlmlex_get_number ($2);
|
||||
version_hdr->day = nlmlex_get_number ($3);
|
||||
version_hdr->year = nlmlex_get_number ($4);
|
||||
free ($2);
|
||||
free ($3);
|
||||
free ($4);
|
||||
if (version_hdr->month < 1 || version_hdr->month > 12)
|
||||
nlmheader_warn (_("illegal month"), -1);
|
||||
if (version_hdr->day < 1 || version_hdr->day > 31)
|
||||
nlmheader_warn (_("illegal day"), -1);
|
||||
if (version_hdr->year < 1900 || version_hdr->year > 3000)
|
||||
nlmheader_warn (_("illegal year"), -1);
|
||||
}
|
||||
| DEBUG
|
||||
{
|
||||
debug_info = true;
|
||||
}
|
||||
| DESCRIPTION QUOTED_STRING
|
||||
{
|
||||
int len;
|
||||
|
||||
len = strlen ($2);
|
||||
if (len > NLM_MAX_DESCRIPTION_LENGTH)
|
||||
{
|
||||
nlmheader_warn (_("description string is too long"),
|
||||
NLM_MAX_DESCRIPTION_LENGTH);
|
||||
len = NLM_MAX_DESCRIPTION_LENGTH;
|
||||
}
|
||||
var_hdr->descriptionLength = len;
|
||||
strncpy (var_hdr->descriptionText, $2, len);
|
||||
var_hdr->descriptionText[len] = '\0';
|
||||
free ($2);
|
||||
}
|
||||
| EXIT STRING
|
||||
{
|
||||
exit_procedure = $2;
|
||||
}
|
||||
| EXPORT
|
||||
{
|
||||
symbol_prefix = NULL;
|
||||
}
|
||||
symbol_list_opt
|
||||
{
|
||||
export_symbols = string_list_append (export_symbols, $3);
|
||||
}
|
||||
| FLAG_ON STRING
|
||||
{
|
||||
fixed_hdr->flags |= nlmlex_get_number ($2);
|
||||
free ($2);
|
||||
}
|
||||
| FLAG_OFF STRING
|
||||
{
|
||||
fixed_hdr->flags &=~ nlmlex_get_number ($2);
|
||||
free ($2);
|
||||
}
|
||||
| FULLMAP
|
||||
{
|
||||
map_file = "";
|
||||
full_map = true;
|
||||
}
|
||||
| FULLMAP STRING
|
||||
{
|
||||
map_file = $2;
|
||||
full_map = true;
|
||||
}
|
||||
| HELP STRING
|
||||
{
|
||||
help_file = $2;
|
||||
}
|
||||
| IMPORT
|
||||
{
|
||||
symbol_prefix = NULL;
|
||||
}
|
||||
symbol_list_opt
|
||||
{
|
||||
import_symbols = string_list_append (import_symbols, $3);
|
||||
}
|
||||
| INPUT string_list
|
||||
{
|
||||
input_files = string_list_append (input_files, $2);
|
||||
}
|
||||
| MAP
|
||||
{
|
||||
map_file = "";
|
||||
}
|
||||
| MAP STRING
|
||||
{
|
||||
map_file = $2;
|
||||
}
|
||||
| MESSAGES STRING
|
||||
{
|
||||
message_file = $2;
|
||||
}
|
||||
| MODULE string_list
|
||||
{
|
||||
modules = string_list_append (modules, $2);
|
||||
}
|
||||
| MULTIPLE
|
||||
{
|
||||
fixed_hdr->flags |= 0x2;
|
||||
}
|
||||
| OS_DOMAIN
|
||||
{
|
||||
fixed_hdr->flags |= 0x10;
|
||||
}
|
||||
| OUTPUT STRING
|
||||
{
|
||||
if (output_file == NULL)
|
||||
output_file = $2;
|
||||
else
|
||||
nlmheader_warn (_("ignoring duplicate OUTPUT statement"), -1);
|
||||
}
|
||||
| PSEUDOPREEMPTION
|
||||
{
|
||||
fixed_hdr->flags |= 0x8;
|
||||
}
|
||||
| REENTRANT
|
||||
{
|
||||
fixed_hdr->flags |= 0x1;
|
||||
}
|
||||
| SCREENNAME QUOTED_STRING
|
||||
{
|
||||
int len;
|
||||
|
||||
len = strlen ($2);
|
||||
if (len >= NLM_MAX_SCREEN_NAME_LENGTH)
|
||||
{
|
||||
nlmheader_warn (_("screen name is too long"),
|
||||
NLM_MAX_SCREEN_NAME_LENGTH);
|
||||
len = NLM_MAX_SCREEN_NAME_LENGTH;
|
||||
}
|
||||
var_hdr->screenNameLength = len;
|
||||
strncpy (var_hdr->screenName, $2, len);
|
||||
var_hdr->screenName[NLM_MAX_SCREEN_NAME_LENGTH] = '\0';
|
||||
free ($2);
|
||||
}
|
||||
| SHARELIB STRING
|
||||
{
|
||||
sharelib_file = $2;
|
||||
}
|
||||
| STACK STRING
|
||||
{
|
||||
var_hdr->stackSize = nlmlex_get_number ($2);
|
||||
free ($2);
|
||||
}
|
||||
| START STRING
|
||||
{
|
||||
start_procedure = $2;
|
||||
}
|
||||
| SYNCHRONIZE
|
||||
{
|
||||
fixed_hdr->flags |= 0x4;
|
||||
}
|
||||
| THREADNAME QUOTED_STRING
|
||||
{
|
||||
int len;
|
||||
|
||||
len = strlen ($2);
|
||||
if (len >= NLM_MAX_THREAD_NAME_LENGTH)
|
||||
{
|
||||
nlmheader_warn (_("thread name is too long"),
|
||||
NLM_MAX_THREAD_NAME_LENGTH);
|
||||
len = NLM_MAX_THREAD_NAME_LENGTH;
|
||||
}
|
||||
var_hdr->threadNameLength = len;
|
||||
strncpy (var_hdr->threadName, $2, len);
|
||||
var_hdr->threadName[len] = '\0';
|
||||
free ($2);
|
||||
}
|
||||
| TYPE STRING
|
||||
{
|
||||
fixed_hdr->moduleType = nlmlex_get_number ($2);
|
||||
free ($2);
|
||||
}
|
||||
| VERBOSE
|
||||
{
|
||||
verbose = true;
|
||||
}
|
||||
| VERSIONK STRING STRING STRING
|
||||
{
|
||||
long val;
|
||||
|
||||
strncpy (version_hdr->stamp, "VeRsIoN#", 8);
|
||||
version_hdr->majorVersion = nlmlex_get_number ($2);
|
||||
val = nlmlex_get_number ($3);
|
||||
if (val < 0 || val > 99)
|
||||
nlmheader_warn (_("illegal minor version number (must be between 0 and 99)"),
|
||||
-1);
|
||||
else
|
||||
version_hdr->minorVersion = val;
|
||||
val = nlmlex_get_number ($4);
|
||||
if (val < 0)
|
||||
nlmheader_warn (_("illegal revision number (must be between 0 and 26)"),
|
||||
-1);
|
||||
else if (val > 26)
|
||||
version_hdr->revision = 0;
|
||||
else
|
||||
version_hdr->revision = val;
|
||||
free ($2);
|
||||
free ($3);
|
||||
free ($4);
|
||||
}
|
||||
| VERSIONK STRING STRING
|
||||
{
|
||||
long val;
|
||||
|
||||
strncpy (version_hdr->stamp, "VeRsIoN#", 8);
|
||||
version_hdr->majorVersion = nlmlex_get_number ($2);
|
||||
val = nlmlex_get_number ($3);
|
||||
if (val < 0 || val > 99)
|
||||
nlmheader_warn (_("illegal minor version number (must be between 0 and 99)"),
|
||||
-1);
|
||||
else
|
||||
version_hdr->minorVersion = val;
|
||||
version_hdr->revision = 0;
|
||||
free ($2);
|
||||
free ($3);
|
||||
}
|
||||
| XDCDATA STRING
|
||||
{
|
||||
rpc_file = $2;
|
||||
}
|
||||
;
|
||||
|
||||
/* A possibly empty list of symbols. */
|
||||
|
||||
symbol_list_opt:
|
||||
/* Empty. */
|
||||
{
|
||||
$$ = NULL;
|
||||
}
|
||||
| symbol_list
|
||||
{
|
||||
$$ = $1;
|
||||
}
|
||||
;
|
||||
|
||||
/* A list of symbols in an import or export list. Prefixes may appear
|
||||
in parentheses. We need to use left recursion here to avoid
|
||||
building up a large import list on the parser stack. */
|
||||
|
||||
symbol_list:
|
||||
symbol
|
||||
{
|
||||
$$ = string_list_cons ($1, NULL);
|
||||
}
|
||||
| symbol_prefix
|
||||
{
|
||||
$$ = NULL;
|
||||
}
|
||||
| symbol_list symbol
|
||||
{
|
||||
$$ = string_list_append1 ($1, $2);
|
||||
}
|
||||
| symbol_list symbol_prefix
|
||||
{
|
||||
$$ = $1;
|
||||
}
|
||||
;
|
||||
|
||||
/* A prefix for subsequent symbols. */
|
||||
|
||||
symbol_prefix:
|
||||
'(' STRING ')'
|
||||
{
|
||||
if (symbol_prefix != NULL)
|
||||
free (symbol_prefix);
|
||||
symbol_prefix = $2;
|
||||
}
|
||||
;
|
||||
|
||||
/* A single symbol. */
|
||||
|
||||
symbol:
|
||||
STRING
|
||||
{
|
||||
if (symbol_prefix == NULL)
|
||||
$$ = $1;
|
||||
else
|
||||
{
|
||||
$$ = xmalloc (strlen (symbol_prefix) + strlen ($1) + 2);
|
||||
sprintf ($$, "%s@%s", symbol_prefix, $1);
|
||||
free ($1);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
/* A list of strings. */
|
||||
|
||||
string_list:
|
||||
/* May be empty. */
|
||||
{
|
||||
$$ = NULL;
|
||||
}
|
||||
| STRING string_list
|
||||
{
|
||||
$$ = string_list_cons ($1, $2);
|
||||
}
|
||||
;
|
||||
|
||||
%%
|
||||
|
||||
/* If strerror is just a macro, we want to use the one from libiberty
|
||||
since it will handle undefined values. */
|
||||
#undef strerror
|
||||
extern char *strerror ();
|
||||
|
||||
/* The lexer is simple, too simple for flex. Keywords are only
|
||||
recognized at the start of lines. Everything else must be an
|
||||
argument. A comma is treated as whitespace. */
|
||||
|
||||
/* The states the lexer can be in. */
|
||||
|
||||
enum lex_state
|
||||
{
|
||||
/* At the beginning of a line. */
|
||||
BEGINNING_OF_LINE,
|
||||
/* In the middle of a line. */
|
||||
IN_LINE
|
||||
};
|
||||
|
||||
/* We need to keep a stack of files to handle file inclusion. */
|
||||
|
||||
struct input
|
||||
{
|
||||
/* The file to read from. */
|
||||
FILE *file;
|
||||
/* The name of the file. */
|
||||
char *name;
|
||||
/* The current line number. */
|
||||
int lineno;
|
||||
/* The current state. */
|
||||
enum lex_state state;
|
||||
/* The next file on the stack. */
|
||||
struct input *next;
|
||||
};
|
||||
|
||||
/* The current input file. */
|
||||
|
||||
static struct input current;
|
||||
|
||||
/* The character which introduces comments. */
|
||||
#define COMMENT_CHAR '#'
|
||||
|
||||
/* Start the lexer going on the main input file. */
|
||||
|
||||
boolean
|
||||
nlmlex_file (name)
|
||||
const char *name;
|
||||
{
|
||||
current.next = NULL;
|
||||
return nlmlex_file_open (name);
|
||||
}
|
||||
|
||||
/* Start the lexer going on a subsidiary input file. */
|
||||
|
||||
static void
|
||||
nlmlex_file_push (name)
|
||||
const char *name;
|
||||
{
|
||||
struct input *push;
|
||||
|
||||
push = (struct input *) xmalloc (sizeof (struct input));
|
||||
*push = current;
|
||||
if (nlmlex_file_open (name))
|
||||
current.next = push;
|
||||
else
|
||||
{
|
||||
current = *push;
|
||||
free (push);
|
||||
}
|
||||
}
|
||||
|
||||
/* Start lexing from a file. */
|
||||
|
||||
static boolean
|
||||
nlmlex_file_open (name)
|
||||
const char *name;
|
||||
{
|
||||
current.file = fopen (name, "r");
|
||||
if (current.file == NULL)
|
||||
{
|
||||
fprintf (stderr, "%s:%s: %s\n", program_name, name, strerror (errno));
|
||||
++parse_errors;
|
||||
return false;
|
||||
}
|
||||
current.name = xstrdup (name);
|
||||
current.lineno = 1;
|
||||
current.state = BEGINNING_OF_LINE;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Table used to turn keywords into tokens. */
|
||||
|
||||
struct keyword_tokens_struct
|
||||
{
|
||||
const char *keyword;
|
||||
int token;
|
||||
};
|
||||
|
||||
struct keyword_tokens_struct keyword_tokens[] =
|
||||
{
|
||||
{ "CHECK", CHECK },
|
||||
{ "CODESTART", CODESTART },
|
||||
{ "COPYRIGHT", COPYRIGHT },
|
||||
{ "CUSTOM", CUSTOM },
|
||||
{ "DATE", DATE },
|
||||
{ "DEBUG", DEBUG },
|
||||
{ "DESCRIPTION", DESCRIPTION },
|
||||
{ "EXIT", EXIT },
|
||||
{ "EXPORT", EXPORT },
|
||||
{ "FLAG_ON", FLAG_ON },
|
||||
{ "FLAG_OFF", FLAG_OFF },
|
||||
{ "FULLMAP", FULLMAP },
|
||||
{ "HELP", HELP },
|
||||
{ "IMPORT", IMPORT },
|
||||
{ "INPUT", INPUT },
|
||||
{ "MAP", MAP },
|
||||
{ "MESSAGES", MESSAGES },
|
||||
{ "MODULE", MODULE },
|
||||
{ "MULTIPLE", MULTIPLE },
|
||||
{ "OS_DOMAIN", OS_DOMAIN },
|
||||
{ "OUTPUT", OUTPUT },
|
||||
{ "PSEUDOPREEMPTION", PSEUDOPREEMPTION },
|
||||
{ "REENTRANT", REENTRANT },
|
||||
{ "SCREENNAME", SCREENNAME },
|
||||
{ "SHARELIB", SHARELIB },
|
||||
{ "STACK", STACK },
|
||||
{ "STACKSIZE", STACK },
|
||||
{ "START", START },
|
||||
{ "SYNCHRONIZE", SYNCHRONIZE },
|
||||
{ "THREADNAME", THREADNAME },
|
||||
{ "TYPE", TYPE },
|
||||
{ "VERBOSE", VERBOSE },
|
||||
{ "VERSION", VERSIONK },
|
||||
{ "XDCDATA", XDCDATA }
|
||||
};
|
||||
|
||||
#define KEYWORD_COUNT (sizeof (keyword_tokens) / sizeof (keyword_tokens[0]))
|
||||
|
||||
/* The lexer accumulates strings in these variables. */
|
||||
static char *lex_buf;
|
||||
static int lex_size;
|
||||
static int lex_pos;
|
||||
|
||||
/* Start accumulating strings into the buffer. */
|
||||
#define BUF_INIT() \
|
||||
((void) (lex_buf != NULL ? lex_pos = 0 : nlmlex_buf_init ()))
|
||||
|
||||
static int
|
||||
nlmlex_buf_init ()
|
||||
{
|
||||
lex_size = 10;
|
||||
lex_buf = xmalloc (lex_size + 1);
|
||||
lex_pos = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Finish a string in the buffer. */
|
||||
#define BUF_FINISH() ((void) (lex_buf[lex_pos] = '\0'))
|
||||
|
||||
/* Accumulate a character into the buffer. */
|
||||
#define BUF_ADD(c) \
|
||||
((void) (lex_pos < lex_size \
|
||||
? lex_buf[lex_pos++] = (c) \
|
||||
: nlmlex_buf_add (c)))
|
||||
|
||||
static char
|
||||
nlmlex_buf_add (c)
|
||||
int c;
|
||||
{
|
||||
if (lex_pos >= lex_size)
|
||||
{
|
||||
lex_size *= 2;
|
||||
lex_buf = xrealloc (lex_buf, lex_size + 1);
|
||||
}
|
||||
|
||||
return lex_buf[lex_pos++] = c;
|
||||
}
|
||||
|
||||
/* The lexer proper. This is called by the bison generated parsing
|
||||
code. */
|
||||
|
||||
static int
|
||||
yylex ()
|
||||
{
|
||||
int c;
|
||||
|
||||
tail_recurse:
|
||||
|
||||
c = getc (current.file);
|
||||
|
||||
/* Commas are treated as whitespace characters. */
|
||||
while (isspace ((unsigned char) c) || c == ',')
|
||||
{
|
||||
current.state = IN_LINE;
|
||||
if (c == '\n')
|
||||
{
|
||||
++current.lineno;
|
||||
current.state = BEGINNING_OF_LINE;
|
||||
}
|
||||
c = getc (current.file);
|
||||
}
|
||||
|
||||
/* At the end of the file we either pop to the previous file or
|
||||
finish up. */
|
||||
if (c == EOF)
|
||||
{
|
||||
fclose (current.file);
|
||||
free (current.name);
|
||||
if (current.next == NULL)
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
struct input *next;
|
||||
|
||||
next = current.next;
|
||||
current = *next;
|
||||
free (next);
|
||||
goto tail_recurse;
|
||||
}
|
||||
}
|
||||
|
||||
/* A comment character always means to drop everything until the
|
||||
next newline. */
|
||||
if (c == COMMENT_CHAR)
|
||||
{
|
||||
do
|
||||
{
|
||||
c = getc (current.file);
|
||||
}
|
||||
while (c != '\n');
|
||||
++current.lineno;
|
||||
current.state = BEGINNING_OF_LINE;
|
||||
goto tail_recurse;
|
||||
}
|
||||
|
||||
/* An '@' introduces an include file. */
|
||||
if (c == '@')
|
||||
{
|
||||
do
|
||||
{
|
||||
c = getc (current.file);
|
||||
if (c == '\n')
|
||||
++current.lineno;
|
||||
}
|
||||
while (isspace ((unsigned char) c));
|
||||
BUF_INIT ();
|
||||
while (! isspace ((unsigned char) c) && c != EOF)
|
||||
{
|
||||
BUF_ADD (c);
|
||||
c = getc (current.file);
|
||||
}
|
||||
BUF_FINISH ();
|
||||
|
||||
ungetc (c, current.file);
|
||||
|
||||
nlmlex_file_push (lex_buf);
|
||||
goto tail_recurse;
|
||||
}
|
||||
|
||||
/* A non-space character at the start of a line must be the start of
|
||||
a keyword. */
|
||||
if (current.state == BEGINNING_OF_LINE)
|
||||
{
|
||||
BUF_INIT ();
|
||||
while (isalnum ((unsigned char) c) || c == '_')
|
||||
{
|
||||
if (islower ((unsigned char) c))
|
||||
BUF_ADD (toupper ((unsigned char) c));
|
||||
else
|
||||
BUF_ADD (c);
|
||||
c = getc (current.file);
|
||||
}
|
||||
BUF_FINISH ();
|
||||
|
||||
if (c != EOF && ! isspace ((unsigned char) c) && c != ',')
|
||||
{
|
||||
nlmheader_identify ();
|
||||
fprintf (stderr, _("%s:%d: illegal character in keyword: %c\n"),
|
||||
current.name, current.lineno, c);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < KEYWORD_COUNT; i++)
|
||||
{
|
||||
if (lex_buf[0] == keyword_tokens[i].keyword[0]
|
||||
&& strcmp (lex_buf, keyword_tokens[i].keyword) == 0)
|
||||
{
|
||||
/* Pushing back the final whitespace avoids worrying
|
||||
about \n here. */
|
||||
ungetc (c, current.file);
|
||||
current.state = IN_LINE;
|
||||
return keyword_tokens[i].token;
|
||||
}
|
||||
}
|
||||
|
||||
nlmheader_identify ();
|
||||
fprintf (stderr, _("%s:%d: unrecognized keyword: %s\n"),
|
||||
current.name, current.lineno, lex_buf);
|
||||
}
|
||||
|
||||
++parse_errors;
|
||||
/* Treat the rest of this line as a comment. */
|
||||
ungetc (COMMENT_CHAR, current.file);
|
||||
goto tail_recurse;
|
||||
}
|
||||
|
||||
/* Parentheses just represent themselves. */
|
||||
if (c == '(' || c == ')')
|
||||
return c;
|
||||
|
||||
/* Handle quoted strings. */
|
||||
if (c == '"' || c == '\'')
|
||||
{
|
||||
int quote;
|
||||
int start_lineno;
|
||||
|
||||
quote = c;
|
||||
start_lineno = current.lineno;
|
||||
|
||||
c = getc (current.file);
|
||||
BUF_INIT ();
|
||||
while (c != quote && c != EOF)
|
||||
{
|
||||
BUF_ADD (c);
|
||||
if (c == '\n')
|
||||
++current.lineno;
|
||||
c = getc (current.file);
|
||||
}
|
||||
BUF_FINISH ();
|
||||
|
||||
if (c == EOF)
|
||||
{
|
||||
nlmheader_identify ();
|
||||
fprintf (stderr, _("%s:%d: end of file in quoted string\n"),
|
||||
current.name, start_lineno);
|
||||
++parse_errors;
|
||||
}
|
||||
|
||||
/* FIXME: Possible memory leak. */
|
||||
yylval.string = xstrdup (lex_buf);
|
||||
return QUOTED_STRING;
|
||||
}
|
||||
|
||||
/* Gather a generic argument. */
|
||||
BUF_INIT ();
|
||||
while (! isspace (c)
|
||||
&& c != ','
|
||||
&& c != COMMENT_CHAR
|
||||
&& c != '('
|
||||
&& c != ')')
|
||||
{
|
||||
BUF_ADD (c);
|
||||
c = getc (current.file);
|
||||
}
|
||||
BUF_FINISH ();
|
||||
|
||||
ungetc (c, current.file);
|
||||
|
||||
/* FIXME: Possible memory leak. */
|
||||
yylval.string = xstrdup (lex_buf);
|
||||
return STRING;
|
||||
}
|
||||
|
||||
/* Get a number from a string. */
|
||||
|
||||
static long
|
||||
nlmlex_get_number (s)
|
||||
const char *s;
|
||||
{
|
||||
long ret;
|
||||
char *send;
|
||||
|
||||
ret = strtol (s, &send, 10);
|
||||
if (*send != '\0')
|
||||
nlmheader_warn (_("bad number"), -1);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Prefix the nlmconv warnings with a note as to where they come from.
|
||||
We don't use program_name on every warning, because then some
|
||||
versions of the emacs next-error function can't recognize the line
|
||||
number. */
|
||||
|
||||
static void
|
||||
nlmheader_identify ()
|
||||
{
|
||||
static int done;
|
||||
|
||||
if (! done)
|
||||
{
|
||||
fprintf (stderr, _("%s: problems in NLM command language input:\n"),
|
||||
program_name);
|
||||
done = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Issue a warning. */
|
||||
|
||||
static void
|
||||
nlmheader_warn (s, imax)
|
||||
const char *s;
|
||||
int imax;
|
||||
{
|
||||
nlmheader_identify ();
|
||||
fprintf (stderr, "%s:%d: %s", current.name, current.lineno, s);
|
||||
if (imax != -1)
|
||||
fprintf (stderr, " (max %d)", imax);
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
|
||||
/* Report an error. */
|
||||
|
||||
static void
|
||||
nlmheader_error (s)
|
||||
const char *s;
|
||||
{
|
||||
nlmheader_warn (s, -1);
|
||||
++parse_errors;
|
||||
}
|
||||
|
||||
/* Add a string to a string list. */
|
||||
|
||||
static struct string_list *
|
||||
string_list_cons (s, l)
|
||||
char *s;
|
||||
struct string_list *l;
|
||||
{
|
||||
struct string_list *ret;
|
||||
|
||||
ret = (struct string_list *) xmalloc (sizeof (struct string_list));
|
||||
ret->next = l;
|
||||
ret->string = s;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Append a string list to another string list. */
|
||||
|
||||
static struct string_list *
|
||||
string_list_append (l1, l2)
|
||||
struct string_list *l1;
|
||||
struct string_list *l2;
|
||||
{
|
||||
register struct string_list **pp;
|
||||
|
||||
for (pp = &l1; *pp != NULL; pp = &(*pp)->next)
|
||||
;
|
||||
*pp = l2;
|
||||
return l1;
|
||||
}
|
||||
|
||||
/* Append a string to a string list. */
|
||||
|
||||
static struct string_list *
|
||||
string_list_append1 (l, s)
|
||||
struct string_list *l;
|
||||
char *s;
|
||||
{
|
||||
struct string_list *n;
|
||||
register struct string_list **pp;
|
||||
|
||||
n = (struct string_list *) xmalloc (sizeof (struct string_list));
|
||||
n->next = NULL;
|
||||
n->string = s;
|
||||
for (pp = &l; *pp != NULL; pp = &(*pp)->next)
|
||||
;
|
||||
*pp = n;
|
||||
return l;
|
||||
}
|
||||
|
||||
/* Duplicate a string in memory. */
|
||||
|
||||
static char *
|
||||
xstrdup (s)
|
||||
const char *s;
|
||||
{
|
||||
unsigned long len;
|
||||
char *ret;
|
||||
|
||||
len = strlen (s);
|
||||
ret = xmalloc (len + 1);
|
||||
strcpy (ret, s);
|
||||
return ret;
|
||||
}
|
||||
230
binutils/nm.1
230
binutils/nm.1
@@ -1,230 +0,0 @@
|
||||
.\" Copyright (c) 1991 Free Software Foundation
|
||||
.\" See section COPYING for conditions for redistribution
|
||||
.TH nm 1 "5 November 1991" "cygnus support" "GNU Development Tools"
|
||||
.de BP
|
||||
.sp
|
||||
.ti \-.2i
|
||||
\(**
|
||||
..
|
||||
|
||||
.SH NAME
|
||||
nm \- list symbols from object files.
|
||||
|
||||
.SH SYNOPSIS
|
||||
.hy 0
|
||||
.na
|
||||
.TP
|
||||
.B nm
|
||||
.RB "[\|" \-a | \-\-debug\-syms "\|]"
|
||||
.RB "[\|" \-g | \-\-extern\-only "\|]"
|
||||
.RB "[\|" \-B "\|]"
|
||||
.RB "[\|" \-C | \-\-demangle "\|]"
|
||||
.RB "[\|" \-D | \-\-dynamic "\|]"
|
||||
.RB "[\|" \-s | \-\-print\-armap "\|]"
|
||||
.RB "[\|" \-o | \-\-print\-file\-name "\|]"
|
||||
.RB "[\|" \-n | \-\-numeric\-sort "\|]"
|
||||
.RB "[\|" \-p | \-\-no\-sort "\|]"
|
||||
.RB "[\|" \-r | \-\-reverse\-sort "\|]"
|
||||
.RB "[\|" \-\-size\-sort "\|]"
|
||||
.RB "[\|" \-u | \-\-undefined\-only "\|]"
|
||||
.RB "[\|" \-l | \-\-line\-numbers "\|]"
|
||||
.RB "[\|" \-\-help "\|]"
|
||||
.RB "[\|" \-\-version "\|]"
|
||||
.RB "[\|" "\-t \fIradix" | \-\-radix=\fIradix "\|]"
|
||||
.RB "[\|" \-P | --portability "\|]"
|
||||
.RB "[\|" "\-f \fIformat" | \-\-format=\fIformat "\|]"
|
||||
.RB "[\|" "\-\-target=\fIbfdname" "\|]"
|
||||
.RB "[\|" \c
|
||||
.I objfile\c
|
||||
\&.\|.\|.\|]
|
||||
.ad b
|
||||
.hy 1
|
||||
.SH DESCRIPTION
|
||||
GNU \c
|
||||
.B nm\c
|
||||
\& lists the symbols from object files \c
|
||||
.I objfile\c
|
||||
\&. If no object files are given as arguments, \c
|
||||
.B nm\c
|
||||
\& assumes `\|\c
|
||||
.B a.out\c
|
||||
\|'.
|
||||
|
||||
.SH OPTIONS
|
||||
The long and short forms of options, shown here as alternatives, are
|
||||
equivalent.
|
||||
|
||||
.TP
|
||||
.B \-A
|
||||
.TP
|
||||
.B \-o
|
||||
.TP
|
||||
.B \-\-print\-file\-name
|
||||
Precede each symbol by the name of the input file where it was found,
|
||||
rather than identifying the input file once only before all of its
|
||||
symbols.
|
||||
|
||||
.TP
|
||||
.B \-a
|
||||
.TP
|
||||
.B \-\-debug\-syms
|
||||
Display debugger-only symbols; normally these are not listed.
|
||||
|
||||
.TP
|
||||
.B \-B
|
||||
The same as
|
||||
.B \-\-format=bsd
|
||||
(for compatibility with the MIPS \fBnm\fP).
|
||||
|
||||
.TP
|
||||
.B \-C
|
||||
.TP
|
||||
.B \-\-demangle
|
||||
Decode (\fIdemangle\fP) low-level symbol names into user-level names.
|
||||
Besides removing any initial underscore prepended by the system, this
|
||||
makes C++ function names readable.
|
||||
|
||||
.TP
|
||||
.B \-D
|
||||
.TP
|
||||
.B \-\-dynamic
|
||||
Display the dynamic symbols rather than the normal symbols. This is
|
||||
only meaningful for dynamic objects, such as certain types of shared
|
||||
libraries.
|
||||
|
||||
.TP
|
||||
.B "\-f \fIformat"
|
||||
Use the output format \fIformat\fP, which can be ``bsd'',
|
||||
``sysv'', or ``posix''. The default is ``bsd''.
|
||||
Only the first character of \fIformat\fP is significant; it can be
|
||||
either upper or lower case.
|
||||
|
||||
.TP
|
||||
.B \-g
|
||||
.TP
|
||||
.B \-\-extern\-only
|
||||
Display only external symbols.
|
||||
|
||||
.TP
|
||||
.B \-n
|
||||
.TP
|
||||
.B \-v
|
||||
.TP
|
||||
.B \-\-numeric\-sort
|
||||
Sort symbols numerically by their addresses, not alphabetically by their
|
||||
names.
|
||||
|
||||
.TP
|
||||
.B \-p
|
||||
.TP
|
||||
.B \-\-no\-sort
|
||||
Don't bother to sort the symbols in any order; just print them in the
|
||||
order encountered.
|
||||
|
||||
.TP
|
||||
.B \-P
|
||||
.TP
|
||||
.B \-\-portability
|
||||
Use the POSIX.2 standard output format instead of the default format.
|
||||
Equivalent to ``\-f posix''.
|
||||
|
||||
.TP
|
||||
.B \-s
|
||||
.TP
|
||||
.B \-\-print\-armap
|
||||
When listing symbols from archive members, include the index: a mapping
|
||||
(stored in the archive by \c
|
||||
.B ar\c
|
||||
\& or \c
|
||||
.B ranlib\c
|
||||
\&) of what modules
|
||||
contain definitions for what names.
|
||||
|
||||
.TP
|
||||
.B \-r
|
||||
.TP
|
||||
.B \-\-reverse\-sort
|
||||
Reverse the sense of the sort (whether numeric or alphabetic); let the
|
||||
last come first.
|
||||
|
||||
.TP
|
||||
.B \-\-size\-sort
|
||||
Sort symbols by size. The size is computed as the difference between
|
||||
the value of the symbol and the value of the symbol with the next higher
|
||||
value. The size of the symbol is printed, rather than the value.
|
||||
|
||||
.TP
|
||||
.B "\-t \fIradix"
|
||||
.TP
|
||||
.B "\-\-radix=\fIradix"
|
||||
Use \fIradix\fP as the radix for printing the symbol values. It must be
|
||||
``d'' for decimal, ``o'' for octal, or ``x'' for hexadecimal.
|
||||
|
||||
.TP
|
||||
.BI "\-\-target=" "bfdname"
|
||||
Specify an object code format other than your system's default format.
|
||||
See
|
||||
.BR objdump ( 1 ),
|
||||
for information on listing available formats.
|
||||
|
||||
.TP
|
||||
.B \-u
|
||||
.TP
|
||||
.B \-\-undefined\-only
|
||||
Display only undefined symbols (those external to each object file).
|
||||
|
||||
.TP
|
||||
.B \-l
|
||||
.TP
|
||||
.B \-\-line\-numbers
|
||||
For each symbol, use debugging information to try to find a filename and
|
||||
line number. For a defined symbol, look for the line number of the
|
||||
address of the symbol. For an undefined symbol, look for the line
|
||||
number of a relocation entry which refers to the symbol. If line number
|
||||
information can be found, print it after the other symbol information.
|
||||
|
||||
.TP
|
||||
.B \-V
|
||||
.TP
|
||||
.B \-\-version
|
||||
Show the version number of
|
||||
.B nm
|
||||
and exit.
|
||||
|
||||
.TP
|
||||
.B \-\-help
|
||||
Show a summary of the options to
|
||||
.B nm
|
||||
and exit.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.RB "`\|" binutils "\|'"
|
||||
entry in
|
||||
.B
|
||||
info\c
|
||||
\&;
|
||||
.I
|
||||
The GNU Binary Utilities\c
|
||||
\&, Roland H. Pesch (October 1991);
|
||||
.BR ar "(" 1 "),"
|
||||
.BR objdump ( 1 ),
|
||||
.BR ranlib "(" 1 ")."
|
||||
|
||||
|
||||
.SH COPYING
|
||||
Copyright (c) 1991 Free Software Foundation, Inc.
|
||||
.PP
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
.PP
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the
|
||||
entire resulting derived work is distributed under the terms of a
|
||||
permission notice identical to this one.
|
||||
.PP
|
||||
Permission is granted to copy and distribute translations of this
|
||||
manual into another language, under the above conditions for modified
|
||||
versions, except that this permission notice may be included in
|
||||
translations approved by the Free Software Foundation instead of in
|
||||
the original English.
|
||||
1557
binutils/nm.c
1557
binutils/nm.c
File diff suppressed because it is too large
Load Diff
@@ -1,3 +0,0 @@
|
||||
/* Linked with ar.o to flag that this program is 'ar' (not 'ranlib'). */
|
||||
|
||||
int is_ranlib = 0;
|
||||
@@ -1,4 +0,0 @@
|
||||
/* Linked with objcopy.o to flag that this program is 'objcopy' (not
|
||||
'strip'). */
|
||||
|
||||
int is_strip = 0;
|
||||
@@ -1,332 +0,0 @@
|
||||
.\" Copyright (c) 1991, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation
|
||||
.\" See section COPYING for conditions for redistribution
|
||||
.TH objcopy 1 "05 April 2000" "Cygnus Solutions" "GNU Development Tools"
|
||||
.de BP
|
||||
.sp
|
||||
.ti \-.2i
|
||||
\(**
|
||||
..
|
||||
|
||||
.SH NAME
|
||||
objcopy \- copy and translate object files
|
||||
|
||||
.SH SYNOPSIS
|
||||
.hy 0
|
||||
.na
|
||||
.TP
|
||||
.B objcopy
|
||||
.RB "[\|" \-F\ \fIbfdname\fR\ |\ \fB\-\-target=\fIbfdname\fR "\|]"
|
||||
.RB "[\|" \-I\ \fIbfdname\fR\ |\ \fB\-\-input\-target=\fIbfdname\fR "\|]"
|
||||
.RB "[\|" \-O\ \fIbfdname\fR\ |\ \fB\-\-output\-target=\fIbfdname\fR "\|]"
|
||||
.RB "[\|" \-j\ \fIsectionname\fR\ |\ \fB\-\-only\-section=\fIsectionname\fR "\|]"
|
||||
.RB "[\|" \-R\ \fIsectionname\fR\ |\ \fB\-\-remove\-section=\fIsectionname\fR "\|]"
|
||||
.RB "[\|" \-S\fR\ |\ \fB\-\-strip\-all\fR "\|]"
|
||||
.RB "[\|" \-g\fR\ |\ \fB\-\-strip\-debug\fR "\|]"
|
||||
.RB "[\|" \-\-strip\-unneeded\fR "\|]"
|
||||
.RB "[\|" \-K\ \fIsymbolname\fR\ |\ \fB\-\-keep\-symbol=\fIsymbolname\fR "\|]"
|
||||
.RB "[\|" \-N\ \fIsymbolname\fR\ |\ \fB\-\-strip\-symbol=\fIsymbolname\fR "\|]"
|
||||
.RB "[\|" \-L\ \fIsymbolname\fR\ |\ \fB\-\-localize\-symbol=\fIsymbolname\fR "\|]"
|
||||
.RB "[\|" \-W\ \fIsymbolname\fR\ |\ \fB\-\-weaken\-symbol=\fIsymbolname\fR "\|]"
|
||||
.RB "[\|" \-x\fR\ |\ \fB\-\-discard\-all\fR "\|]"
|
||||
.RB "[\|" \-X\fR\ |\ \fB\-\-discard\-locals\fR "\|]"
|
||||
.RB "[\|" \-b\ \fIbyte\fR\ |\ \fB\-\-byte=\fIbyte\fR "\|]"
|
||||
.RB "[\|" \-i\ \fIinterleave\fR\ |\ \fB\-\-interleave=\fIinterleave\fR "\|]"
|
||||
.RB "[\|" \-p\fR\ |\ \fB\-\-preserve\-dates\fR "\|]"
|
||||
.RB "[\|" \-\-debugging "\|]"
|
||||
.RB "[\|" \-\-gap\-fill=\fIval\fR "\|]"
|
||||
.RB "[\|" \-\-pad\-to=\fIaddress\fR "\|]"
|
||||
.RB "[\|" \-\-set\-start=\fIval\fR "\|]"
|
||||
.RB "[\|" \-\-change\-start=\fIincr\fR "\|]"
|
||||
.RB "[\|" \-\-change\-addresses=\fIincr\fR "\|]"
|
||||
.RB "[\|" \-\-change\-section\-address\ \fIsection{=,+,-}val\fR "\|]"
|
||||
.RB "[\|" \-\-change\-section\-lma\ \fIsection{=,+,-}val\fR "\|]"
|
||||
.RB "[\|" \-\-change\-section\-vma\ \fIsection{=,+,-}val\fR "\|]"
|
||||
.RB "[\|" \-\-change\-warnings\fR "\|]"
|
||||
.RB "[\|" \-\-no\-change\-warnings\fR "\|]"
|
||||
.RB "[\|" \-\-set\-section\-flags\ \fIsection=flags\fR "\|]"
|
||||
.RB "[\|" \-\-add\-section\ \fIsectionname=filename\fR "\|]"
|
||||
.RB "[\|" \-\-change\-leading\-char\fR "\|]"
|
||||
.RB "[\|" \-\-remove\-leading\-char\fR "\|]"
|
||||
.RB "[\|" \-\-redefine\-sym\ \fIold=new\fR "\|]"
|
||||
.RB "[\|" \-\-weaken\fR "\|]"
|
||||
.RB "[\|" \-v\ |\ \-\-verbose\fR "\|]"
|
||||
.RB "[\|" \-V\ |\ \-\-version\fR "\|]"
|
||||
.RB "[\|" \-\-help\fR "\|]"
|
||||
.B infile
|
||||
.RB "[\|" outfile\fR "\|]"
|
||||
.SH DESCRIPTION
|
||||
The GNU
|
||||
.B objcopy
|
||||
utility copies the contents of an object file to another.
|
||||
.B objcopy
|
||||
uses the GNU BFD Library to read and write the object files. It can
|
||||
write the destination object file in a format different from that of
|
||||
the source object file. The exact behavior of
|
||||
.B objcopy
|
||||
is controlled by command-line options.
|
||||
.PP
|
||||
.B objcopy
|
||||
creates temporary files to do its translations and deletes them
|
||||
afterward.
|
||||
.B objcopy
|
||||
uses BFD to do all its translation work; it knows about all the
|
||||
formats BFD knows about, and thus is able to recognize most formats
|
||||
without being told explicitly.
|
||||
.PP
|
||||
.B objcopy
|
||||
can be used to generate S-records by using an output target of
|
||||
.B srec
|
||||
(e.g., use
|
||||
.B -O srec).
|
||||
.PP
|
||||
.B objcopy
|
||||
can be used to generate a raw binary file by using an output target of
|
||||
.B binary
|
||||
(e.g., use
|
||||
.B -O binary).
|
||||
When
|
||||
.B objcopy
|
||||
generates a raw binary file, it will essentially produce a memory dump
|
||||
of the contents of the input object file. All symbols and relocation
|
||||
information will be discarded. The memory dump will start at the
|
||||
virtual address of the lowest section copied into the output file.
|
||||
.PP
|
||||
When generating an S-record or a raw binary file, it may be helpful to
|
||||
use
|
||||
.B -S
|
||||
to remove sections containing debugging information. In some cases
|
||||
.B -R
|
||||
will be useful to remove sections which contain information which is
|
||||
not needed by the binary file.
|
||||
.PP
|
||||
.I infile
|
||||
and
|
||||
.I outfile
|
||||
are the source and output files respectively. If you do not specify
|
||||
.IR outfile ,
|
||||
.B objcopy
|
||||
creates a temporary file and destructively renames the result with the
|
||||
name of the input file.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-I \fIbfdname\fR, \fB\-\-input\-target=\fIbfdname
|
||||
Consider the source file's object format to be
|
||||
.IR bfdname ,
|
||||
rather than attempting to deduce it.
|
||||
.TP
|
||||
.B \-O \fIbfdname\fR, \fB\-\-output\-target=\fIbfdname
|
||||
Write the output file using the object format
|
||||
.IR bfdname .
|
||||
.TP
|
||||
.B \-F \fIbfdname\fR, \fB\-\-target=\fIbfdname
|
||||
Use
|
||||
.I bfdname
|
||||
as the object format for both the input and the output file; i.e.
|
||||
simply transfer data from source to destination with no translation.
|
||||
.TP
|
||||
.B \-j \fIsectionname\fR, \fB\-\-only\-section=\fIsectionname
|
||||
Copy only the named section from the input file to the output file,
|
||||
discarding all other sections. This option may be given more than
|
||||
once. Note that using this option inappropriately may make the output
|
||||
file unusable.
|
||||
.TP
|
||||
.B \-R \fIsectionname\fR, \fB\-\-remove-section=\fIsectionname
|
||||
Remove the named section from the file. This option may be given more
|
||||
than once. Note that using this option inappropriately may make the
|
||||
output file unusable.
|
||||
.TP
|
||||
.B \-S\fR, \fB\-\-strip\-all
|
||||
Do not copy relocation and symbol information from the source file.
|
||||
.TP
|
||||
.B \-g\fR, \fB\-\-strip\-debug
|
||||
Do not copy debugging symbols from the source file.
|
||||
.TP
|
||||
.B \-\-strip\-unneeded
|
||||
Strip all symbols that are not needed for relocation processing.
|
||||
.TP
|
||||
.B \-K \fIsymbolname\fR, \fB\-\-keep\-symbol=\fIsymbolname
|
||||
Copy only symbol \fIsymbolname\fP from the source file. This option
|
||||
may be given more than once.
|
||||
.TP
|
||||
.B \-N \fIsymbolname\fR, \fB\-\-strip\-symbol=\fIsymbolname
|
||||
Do not copy symbol \fIsymbolname\fP from the source file. This option
|
||||
may be given more than once.
|
||||
.TP
|
||||
.B \-L \fIsymbolname\fR, \fB\-\-localize\-symbol=\fIsymbolname
|
||||
Make symbol \fIsymbolname\fP local to the file, so that it is not
|
||||
visible externally. This option may be given more than once.
|
||||
.TP
|
||||
.B \-W \fIsymbolname\fR, \fB\-\-weaken\-symbol=\fIsymbolname
|
||||
Make symbol \fIsymbolname\fP weak. This option may be given more than once.
|
||||
.TP
|
||||
.B \-x\fR, \fB\-\-discard\-all
|
||||
Do not copy non-global symbols from the source file.
|
||||
.TP
|
||||
.B \-X\fR, \fB\-\-discard\-locals
|
||||
Do not copy compiler-generated local symbols. (These usually start
|
||||
with "L" or ".").
|
||||
.TP
|
||||
.B \-b \fIbyte\fR, \fB\-\-byte=\fIbyte
|
||||
Keep only every \fIbyte\fPth byte of the input file (header data is
|
||||
not affected). \fIbyte\fP can be in the range from 0 to the
|
||||
interleave-1. This option is useful for creating files to program
|
||||
ROMs. It is typically used with an srec output target.
|
||||
.TP
|
||||
.B \-i \fIinterleave\fR, \fB\-\-interleave=\fIinterleave
|
||||
Only copy one out of every \fIinterleave\fP bytes. Which one to copy is
|
||||
selected by the \fB\-b\fP or \fB\-\-byte\fP option. The default is 4.
|
||||
The interleave is ignored if neither \fB\-b\fP nor \fB\-\-byte\fP is given.
|
||||
.TP
|
||||
.B \-p\fR, \fB\-\-preserve\-dates
|
||||
Set the access and modification dates of the output file to be the same
|
||||
as those of the input file.
|
||||
.TP
|
||||
.B \-\-debugging
|
||||
Convert debugging information, if possible. This is not the default
|
||||
because only certain debugging formats are supported, and the
|
||||
conversion process can be time consuming.
|
||||
.TP
|
||||
.B \-\-gap\-fill=\fIval
|
||||
Fill gaps between sections with \fIval\fP. This operation applies to
|
||||
the \fIload address\fP (LMA) of the sections. It is done by increasing
|
||||
the size of the section with the lower address, and filling in the extra
|
||||
space created with \fIval\fP.
|
||||
.TP
|
||||
.B \-\-pad\-to=\fIaddress
|
||||
Pad the output file up to the load address \fIaddress\fP. This is
|
||||
done by increasing the size of the last section. The extra space is
|
||||
filled in with the value specified by \fB\-\-gap\-fill\fP (default
|
||||
zero).
|
||||
.TP
|
||||
.B \fB\-\-set\-start=\fIval
|
||||
Set the start address of the new file to \fIval\fP. Not all object
|
||||
file formats support setting the start address.
|
||||
.TP
|
||||
.B \fB\-\-change\-start=\fIincr\fR, \fB\-\-adjust\-start=\fIincr
|
||||
Changes the start address by adding \fIincr\fP. Not all object file
|
||||
formats support setting the start address.
|
||||
.TP
|
||||
.B \fB\-\-change\-addresses=\fIincr\fR, \fB\-\-adjust\-vma=\fIincr
|
||||
Changes the address of all sections, as well as the start address, by
|
||||
adding \fIincr\fP. Some object file formats do not permit section
|
||||
addresses to be changed arbitrarily. Note that this does not relocate
|
||||
the sections; if the program expects sections to be loaded at a
|
||||
certain address, and this option is used to change the sections such
|
||||
that they are loaded at a different address, the program may fail.
|
||||
.TP
|
||||
.B \fB\-\-change\-section\-address\ \fIsection{=,+,-}val\fR, \fB\-\-adjust\-section\-vma\ \fIsection{=,+,-}val
|
||||
Set or changes the VMA and LMA addresses of the named \fIsection\fP.
|
||||
If \fI=\fP is used, the section address is set to \fIval\fP.
|
||||
Otherwise, \fIval\fP is added to or subtracted from the section
|
||||
address. See the comments under \fB\-\-change\-addresses\fP, above. If
|
||||
\fIsection\fP does not exist in the input file, a warning will be
|
||||
issued, unless \fB\-\-no\-change\-warnings\fP is used.
|
||||
.TP
|
||||
.B \fB\-\-change\-section\-lma\ \fIsection{=,+,-}val
|
||||
Set or change the LMA address of the named \fIsection\fP. If \fI=\fP is
|
||||
used, the section address is set to \fIval\fP. Otherwise, \fIval\fP
|
||||
is added to or subtracted from the section address. See the comments
|
||||
under \fB\-\-change\-addresses\fP, above. If \fIsection\fP does not exist
|
||||
in the input file, a warning will be issued, unless
|
||||
\fB\-\-no\-change\-warnings\fP is used.
|
||||
.TP
|
||||
.B \fB\-\-change\-section\-vma\ \fIsection{=,+,-}val
|
||||
Set or change the VMA address of the named \fIsection\fP. If \fI=\fP is
|
||||
used, the section address is set to \fIval\fP. Otherwise, \fIval\fP
|
||||
is added to or subtracted from the section address. See the comments
|
||||
under \fB\-\-change\-addresses\fP, above. If \fIsection\fP does not exist
|
||||
in the input file, a warning will be issued, unless
|
||||
\fB\-\-no\-change\-warnings\fP is used.
|
||||
.TP
|
||||
.B \fB\-\-change\-warnings\fR, \fB\-\-adjust\-warnings
|
||||
If \fB\-\-change\-section\-XXX\fP is used, and the named section does
|
||||
not exist, issue a warning. This is the default.
|
||||
.TP
|
||||
.B \fB\-\-no\-change\-warnings\fR, \fB\-\-no\-adjust\-warnings
|
||||
Do not issue a warning if \fB\-\-change\-section\-XXX\fP is used, even
|
||||
if the named section does not exist.
|
||||
.TP
|
||||
.B \fB\-\-set\-section\-flags\ \fIsection=flags
|
||||
Set the flags for the named section. The \fIflags\fP argument is a
|
||||
comma separated string of flag names. The recognized names are
|
||||
\fIalloc\fP, \fIcontents\fP, \fIload\fP, \fInoload\fP, \fIreadonly\fP,
|
||||
\fIcode\fP, \fIdata\fP, \fIrom\fP, \fIshare\fP, and \fIdebug\fP. Not
|
||||
all flags are meaningful for all object file formats.
|
||||
.TP
|
||||
.B \fB\-\-add\-section\ \fIsectionname=filename
|
||||
Add a new section named \fIsectionname\fR while copying the file. The
|
||||
contents of the new section are taken from the file \fIfilename\fR.
|
||||
The size of the section will be the size of the file. This option
|
||||
only works on file formats which can support sections with arbitrary
|
||||
names.
|
||||
.TP
|
||||
.B \-\-change\-leading\-char
|
||||
Some object file formats use special characters at the start of
|
||||
symbols. The most common such character is underscore, which compilers
|
||||
often add before every symbol. This option tells
|
||||
.B objcopy
|
||||
to change the leading character of every symbol when it converts
|
||||
between object file formats. If the object file formats use the same
|
||||
leading character, this option has no effect. Otherwise, it will add
|
||||
a character, or remove a character, or change a character, as
|
||||
appropriate.
|
||||
.TP
|
||||
.B \-\-remove\-leading\-char
|
||||
If the first character of a global symbol is a special symbol leading
|
||||
character used by the object file format, remove the character. The
|
||||
most common symbol leading character is underscore. This option will
|
||||
remove a leading underscore from all global symbols. This can be
|
||||
useful if you want to link together objects of different file formats
|
||||
with different conventions for symbol names. This is different from
|
||||
\fB\-\-change\-leading\-char\fP because it always changes the symbol name
|
||||
when appropriate, regardless of the object file format of the output
|
||||
.TP
|
||||
.B \-\-redefine\-sym\ \fIold=new
|
||||
Change the name of symbol \fIold\fR to \fInew\fR. This can be useful
|
||||
when one is trying link two things together for which you have no
|
||||
source, and there are name collisions.
|
||||
.TP
|
||||
.B \-\-weaken
|
||||
Change all global symbols in the file to be weak.
|
||||
.TP
|
||||
.B \-v\fR, \fB\-\-verbose
|
||||
Verbose output: list all object files modified. In the case of
|
||||
archives, "\fBobjcopy \-V\fR" lists all members of the archive.
|
||||
.TP
|
||||
.B \-V\fR, \fB\-\-version
|
||||
Show the version number of
|
||||
.B objcopy
|
||||
and exit.
|
||||
.TP
|
||||
.B \-\-help
|
||||
Show a summary of the options to
|
||||
.B objcopy
|
||||
and exit.
|
||||
.SH "SEE ALSO"
|
||||
.RB "`\|" binutils "\|'"
|
||||
entry in
|
||||
.B
|
||||
info\c
|
||||
\&;
|
||||
.I
|
||||
The GNU Binary Utilities\c
|
||||
\&, Roland H. Pesch (June 1993).
|
||||
|
||||
.SH COPYING
|
||||
Copyright (c) 1993, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
|
||||
.PP
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
.PP
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the
|
||||
entire resulting derived work is distributed under the terms of a
|
||||
permission notice identical to this one.
|
||||
.PP
|
||||
Permission is granted to copy and distribute translations of this
|
||||
manual into another language, under the above conditions for modified
|
||||
versions, except that this permission notice may be included in
|
||||
translations approved by the Free Software Foundation instead of in
|
||||
the original English.
|
||||
2262
binutils/objcopy.c
2262
binutils/objcopy.c
File diff suppressed because it is too large
Load Diff
@@ -1,412 +0,0 @@
|
||||
.\" Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation
|
||||
.\" See section COPYING for conditions for redistribution
|
||||
.TH objdump 1 "5 November 1991" "cygnus support" "GNU Development Tools"
|
||||
.de BP
|
||||
.sp
|
||||
.ti \-.2i
|
||||
\(**
|
||||
..
|
||||
|
||||
.SH NAME
|
||||
objdump \- display information from object files.
|
||||
|
||||
.SH SYNOPSIS
|
||||
.hy 0
|
||||
.na
|
||||
.TP
|
||||
.B objdump
|
||||
.RB "[\|" \-a | \-\-archive\-headers "\|]"
|
||||
.RB "[\|" "\-b\ "\c
|
||||
.I bfdname\c
|
||||
.RB " | " "\-\-target="\c
|
||||
.I bfdname\c
|
||||
\&\|]
|
||||
.RB "[\|" \-C | \-\-demangle "\|]"
|
||||
.RB "[\|" \-\-debugging "\|]"
|
||||
.RB "[\|" \-d | \-\-disassemble "\|]"
|
||||
.RB "[\|" \-D | \-\-disassemble-all "\|]"
|
||||
.RB "[\|" \-\-disassemble\-zeroes "\|]"
|
||||
.RB "[\|" \-EB | \-EL | \-\-endian=\c
|
||||
.I {big|little}\c
|
||||
\&\|]
|
||||
.RB "[\|" \-f | \-\-file\-headers "\|]"
|
||||
.RB "[\|" \-h | \-\-section\-headers
|
||||
.RB "| " \-\-headers "\|]"
|
||||
.RB "[\|" \-i | \-\-info "\|]"
|
||||
.RB "[\|" "\-j\ "\c
|
||||
.I section\c
|
||||
.RB " | " "\-\-section="\c
|
||||
.I section\c
|
||||
\&\|]
|
||||
.RB "[\|" \-l | \-\-line\-numbers "\|]"
|
||||
.RB "[\|" "\-m\ "\c
|
||||
.I machine\c
|
||||
.RB " | " "\-\-architecture="\c
|
||||
.I machine\c
|
||||
\&\|]
|
||||
.RB "[\|" \-p | \-\-private\-headers "\|]"
|
||||
.RB "[\|" \-\-prefix\-addresses "\|]"
|
||||
.RB "[\|" \-r | \-\-reloc "\|]"
|
||||
.RB "[\|" \-R | \-\-dynamic\-reloc "\|]"
|
||||
.RB "[\|" \-s | \-\-full\-contents "\|]"
|
||||
.RB "[\|" \-S | \-\-source "\|]"
|
||||
.RB "[\|" \-\-[no\-]show\-raw\-insn "\|]"
|
||||
.RB "[\|" \-\-stabs "\|]"
|
||||
.RB "[\|" \-t | \-\-syms "\|]"
|
||||
.RB "[\|" \-T | \-\-dynamic\-syms "\|]"
|
||||
.RB "[\|" \-x | \-\-all\-headers "\|]"
|
||||
.RB "[\|" "\-\-start\-address="\c
|
||||
.I address\c
|
||||
\&\|]
|
||||
.RB "[\|" "\-\-stop\-address="\c
|
||||
.I address\c
|
||||
\&\|]
|
||||
.RB "[\|" "\-\-adjust\-vma="\c
|
||||
.I offset\c
|
||||
\&\|]
|
||||
.RB "[\|" \-\-version "\|]"
|
||||
.RB "[\|" \-\-help "\|]"
|
||||
.I objfile\c
|
||||
\&.\|.\|.
|
||||
.ad b
|
||||
.hy 1
|
||||
.SH DESCRIPTION
|
||||
\c
|
||||
.B objdump\c
|
||||
\& displays information about one or more object files.
|
||||
The options control what particular information to display. This
|
||||
information is mostly useful to programmers who are working on the
|
||||
compilation tools, as opposed to programmers who just want their
|
||||
program to compile and work.
|
||||
.PP
|
||||
.IR "objfile" .\|.\|.
|
||||
are the object files to be examined. When you specify archives,
|
||||
\c
|
||||
.B objdump\c
|
||||
\& shows information on each of the member object files.
|
||||
|
||||
.SH OPTIONS
|
||||
Where long and short forms of an option are shown together, they are
|
||||
equivalent. At least one option besides
|
||||
.B \-l
|
||||
(\fB\-\-line\-numbers\fP) must be given.
|
||||
|
||||
.TP
|
||||
.B \-a
|
||||
.TP
|
||||
.B \-\-archive\-headers
|
||||
If any files from \c
|
||||
.I objfile\c
|
||||
\& are archives, display the archive
|
||||
header information (in a format similar to `\|\c
|
||||
.B ls \-l\c
|
||||
\|'). Besides the
|
||||
information you could list with `\|\c
|
||||
.B ar tv\c
|
||||
\|', `\|\c
|
||||
.B objdump \-a\c
|
||||
\|' shows
|
||||
the object file format of each archive member.
|
||||
|
||||
.TP
|
||||
.BI "\-\-adjust\-vma=" "offset"
|
||||
When dumping information, first add
|
||||
.I offset
|
||||
to all the section addresses. This is useful if the section addresses
|
||||
do not correspond to the symbol table, which can happen when putting
|
||||
sections at particular addresses when using a format which can not
|
||||
represent section addresses, such as a.out.
|
||||
|
||||
.TP
|
||||
.BI "\-b " "bfdname"\c
|
||||
.TP
|
||||
.BI "\-\-target=" "bfdname"
|
||||
Specify the object-code format for the object files to be
|
||||
\c
|
||||
.I bfdname\c
|
||||
\&. This may not be necessary; \c
|
||||
.I objdump\c
|
||||
\& can
|
||||
automatically recognize many formats. For example,
|
||||
.sp
|
||||
.br
|
||||
objdump\ \-b\ oasys\ \-m\ vax\ \-h\ fu.o
|
||||
.br
|
||||
.sp
|
||||
display summary information from the section headers (`\|\c
|
||||
.B \-h\c
|
||||
\|') of
|
||||
`\|\c
|
||||
.B fu.o\c
|
||||
\|', which is explicitly identified (`\|\c
|
||||
.B \-m\c
|
||||
\|') as a Vax object
|
||||
file in the format produced by Oasys compilers. You can list the
|
||||
formats available with the `\|\c
|
||||
.B \-i\c
|
||||
\|' option.
|
||||
|
||||
.TP
|
||||
.B \-C
|
||||
.TP
|
||||
.B \-\-demangle
|
||||
Decode (\fIdemangle\fP) low-level symbol names into user-level names.
|
||||
Besides removing any initial underscore prepended by the system, this
|
||||
makes C++ function names readable.
|
||||
|
||||
.TP
|
||||
.B \-\-debugging
|
||||
Display debugging information. This attempts to parse debugging
|
||||
information stored in the file and print it out using a C like syntax.
|
||||
Only certain types of debugging information have been implemented.
|
||||
|
||||
.TP
|
||||
.B \-d
|
||||
.TP
|
||||
.B \-\-disassemble
|
||||
Display the assembler mnemonics for the machine
|
||||
instructions from \c
|
||||
.I objfile\c
|
||||
\&.
|
||||
This option only disassembles those sections which are
|
||||
expected to contain instructions.
|
||||
|
||||
.TP
|
||||
.B \-D
|
||||
.TP
|
||||
.B \-\-disassemble-all
|
||||
Like \fB\-d\fP, but disassemble the contents of all sections, not just
|
||||
those expected to contain instructions.
|
||||
|
||||
.TP
|
||||
.B \-\-prefix\-addresses
|
||||
When disassembling, print the complete address on each line. This is
|
||||
the older disassembly format.
|
||||
|
||||
.TP
|
||||
.B \-\-disassemble\-zeroes
|
||||
Normally the disassembly output will skip blocks of zeroes. This
|
||||
option directs the disassembler to disassemble those blocks, just like
|
||||
any other data.
|
||||
|
||||
.TP
|
||||
.B \-EB
|
||||
.TP
|
||||
.B \-EL
|
||||
.TP
|
||||
.BI "\-\-endian=" "{big|little}"
|
||||
Specify the endianness of the object files. This only affects
|
||||
disassembly. This can be useful when disassembling a file format which
|
||||
does not describe endianness information, such as S-records.
|
||||
|
||||
.TP
|
||||
.B \-f
|
||||
.TP
|
||||
.B \-\-file\-headers
|
||||
Display summary information from the overall header of
|
||||
each file in \c
|
||||
.I objfile\c
|
||||
\&.
|
||||
|
||||
.TP
|
||||
.B \-h
|
||||
.TP
|
||||
.B \-\-section\-headers
|
||||
.TP
|
||||
.B \-\-headers
|
||||
Display summary information from the section headers of the
|
||||
object file.
|
||||
|
||||
.TP
|
||||
.B \-\-help
|
||||
Print a summary of the options to
|
||||
.B objdump
|
||||
and exit.
|
||||
|
||||
.TP
|
||||
.B \-i
|
||||
.TP
|
||||
.B \-\-info
|
||||
Display a list showing all architectures and object formats available
|
||||
for specification with \c
|
||||
.B \-b\c
|
||||
\& or \c
|
||||
.B \-m\c
|
||||
\&.
|
||||
|
||||
.TP
|
||||
.BI "\-j " "name"\c
|
||||
.TP
|
||||
.BI "\-\-section=" "name"
|
||||
Display information only for section \c
|
||||
.I name\c
|
||||
\&.
|
||||
|
||||
.TP
|
||||
.B \-l
|
||||
.TP
|
||||
.B \-\-line\-numbers
|
||||
Label the display (using debugging information) with the filename
|
||||
and source line numbers corresponding to the object code shown.
|
||||
Only useful with \fB\-d\fP, \fB\-D\fP, or \fB\-r\fP.
|
||||
|
||||
.TP
|
||||
.BI "\-m " "machine"\c
|
||||
.TP
|
||||
.BI "\-\-architecture=" "machine"
|
||||
Specify the architecture to use when disassembling object files. This
|
||||
can be useful when disassembling object files which do not describe
|
||||
architecture information, such as S-records. You can list the available
|
||||
architectures with the \fB\-i\fP option.
|
||||
|
||||
.TP
|
||||
.B \-p
|
||||
.TP
|
||||
.B \-\-private\-headers
|
||||
Print information that is specific to the object file format. The
|
||||
exact information printed depends upon the object file format. For
|
||||
some object file formats, no additional information is printed.
|
||||
|
||||
.TP
|
||||
.B \-r
|
||||
.TP
|
||||
.B \-\-reloc
|
||||
Print the relocation entries of the file. If used with \fB\-d\fP or
|
||||
\fB\-D\fP, the relocations are printed interspersed with the
|
||||
disassembly.
|
||||
|
||||
.TP
|
||||
.B \-R
|
||||
.TP
|
||||
.B \-\-dynamic\-reloc
|
||||
Print the dynamic relocation entries of the file. This is only
|
||||
meaningful for dynamic objects, such as certain types of shared
|
||||
libraries.
|
||||
|
||||
.TP
|
||||
.B \-s
|
||||
.TP
|
||||
.B \-\-full\-contents
|
||||
Display the full contents of any sections requested.
|
||||
|
||||
.TP
|
||||
.B \-S
|
||||
.TP
|
||||
.B \-\-source
|
||||
Display source code intermixed with disassembly, if possible. Implies
|
||||
\fB-d\fP.
|
||||
|
||||
.TP
|
||||
.B \-\-show\-raw\-insn
|
||||
When disassembling instructions, print the instruction in hex as well as
|
||||
in symbolic form. This is the default except when
|
||||
.B \-\-prefix\-addresses
|
||||
is used.
|
||||
|
||||
.TP
|
||||
.B \-\-no\-show\-raw\-insn
|
||||
When disassembling instructions, do not print the instruction bytes.
|
||||
This is the default when
|
||||
.B \-\-prefix\-addresses
|
||||
is used.
|
||||
|
||||
.TP
|
||||
.B \-\-stabs
|
||||
Display the contents of the .stab, .stab.index, and .stab.excl
|
||||
sections from an ELF file. This is only useful on systems (such as
|
||||
Solaris 2.0) in which .stab debugging symbol-table entries are carried
|
||||
in an ELF section. In most other file formats, debugging symbol-table
|
||||
entries are interleaved with linkage symbols, and are visible in the
|
||||
.B \-\-syms
|
||||
output.
|
||||
|
||||
.TP
|
||||
.BI "\-\-start\-address=" "address"
|
||||
Start displaying data at the specified address. This affects the output
|
||||
of the
|
||||
.B \-d\c
|
||||
,
|
||||
.B \-r
|
||||
and
|
||||
.B \-s
|
||||
options.
|
||||
|
||||
.TP
|
||||
.BI "\-\-stop\-address=" "address"
|
||||
Stop displaying data at the specified address. This affects the output
|
||||
of the
|
||||
.B \-d\c
|
||||
,
|
||||
.B \-r
|
||||
and
|
||||
.B \-s
|
||||
options.
|
||||
|
||||
.TP
|
||||
.B \-t
|
||||
.TP
|
||||
.B \-\-syms
|
||||
Symbol Table. Print the symbol table entries of the file.
|
||||
This is similar to the information provided by the `\|\c
|
||||
.B nm\c
|
||||
\|' program.
|
||||
|
||||
.TP
|
||||
.B \-T
|
||||
.TP
|
||||
.B \-\-dynamic\-syms
|
||||
Dynamic Symbol Table. Print the dynamic symbol table entries of the
|
||||
file. This is only meaningful for dynamic objects, such as certain
|
||||
types of shared libraries. This is similar to the information
|
||||
provided by the `\|\c
|
||||
.B nm\c
|
||||
\|' program when given the
|
||||
.B \-D (\-\-dynamic)
|
||||
option.
|
||||
|
||||
.TP
|
||||
.B \-\-version
|
||||
Print the version number of
|
||||
.B objdump
|
||||
and exit.
|
||||
|
||||
.TP
|
||||
.B \-x
|
||||
.TP
|
||||
.B \-\-all\-headers
|
||||
Display all available header information, including the symbol table and
|
||||
relocation entries. Using `\|\c
|
||||
.B \-x\c
|
||||
\|' is equivalent to specifying all of
|
||||
`\|\c
|
||||
.B \-a \-f \-h \-r \-t\c
|
||||
\|'.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.RB "`\|" binutils "\|'"
|
||||
entry in
|
||||
.B
|
||||
info\c
|
||||
\&;
|
||||
.I
|
||||
The GNU Binary Utilities\c
|
||||
\&, Roland H. Pesch (October 1991);
|
||||
.BR nm "(" 1 ")."
|
||||
|
||||
.SH COPYING
|
||||
Copyright (c) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
|
||||
.PP
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
.PP
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the
|
||||
entire resulting derived work is distributed under the terms of a
|
||||
permission notice identical to this one.
|
||||
.PP
|
||||
Permission is granted to copy and distribute translations of this
|
||||
manual into another language, under the above conditions for modified
|
||||
versions, except that this permission notice may be included in
|
||||
translations approved by the Free Software Foundation instead of in
|
||||
the original English.
|
||||
2978
binutils/objdump.c
2978
binutils/objdump.c
File diff suppressed because it is too large
Load Diff
@@ -1,251 +0,0 @@
|
||||
# Makefile for program source directory in GNU NLS utilities package.
|
||||
# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
|
||||
#
|
||||
# This file file be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU Public License
|
||||
# but which still want to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code is *not* freely available.
|
||||
|
||||
PACKAGE = @PACKAGE@
|
||||
VERSION = @VERSION@
|
||||
|
||||
SHELL = /bin/sh
|
||||
@SET_MAKE@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
datadir = $(prefix)/@DATADIRNAME@
|
||||
localedir = $(datadir)/locale
|
||||
gnulocaledir = $(prefix)/share/locale
|
||||
gettextsrcdir = $(prefix)/share/gettext/po
|
||||
subdir = po
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
|
||||
CC = @CC@
|
||||
GENCAT = @GENCAT@
|
||||
GMSGFMT = PATH=../src:$$PATH @GMSGFMT@
|
||||
MSGFMT = @MSGFMT@
|
||||
XGETTEXT = PATH=../src:$$PATH @XGETTEXT@
|
||||
MSGMERGE = PATH=../src:$$PATH msgmerge
|
||||
|
||||
DEFS = @DEFS@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
|
||||
INCLUDES = -I.. -I$(top_srcdir)/intl
|
||||
|
||||
COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
|
||||
|
||||
SOURCES = cat-id-tbl.c
|
||||
POFILES = @POFILES@
|
||||
GMOFILES = @GMOFILES@
|
||||
DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
|
||||
stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
|
||||
|
||||
POTFILES = \
|
||||
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
|
||||
|
||||
.c.o:
|
||||
$(COMPILE) $<
|
||||
|
||||
.po.pox:
|
||||
$(MAKE) $(PACKAGE).pot
|
||||
$(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
|
||||
|
||||
.po.mo:
|
||||
$(MSGFMT) -o $@ $<
|
||||
|
||||
.po.gmo:
|
||||
file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
|
||||
&& rm -f $$file && $(GMSGFMT) -o $$file $<
|
||||
|
||||
.po.cat:
|
||||
sed -f ../intl/po2msg.sed < $< > $*.msg \
|
||||
&& rm -f $@ && $(GENCAT) $@ $*.msg
|
||||
|
||||
|
||||
all: all-@USE_NLS@
|
||||
|
||||
all-yes: $(CATALOGS) @MAINT@ $(PACKAGE).pot
|
||||
all-no:
|
||||
|
||||
$(srcdir)/$(PACKAGE).pot: $(POTFILES)
|
||||
$(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
|
||||
--add-comments --keyword=_ --keyword=N_ \
|
||||
--files-from=$(srcdir)/POTFILES.in
|
||||
rm -f $(srcdir)/$(PACKAGE).pot
|
||||
mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot
|
||||
|
||||
$(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
|
||||
$(srcdir)/stamp-cat-id: $(PACKAGE).pot
|
||||
rm -f cat-id-tbl.tmp
|
||||
sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
|
||||
| sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
|
||||
if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
|
||||
rm cat-id-tbl.tmp; \
|
||||
else \
|
||||
echo cat-id-tbl.c changed; \
|
||||
rm -f $(srcdir)/cat-id-tbl.c; \
|
||||
mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
|
||||
fi
|
||||
cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
|
||||
|
||||
|
||||
install: install-exec install-data
|
||||
install-exec:
|
||||
install-info:
|
||||
install-data: install-data-@USE_NLS@
|
||||
install-data-no: all
|
||||
install-data-yes: all
|
||||
if test -r $(MKINSTALLDIRS); then \
|
||||
$(MKINSTALLDIRS) $(datadir); \
|
||||
else \
|
||||
$(top_srcdir)/mkinstalldirs $(datadir); \
|
||||
fi
|
||||
@catalogs='$(CATALOGS)'; \
|
||||
for cat in $$catalogs; do \
|
||||
cat=`basename $$cat`; \
|
||||
case "$$cat" in \
|
||||
*.gmo) destdir=$(gnulocaledir);; \
|
||||
*) destdir=$(localedir);; \
|
||||
esac; \
|
||||
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
|
||||
dir=$$destdir/$$lang/LC_MESSAGES; \
|
||||
if test -r $(MKINSTALLDIRS); then \
|
||||
$(MKINSTALLDIRS) $$dir; \
|
||||
else \
|
||||
$(top_srcdir)/mkinstalldirs $$dir; \
|
||||
fi; \
|
||||
if test -r $$cat; then \
|
||||
$(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
|
||||
echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
|
||||
else \
|
||||
$(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
|
||||
echo "installing $(srcdir)/$$cat as" \
|
||||
"$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
|
||||
fi; \
|
||||
if test -r $$cat.m; then \
|
||||
$(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
|
||||
echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
|
||||
else \
|
||||
if test -r $(srcdir)/$$cat.m ; then \
|
||||
$(INSTALL_DATA) $(srcdir)/$$cat.m \
|
||||
$$dir/$(PACKAGE)$(INSTOBJEXT).m; \
|
||||
echo "installing $(srcdir)/$$cat as" \
|
||||
"$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
|
||||
else \
|
||||
true; \
|
||||
fi; \
|
||||
fi; \
|
||||
done
|
||||
if test "$(PACKAGE)" = "gettext"; then \
|
||||
if test -r $(MKINSTALLDIRS); then \
|
||||
$(MKINSTALLDIRS) $(gettextsrcdir); \
|
||||
else \
|
||||
$(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
|
||||
fi; \
|
||||
$(INSTALL_DATA) $(srcdir)/Makefile.in.in \
|
||||
$(gettextsrcdir)/Makefile.in.in; \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
|
||||
# Define this as empty until I found a useful application.
|
||||
installcheck:
|
||||
|
||||
uninstall:
|
||||
catalogs='$(CATALOGS)'; \
|
||||
for cat in $$catalogs; do \
|
||||
cat=`basename $$cat`; \
|
||||
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
|
||||
rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
|
||||
rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
|
||||
rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
|
||||
rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
|
||||
done
|
||||
rm -f $(gettextsrcdir)/po-Makefile.in.in
|
||||
|
||||
check: all
|
||||
|
||||
cat-id-tbl.o: ../intl/libgettext.h
|
||||
|
||||
dvi info tags TAGS ID:
|
||||
|
||||
mostlyclean:
|
||||
rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
|
||||
rm -fr *.o
|
||||
|
||||
clean: mostlyclean
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
|
||||
|
||||
maintainer-clean: distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
rm -f $(GMOFILES)
|
||||
|
||||
distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
dist distdir: update-po $(DISTFILES)
|
||||
dists="$(DISTFILES)"; \
|
||||
for file in $$dists; do \
|
||||
ln $(srcdir)/$$file $(distdir) 2> /dev/null \
|
||||
|| cp -p $(srcdir)/$$file $(distdir); \
|
||||
done
|
||||
|
||||
update-po: Makefile
|
||||
$(MAKE) $(PACKAGE).pot
|
||||
PATH=`pwd`/../src:$$PATH; \
|
||||
cd $(srcdir); \
|
||||
catalogs='$(CATALOGS)'; \
|
||||
for cat in $$catalogs; do \
|
||||
cat=`basename $$cat`; \
|
||||
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
|
||||
mv $$lang.po $$lang.old.po; \
|
||||
echo "$$lang:"; \
|
||||
if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
|
||||
rm -f $$lang.old.po; \
|
||||
else \
|
||||
echo "msgmerge for $$cat failed!"; \
|
||||
rm -f $$lang.po; \
|
||||
mv $$lang.old.po $$lang.po; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
POTFILES: POTFILES.in
|
||||
( if test 'x$(srcdir)' != 'x.'; then \
|
||||
posrcprefix='$(top_srcdir)/'; \
|
||||
else \
|
||||
posrcprefix="../"; \
|
||||
fi; \
|
||||
rm -f $@-t $@ \
|
||||
&& (sed -e '/^#/d' -e '/^[ ]*$$/d' \
|
||||
-e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
|
||||
| sed -e '$$s/\\$$//') > $@-t \
|
||||
&& chmod a-w $@-t \
|
||||
&& mv $@-t $@ )
|
||||
|
||||
POTFILES.in: @MAINT@ ../Makefile
|
||||
cd .. && $(MAKE) po/POTFILES.in
|
||||
|
||||
Makefile: Make-in ../config.status POTFILES
|
||||
cd .. \
|
||||
&& CONFIG_FILES=$(subdir)/Makefile.in:$(subdir)/Make-in \
|
||||
CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make not to export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
@@ -1,55 +0,0 @@
|
||||
addr2line.c
|
||||
ar.c
|
||||
arsup.c
|
||||
arsup.h
|
||||
bucomm.c
|
||||
bucomm.h
|
||||
budbg.h
|
||||
coffdump.c
|
||||
coffgrok.c
|
||||
coffgrok.h
|
||||
debug.c
|
||||
debug.c
|
||||
debug.h
|
||||
dlltool.c
|
||||
dlltool.h
|
||||
dllwrap.c
|
||||
dyn-string.c
|
||||
dyn-string.h
|
||||
filemode.c
|
||||
ieee.c
|
||||
ieee.c
|
||||
is-ranlib.c
|
||||
is-strip.c
|
||||
maybe-ranlib.c
|
||||
maybe-strip.c
|
||||
nlmconv.c
|
||||
nlmconv.h
|
||||
nm.c
|
||||
not-ranlib.c
|
||||
not-strip.c
|
||||
objcopy.c
|
||||
objdump.c
|
||||
prdbg.c
|
||||
rdcoff.c
|
||||
rdcoff.c
|
||||
rddbg.c
|
||||
rddbg.c
|
||||
readelf.c
|
||||
rename.c
|
||||
resbin.c
|
||||
rescoff.c
|
||||
resrc.c
|
||||
resres.c
|
||||
size.c
|
||||
srconv.c
|
||||
stabs.c
|
||||
stabs.c
|
||||
strings.c
|
||||
sysdump.c
|
||||
version.c
|
||||
windres.c
|
||||
windres.h
|
||||
winduni.c
|
||||
winduni.h
|
||||
wrstabs.c
|
||||
File diff suppressed because it is too large
Load Diff
1862
binutils/prdbg.c
1862
binutils/prdbg.c
File diff suppressed because it is too large
Load Diff
@@ -1,83 +0,0 @@
|
||||
.\" Copyright (c) 1991 Free Software Foundation
|
||||
.\" See section COPYING for conditions for redistribution
|
||||
.TH ranlib 1 "5 November 1991" "cygnus support" "GNU Development Tools"
|
||||
.de BP
|
||||
.sp
|
||||
.ti \-.2i
|
||||
\(**
|
||||
..
|
||||
|
||||
.SH NAME
|
||||
ranlib \- generate index to archive.
|
||||
|
||||
.SH SYNOPSIS
|
||||
.hy 0
|
||||
.na
|
||||
.B ranlib \c
|
||||
.RB "[\|" \-v | \-V "\|]"
|
||||
.I archive\c
|
||||
\&
|
||||
.ad b
|
||||
.hy 1
|
||||
.SH DESCRIPTION
|
||||
.B ranlib
|
||||
generates an index to the contents of an archive, and
|
||||
stores it in the archive. The index lists each symbol defined by a
|
||||
member of an archive that is a relocatable object file.
|
||||
.PP
|
||||
You may use
|
||||
.RB ` "nm \-s" '
|
||||
or
|
||||
.RB ` "nm \-\-print-armap" '
|
||||
to list this index.
|
||||
.PP
|
||||
An archive with such an index speeds up linking to the library, and
|
||||
allows routines in the library to call each other without regard to
|
||||
their placement in the archive.
|
||||
.PP
|
||||
The GNU
|
||||
.B ranlib
|
||||
program is another form of GNU
|
||||
.BR ar ;
|
||||
running
|
||||
.B ranlib
|
||||
is completely equivalent to executing
|
||||
.RB ` "ar \-s" '.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-v
|
||||
Print the version number of
|
||||
.B ranlib
|
||||
and exit.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.RB "`\|" binutils "\|'"
|
||||
entry in
|
||||
.B
|
||||
info\c
|
||||
\&;
|
||||
.I
|
||||
The GNU Binary Utilities\c
|
||||
\&, Roland H. Pesch (October 1991);
|
||||
.BR ar "(" 1 "),"
|
||||
.BR nm "(" 1 ")."
|
||||
|
||||
|
||||
.SH COPYING
|
||||
Copyright (c) 1991 Free Software Foundation, Inc.
|
||||
.PP
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
.PP
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the
|
||||
entire resulting derived work is distributed under the terms of a
|
||||
permission notice identical to this one.
|
||||
.PP
|
||||
Permission is granted to copy and distribute translations of this
|
||||
manual into another language, under the above conditions for modified
|
||||
versions, except that this permission notice may be included in
|
||||
translations approved by the Free Software Foundation instead of in
|
||||
the original English.
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
# A simple ranlib script, to use less disk space than a ranlib program.
|
||||
ar s $1
|
||||
496
binutils/rclex.l
496
binutils/rclex.l
@@ -1,496 +0,0 @@
|
||||
%{ /* rclex.l -- lexer for Windows rc files parser */
|
||||
/* Copyright 1997, 1998 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Cygnus Support.
|
||||
|
||||
This file is part of 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 2 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
/* This is a lex input file which generates a lexer used by the
|
||||
Windows rc file parser. It basically just recognized a bunch of
|
||||
keywords. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "bucomm.h"
|
||||
#include "libiberty.h"
|
||||
#include "windres.h"
|
||||
#include "rcparse.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
|
||||
/* Whether we are in rcdata mode, in which we returns the lengths of
|
||||
strings. */
|
||||
|
||||
static int rcdata_mode;
|
||||
|
||||
/* Whether we are supressing lines from cpp (including windows.h or
|
||||
headers from your C sources may bring in externs and typedefs).
|
||||
When active, we return IGNORED_TOKEN, which lets us ignore these
|
||||
outside of resource constructs. Thus, it isn't required to protect
|
||||
all the non-preprocessor lines in your header files with #ifdef
|
||||
RC_INVOKED. It also means your RC file can't include other RC
|
||||
files if they're named "*.h". Sorry. Name them *.rch or whatever. */
|
||||
|
||||
static int suppress_cpp_data;
|
||||
|
||||
#define MAYBE_RETURN(x) return suppress_cpp_data ? IGNORED_TOKEN : (x)
|
||||
|
||||
/* The first filename we detect in the cpp output. We use this to
|
||||
tell included files from the original file. */
|
||||
|
||||
static char *initial_fn;
|
||||
|
||||
/* List of allocated strings. */
|
||||
|
||||
struct alloc_string
|
||||
{
|
||||
struct alloc_string *next;
|
||||
char *s;
|
||||
};
|
||||
|
||||
static struct alloc_string *strings;
|
||||
|
||||
/* Local functions. */
|
||||
|
||||
static void cpp_line PARAMS ((const char *));
|
||||
static char *handle_quotes PARAMS ((const char *, unsigned long *));
|
||||
static char *get_string PARAMS ((int));
|
||||
|
||||
%}
|
||||
|
||||
%%
|
||||
|
||||
"BEGIN" { MAYBE_RETURN (BEG); }
|
||||
"{" { MAYBE_RETURN (BEG); }
|
||||
"END" { MAYBE_RETURN (END); }
|
||||
"}" { MAYBE_RETURN (END); }
|
||||
"ACCELERATORS" { MAYBE_RETURN (ACCELERATORS); }
|
||||
"VIRTKEY" { MAYBE_RETURN (VIRTKEY); }
|
||||
"ASCII" { MAYBE_RETURN (ASCII); }
|
||||
"NOINVERT" { MAYBE_RETURN (NOINVERT); }
|
||||
"SHIFT" { MAYBE_RETURN (SHIFT); }
|
||||
"CONTROL" { MAYBE_RETURN (CONTROL); }
|
||||
"ALT" { MAYBE_RETURN (ALT); }
|
||||
"BITMAP" { MAYBE_RETURN (BITMAP); }
|
||||
"CURSOR" { MAYBE_RETURN (CURSOR); }
|
||||
"DIALOG" { MAYBE_RETURN (DIALOG); }
|
||||
"DIALOGEX" { MAYBE_RETURN (DIALOGEX); }
|
||||
"EXSTYLE" { MAYBE_RETURN (EXSTYLE); }
|
||||
"CAPTION" { MAYBE_RETURN (CAPTION); }
|
||||
"CLASS" { MAYBE_RETURN (CLASS); }
|
||||
"STYLE" { MAYBE_RETURN (STYLE); }
|
||||
"AUTO3STATE" { MAYBE_RETURN (AUTO3STATE); }
|
||||
"AUTOCHECKBOX" { MAYBE_RETURN (AUTOCHECKBOX); }
|
||||
"AUTORADIOBUTTON" { MAYBE_RETURN (AUTORADIOBUTTON); }
|
||||
"CHECKBOX" { MAYBE_RETURN (CHECKBOX); }
|
||||
"COMBOBOX" { MAYBE_RETURN (COMBOBOX); }
|
||||
"CTEXT" { MAYBE_RETURN (CTEXT); }
|
||||
"DEFPUSHBUTTON" { MAYBE_RETURN (DEFPUSHBUTTON); }
|
||||
"EDITTEXT" { MAYBE_RETURN (EDITTEXT); }
|
||||
"GROUPBOX" { MAYBE_RETURN (GROUPBOX); }
|
||||
"LISTBOX" { MAYBE_RETURN (LISTBOX); }
|
||||
"LTEXT" { MAYBE_RETURN (LTEXT); }
|
||||
"PUSHBOX" { MAYBE_RETURN (PUSHBOX); }
|
||||
"PUSHBUTTON" { MAYBE_RETURN (PUSHBUTTON); }
|
||||
"RADIOBUTTON" { MAYBE_RETURN (RADIOBUTTON); }
|
||||
"RTEXT" { MAYBE_RETURN (RTEXT); }
|
||||
"SCROLLBAR" { MAYBE_RETURN (SCROLLBAR); }
|
||||
"STATE3" { MAYBE_RETURN (STATE3); }
|
||||
"USERBUTTON" { MAYBE_RETURN (USERBUTTON); }
|
||||
"BEDIT" { MAYBE_RETURN (BEDIT); }
|
||||
"HEDIT" { MAYBE_RETURN (HEDIT); }
|
||||
"IEDIT" { MAYBE_RETURN (IEDIT); }
|
||||
"FONT" { MAYBE_RETURN (FONT); }
|
||||
"ICON" { MAYBE_RETURN (ICON); }
|
||||
"LANGUAGE" { MAYBE_RETURN (LANGUAGE); }
|
||||
"CHARACTERISTICS" { MAYBE_RETURN (CHARACTERISTICS); }
|
||||
"VERSION" { MAYBE_RETURN (VERSIONK); }
|
||||
"MENU" { MAYBE_RETURN (MENU); }
|
||||
"MENUEX" { MAYBE_RETURN (MENUEX); }
|
||||
"MENUITEM" { MAYBE_RETURN (MENUITEM); }
|
||||
"SEPARATOR" { MAYBE_RETURN (SEPARATOR); }
|
||||
"POPUP" { MAYBE_RETURN (POPUP); }
|
||||
"CHECKED" { MAYBE_RETURN (CHECKED); }
|
||||
"GRAYED" { MAYBE_RETURN (GRAYED); }
|
||||
"HELP" { MAYBE_RETURN (HELP); }
|
||||
"INACTIVE" { MAYBE_RETURN (INACTIVE); }
|
||||
"MENUBARBREAK" { MAYBE_RETURN (MENUBARBREAK); }
|
||||
"MENUBREAK" { MAYBE_RETURN (MENUBREAK); }
|
||||
"MESSAGETABLE" { MAYBE_RETURN (MESSAGETABLE); }
|
||||
"RCDATA" { MAYBE_RETURN (RCDATA); }
|
||||
"STRINGTABLE" { MAYBE_RETURN (STRINGTABLE); }
|
||||
"VERSIONINFO" { MAYBE_RETURN (VERSIONINFO); }
|
||||
"FILEVERSION" { MAYBE_RETURN (FILEVERSION); }
|
||||
"PRODUCTVERSION" { MAYBE_RETURN (PRODUCTVERSION); }
|
||||
"FILEFLAGSMASK" { MAYBE_RETURN (FILEFLAGSMASK); }
|
||||
"FILEFLAGS" { MAYBE_RETURN (FILEFLAGS); }
|
||||
"FILEOS" { MAYBE_RETURN (FILEOS); }
|
||||
"FILETYPE" { MAYBE_RETURN (FILETYPE); }
|
||||
"FILESUBTYPE" { MAYBE_RETURN (FILESUBTYPE); }
|
||||
"VALUE" { MAYBE_RETURN (VALUE); }
|
||||
"MOVEABLE" { MAYBE_RETURN (MOVEABLE); }
|
||||
"FIXED" { MAYBE_RETURN (FIXED); }
|
||||
"PURE" { MAYBE_RETURN (PURE); }
|
||||
"IMPURE" { MAYBE_RETURN (IMPURE); }
|
||||
"PRELOAD" { MAYBE_RETURN (PRELOAD); }
|
||||
"LOADONCALL" { MAYBE_RETURN (LOADONCALL); }
|
||||
"DISCARDABLE" { MAYBE_RETURN (DISCARDABLE); }
|
||||
"NOT" { MAYBE_RETURN (NOT); }
|
||||
|
||||
"BLOCK"[ \t\n]*"\""[^\#\n]*"\"" {
|
||||
char *s, *send;
|
||||
|
||||
/* This is a hack to let us parse version
|
||||
information easily. */
|
||||
|
||||
s = strchr (yytext, '"');
|
||||
++s;
|
||||
send = strchr (s, '"');
|
||||
if (strncmp (s, "StringFileInfo",
|
||||
sizeof "StringFileInfo" - 1) == 0
|
||||
&& s + sizeof "StringFileInfo" - 1 == send)
|
||||
MAYBE_RETURN (BLOCKSTRINGFILEINFO);
|
||||
else if (strncmp (s, "VarFileInfo",
|
||||
sizeof "VarFileInfo" - 1) == 0
|
||||
&& s + sizeof "VarFileInfo" - 1 == send)
|
||||
MAYBE_RETURN (BLOCKVARFILEINFO);
|
||||
else
|
||||
{
|
||||
char *r;
|
||||
|
||||
r = get_string (send - s + 1);
|
||||
strncpy (r, s, send - s);
|
||||
r[send - s] = '\0';
|
||||
yylval.s = r;
|
||||
MAYBE_RETURN (BLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
"#"[^\n]* {
|
||||
cpp_line (yytext);
|
||||
}
|
||||
|
||||
[0-9][x0-9A-Fa-f]*L {
|
||||
yylval.i.val = strtoul (yytext, 0, 0);
|
||||
yylval.i.dword = 1;
|
||||
MAYBE_RETURN (NUMBER);
|
||||
}
|
||||
|
||||
[0-9][x0-9A-Fa-f]* {
|
||||
yylval.i.val = strtoul (yytext, 0, 0);
|
||||
yylval.i.dword = 0;
|
||||
MAYBE_RETURN (NUMBER);
|
||||
}
|
||||
|
||||
("\""[^\"\n]*"\""[ \t]*)+ {
|
||||
char *s;
|
||||
unsigned long length;
|
||||
|
||||
s = handle_quotes (yytext, &length);
|
||||
if (! rcdata_mode)
|
||||
{
|
||||
yylval.s = s;
|
||||
MAYBE_RETURN (QUOTEDSTRING);
|
||||
}
|
||||
else
|
||||
{
|
||||
yylval.ss.length = length;
|
||||
yylval.ss.s = s;
|
||||
MAYBE_RETURN (SIZEDSTRING);
|
||||
}
|
||||
}
|
||||
|
||||
[A-Za-z][^ ,\t\r\n]* {
|
||||
char *s;
|
||||
|
||||
/* I rejected comma in a string in order to
|
||||
handle VIRTKEY, CONTROL in an accelerator
|
||||
resource. This means that an unquoted
|
||||
file name can not contain a comma. I
|
||||
don't know what rc permits. */
|
||||
|
||||
s = get_string (strlen (yytext) + 1);
|
||||
strcpy (s, yytext);
|
||||
yylval.s = s;
|
||||
MAYBE_RETURN (STRING);
|
||||
}
|
||||
|
||||
[\n] { ++rc_lineno; }
|
||||
[ \t\r]+ { /* ignore whitespace */ }
|
||||
. { MAYBE_RETURN (*yytext); }
|
||||
|
||||
%%
|
||||
#ifndef yywrap
|
||||
/* This is needed for some versions of lex. */
|
||||
int yywrap ()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Handle a C preprocessor line. */
|
||||
|
||||
static void
|
||||
cpp_line (s)
|
||||
const char *s;
|
||||
{
|
||||
int line;
|
||||
char *send, *fn;
|
||||
|
||||
++s;
|
||||
while (isspace ((unsigned char) *s))
|
||||
++s;
|
||||
|
||||
line = strtol (s, &send, 0);
|
||||
if (*send != '\0' && ! isspace ((unsigned char) *send))
|
||||
return;
|
||||
|
||||
/* Subtract 1 because we are about to count the newline. */
|
||||
rc_lineno = line - 1;
|
||||
|
||||
s = send;
|
||||
while (isspace ((unsigned char) *s))
|
||||
++s;
|
||||
|
||||
if (*s != '"')
|
||||
return;
|
||||
|
||||
++s;
|
||||
send = strchr (s, '"');
|
||||
if (send == NULL)
|
||||
return;
|
||||
|
||||
fn = (char *) xmalloc (send - s + 1);
|
||||
strncpy (fn, s, send - s);
|
||||
fn[send - s] = '\0';
|
||||
|
||||
free (rc_filename);
|
||||
rc_filename = fn;
|
||||
|
||||
if (!initial_fn)
|
||||
{
|
||||
initial_fn = xmalloc (strlen (fn) + 1);
|
||||
strcpy(initial_fn, fn);
|
||||
}
|
||||
|
||||
/* Allow the initial file, regardless of name. Suppress all other
|
||||
files if they end in ".h" (this allows included "*.rc") */
|
||||
if (strcmp (initial_fn, fn) == 0
|
||||
|| strcmp (fn + strlen (fn) - 2, ".h") != 0)
|
||||
suppress_cpp_data = 0;
|
||||
else
|
||||
suppress_cpp_data = 1;
|
||||
}
|
||||
|
||||
/* Handle a quoted string. The quotes are stripped. A pair of quotes
|
||||
in a string are turned into a single quote. Adjacent strings are
|
||||
merged separated by whitespace are merged, as in C. */
|
||||
|
||||
static char *
|
||||
handle_quotes (input, len)
|
||||
const char *input;
|
||||
unsigned long *len;
|
||||
{
|
||||
char *ret, *s;
|
||||
const char *t;
|
||||
int ch;
|
||||
|
||||
ret = get_string (strlen (input) + 1);
|
||||
|
||||
s = ret;
|
||||
t = input;
|
||||
if (*t == '"')
|
||||
++t;
|
||||
while (*t != '\0')
|
||||
{
|
||||
if (*t == '\\')
|
||||
{
|
||||
++t;
|
||||
switch (*t)
|
||||
{
|
||||
case '\0':
|
||||
rcparse_warning ("backslash at end of string");
|
||||
break;
|
||||
|
||||
case '\"':
|
||||
rcparse_warning ("use \"\" to put \" in a string");
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
*s++ = ESCAPE_A;
|
||||
++t;
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
*s++ = ESCAPE_B;
|
||||
++t;
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
*s++ = ESCAPE_F;
|
||||
++t;
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
*s++ = ESCAPE_N;
|
||||
++t;
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
*s++ = ESCAPE_R;
|
||||
++t;
|
||||
break;
|
||||
|
||||
case 't':
|
||||
*s++ = ESCAPE_T;
|
||||
++t;
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
*s++ = ESCAPE_V;
|
||||
++t;
|
||||
break;
|
||||
|
||||
case '\\':
|
||||
*s++ = *t++;
|
||||
break;
|
||||
|
||||
case '0': case '1': case '2': case '3':
|
||||
case '4': case '5': case '6': case '7':
|
||||
ch = *t - '0';
|
||||
++t;
|
||||
if (*t >= '0' && *t <= '7')
|
||||
{
|
||||
ch = (ch << 3) | (*t - '0');
|
||||
++t;
|
||||
if (*t >= '0' && *t <= '7')
|
||||
{
|
||||
ch = (ch << 3) | (*t - '0');
|
||||
++t;
|
||||
}
|
||||
}
|
||||
*s++ = ch;
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
++t;
|
||||
ch = 0;
|
||||
while (1)
|
||||
{
|
||||
if (*t >= '0' && *t <= '9')
|
||||
ch = (ch << 4) | (*t - '0');
|
||||
else if (*t >= 'a' && *t <= 'f')
|
||||
ch = (ch << 4) | (*t - 'a');
|
||||
else if (*t >= 'A' && *t <= 'F')
|
||||
ch = (ch << 4) | (*t - 'A');
|
||||
else
|
||||
break;
|
||||
++t;
|
||||
}
|
||||
*s++ = ch;
|
||||
break;
|
||||
|
||||
default:
|
||||
rcparse_warning ("unrecognized escape sequence");
|
||||
*s++ = '\\';
|
||||
*s++ = *t++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (*t != '"')
|
||||
*s++ = *t++;
|
||||
else if (t[1] == '\0')
|
||||
break;
|
||||
else if (t[1] == '"')
|
||||
{
|
||||
*s++ = '"';
|
||||
t += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
++t;
|
||||
assert (isspace ((unsigned char) *t));
|
||||
while (isspace ((unsigned char) *t))
|
||||
++t;
|
||||
if (*t == '\0')
|
||||
break;
|
||||
assert (*t == '"');
|
||||
++t;
|
||||
}
|
||||
}
|
||||
|
||||
*s = '\0';
|
||||
|
||||
*len = s - ret;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Allocate a string of a given length. */
|
||||
|
||||
static char *
|
||||
get_string (len)
|
||||
int len;
|
||||
{
|
||||
struct alloc_string *as;
|
||||
|
||||
as = (struct alloc_string *) xmalloc (sizeof *as);
|
||||
as->s = xmalloc (len);
|
||||
|
||||
as->next = strings;
|
||||
strings = as->next;
|
||||
|
||||
return as->s;
|
||||
}
|
||||
|
||||
/* Discard all the strings we have allocated. The parser calls this
|
||||
when it no longer needs them. */
|
||||
|
||||
void
|
||||
rcparse_discard_strings ()
|
||||
{
|
||||
struct alloc_string *as;
|
||||
|
||||
as = strings;
|
||||
while (as != NULL)
|
||||
{
|
||||
struct alloc_string *n;
|
||||
|
||||
free (as->s);
|
||||
n = as->next;
|
||||
free (as);
|
||||
as = n;
|
||||
}
|
||||
|
||||
strings = NULL;
|
||||
}
|
||||
|
||||
/* Enter rcdata mode. */
|
||||
|
||||
void
|
||||
rcparse_rcdata ()
|
||||
{
|
||||
rcdata_mode = 1;
|
||||
}
|
||||
|
||||
/* Go back to normal mode from rcdata mode. */
|
||||
|
||||
void
|
||||
rcparse_normal ()
|
||||
{
|
||||
rcdata_mode = 0;
|
||||
}
|
||||
1619
binutils/rcparse.y
1619
binutils/rcparse.y
File diff suppressed because it is too large
Load Diff
@@ -1,887 +0,0 @@
|
||||
/* stabs.c -- Parse COFF debugging information
|
||||
Copyright (C) 1996, 98, 99, 2000 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor <ian@cygnus.com>.
|
||||
|
||||
This file is part of 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 2 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
/* This file contains code which parses COFF debugging information. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "coff/internal.h"
|
||||
#include "bucomm.h"
|
||||
#include "libiberty.h"
|
||||
#include "demangle.h"
|
||||
#include "debug.h"
|
||||
#include "budbg.h"
|
||||
|
||||
/* FIXME: We should not need this BFD internal file. We need it for
|
||||
the N_BTMASK, etc., values. */
|
||||
#include "libcoff.h"
|
||||
|
||||
/* These macros extract the right mask and shifts for this BFD. They
|
||||
assume that there is a local variable named ABFD. This is so that
|
||||
macros like ISFCN and DECREF, from coff/internal.h, will work
|
||||
without modification. */
|
||||
#define N_BTMASK (coff_data (abfd)->local_n_btmask)
|
||||
#define N_BTSHFT (coff_data (abfd)->local_n_btshft)
|
||||
#define N_TMASK (coff_data (abfd)->local_n_tmask)
|
||||
#define N_TSHIFT (coff_data (abfd)->local_n_tshift)
|
||||
|
||||
/* This structure is used to hold the symbols, as well as the current
|
||||
location within the symbols. */
|
||||
|
||||
struct coff_symbols
|
||||
{
|
||||
/* The symbols. */
|
||||
asymbol **syms;
|
||||
/* The number of symbols. */
|
||||
long symcount;
|
||||
/* The index of the current symbol. */
|
||||
long symno;
|
||||
/* The index of the current symbol in the COFF symbol table (where
|
||||
each auxent counts as a symbol). */
|
||||
long coff_symno;
|
||||
};
|
||||
|
||||
/* The largest basic type we are prepared to handle. */
|
||||
|
||||
#define T_MAX (T_LNGDBL)
|
||||
|
||||
/* This structure is used to hold slots. */
|
||||
|
||||
struct coff_slots
|
||||
{
|
||||
/* Next set of slots. */
|
||||
struct coff_slots *next;
|
||||
/* Slots. */
|
||||
#define COFF_SLOTS (16)
|
||||
debug_type slots[COFF_SLOTS];
|
||||
};
|
||||
|
||||
/* This structure is used to map symbol indices to types. */
|
||||
|
||||
struct coff_types
|
||||
{
|
||||
/* Slots. */
|
||||
struct coff_slots *slots;
|
||||
/* Basic types. */
|
||||
debug_type basic[T_MAX + 1];
|
||||
};
|
||||
|
||||
static debug_type *coff_get_slot PARAMS ((struct coff_types *, int));
|
||||
static debug_type parse_coff_type
|
||||
PARAMS ((bfd *, struct coff_symbols *, struct coff_types *, long, int,
|
||||
union internal_auxent *, boolean, PTR));
|
||||
static debug_type parse_coff_base_type
|
||||
PARAMS ((bfd *, struct coff_symbols *, struct coff_types *, long, int,
|
||||
union internal_auxent *, PTR));
|
||||
static debug_type parse_coff_struct_type
|
||||
PARAMS ((bfd *, struct coff_symbols *, struct coff_types *, int,
|
||||
union internal_auxent *, PTR));
|
||||
static debug_type parse_coff_enum_type
|
||||
PARAMS ((bfd *, struct coff_symbols *, struct coff_types *,
|
||||
union internal_auxent *, PTR));
|
||||
static boolean parse_coff_symbol
|
||||
PARAMS ((bfd *, struct coff_types *, asymbol *, long,
|
||||
struct internal_syment *, PTR, debug_type, boolean));
|
||||
|
||||
/* Return the slot for a type. */
|
||||
|
||||
static debug_type *
|
||||
coff_get_slot (types, indx)
|
||||
struct coff_types *types;
|
||||
int indx;
|
||||
{
|
||||
struct coff_slots **pps;
|
||||
|
||||
pps = &types->slots;
|
||||
|
||||
while (indx >= COFF_SLOTS)
|
||||
{
|
||||
if (*pps == NULL)
|
||||
{
|
||||
*pps = (struct coff_slots *) xmalloc (sizeof **pps);
|
||||
memset (*pps, 0, sizeof **pps);
|
||||
}
|
||||
pps = &(*pps)->next;
|
||||
indx -= COFF_SLOTS;
|
||||
}
|
||||
|
||||
if (*pps == NULL)
|
||||
{
|
||||
*pps = (struct coff_slots *) xmalloc (sizeof **pps);
|
||||
memset (*pps, 0, sizeof **pps);
|
||||
}
|
||||
|
||||
return (*pps)->slots + indx;
|
||||
}
|
||||
|
||||
/* Parse a COFF type code in NTYPE. */
|
||||
|
||||
static debug_type
|
||||
parse_coff_type (abfd, symbols, types, coff_symno, ntype, pauxent, useaux,
|
||||
dhandle)
|
||||
bfd *abfd;
|
||||
struct coff_symbols *symbols;
|
||||
struct coff_types *types;
|
||||
long coff_symno;
|
||||
int ntype;
|
||||
union internal_auxent *pauxent;
|
||||
boolean useaux;
|
||||
PTR dhandle;
|
||||
{
|
||||
debug_type type;
|
||||
|
||||
if ((ntype & ~N_BTMASK) != 0)
|
||||
{
|
||||
int newtype;
|
||||
|
||||
newtype = DECREF (ntype);
|
||||
|
||||
if (ISPTR (ntype))
|
||||
{
|
||||
type = parse_coff_type (abfd, symbols, types, coff_symno, newtype,
|
||||
pauxent, useaux, dhandle);
|
||||
type = debug_make_pointer_type (dhandle, type);
|
||||
}
|
||||
else if (ISFCN (ntype))
|
||||
{
|
||||
type = parse_coff_type (abfd, symbols, types, coff_symno, newtype,
|
||||
pauxent, useaux, dhandle);
|
||||
type = debug_make_function_type (dhandle, type, (debug_type *) NULL,
|
||||
false);
|
||||
}
|
||||
else if (ISARY (ntype))
|
||||
{
|
||||
int n;
|
||||
|
||||
if (pauxent == NULL)
|
||||
n = 0;
|
||||
else
|
||||
{
|
||||
unsigned short *dim;
|
||||
int i;
|
||||
|
||||
/* FIXME: If pauxent->x_sym.x_tagndx.l == 0, gdb sets
|
||||
the c_naux field of the syment to 0. */
|
||||
|
||||
/* Move the dimensions down, so that the next array
|
||||
picks up the next one. */
|
||||
dim = pauxent->x_sym.x_fcnary.x_ary.x_dimen;
|
||||
n = dim[0];
|
||||
for (i = 0; *dim != 0 && i < DIMNUM - 1; i++, dim++)
|
||||
*dim = *(dim + 1);
|
||||
*dim = 0;
|
||||
}
|
||||
|
||||
type = parse_coff_type (abfd, symbols, types, coff_symno, newtype,
|
||||
pauxent, false, dhandle);
|
||||
type = debug_make_array_type (dhandle, type,
|
||||
parse_coff_base_type (abfd, symbols,
|
||||
types,
|
||||
coff_symno,
|
||||
T_INT,
|
||||
NULL, dhandle),
|
||||
0, n - 1, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
non_fatal (_("parse_coff_type: Bad type code 0x%x"), ntype);
|
||||
return DEBUG_TYPE_NULL;
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
if (pauxent != NULL && pauxent->x_sym.x_tagndx.l > 0)
|
||||
{
|
||||
debug_type *slot;
|
||||
|
||||
/* This is a reference to an existing type. FIXME: gdb checks
|
||||
that the class is not C_STRTAG, nor C_UNTAG, nor C_ENTAG. */
|
||||
slot = coff_get_slot (types, pauxent->x_sym.x_tagndx.l);
|
||||
if (*slot != DEBUG_TYPE_NULL)
|
||||
return *slot;
|
||||
else
|
||||
return debug_make_indirect_type (dhandle, slot, (const char *) NULL);
|
||||
}
|
||||
|
||||
/* If the aux entry has already been used for something, useaux will
|
||||
have been set to false, indicating that parse_coff_base_type
|
||||
should not use it. We need to do it this way, rather than simply
|
||||
passing pauxent as NULL, because we need to be able handle
|
||||
multiple array dimensions while still discarding pauxent after
|
||||
having handled all of them. */
|
||||
if (! useaux)
|
||||
pauxent = NULL;
|
||||
|
||||
return parse_coff_base_type (abfd, symbols, types, coff_symno, ntype,
|
||||
pauxent, dhandle);
|
||||
}
|
||||
|
||||
/* Parse a basic COFF type in NTYPE. */
|
||||
|
||||
static debug_type
|
||||
parse_coff_base_type (abfd, symbols, types, coff_symno, ntype, pauxent,
|
||||
dhandle)
|
||||
bfd *abfd;
|
||||
struct coff_symbols *symbols;
|
||||
struct coff_types *types;
|
||||
long coff_symno;
|
||||
int ntype;
|
||||
union internal_auxent *pauxent;
|
||||
PTR dhandle;
|
||||
{
|
||||
debug_type ret;
|
||||
boolean set_basic;
|
||||
const char *name;
|
||||
debug_type *slot;
|
||||
|
||||
if (ntype >= 0
|
||||
&& ntype <= T_MAX
|
||||
&& types->basic[ntype] != DEBUG_TYPE_NULL)
|
||||
return types->basic[ntype];
|
||||
|
||||
set_basic = true;
|
||||
name = NULL;
|
||||
|
||||
switch (ntype)
|
||||
{
|
||||
default:
|
||||
ret = debug_make_void_type (dhandle);
|
||||
break;
|
||||
|
||||
case T_NULL:
|
||||
case T_VOID:
|
||||
ret = debug_make_void_type (dhandle);
|
||||
name = "void";
|
||||
break;
|
||||
|
||||
case T_CHAR:
|
||||
ret = debug_make_int_type (dhandle, 1, false);
|
||||
name = "char";
|
||||
break;
|
||||
|
||||
case T_SHORT:
|
||||
ret = debug_make_int_type (dhandle, 2, false);
|
||||
name = "short";
|
||||
break;
|
||||
|
||||
case T_INT:
|
||||
/* FIXME: Perhaps the size should depend upon the architecture. */
|
||||
ret = debug_make_int_type (dhandle, 4, false);
|
||||
name = "int";
|
||||
break;
|
||||
|
||||
case T_LONG:
|
||||
ret = debug_make_int_type (dhandle, 4, false);
|
||||
name = "long";
|
||||
break;
|
||||
|
||||
case T_FLOAT:
|
||||
ret = debug_make_float_type (dhandle, 4);
|
||||
name = "float";
|
||||
break;
|
||||
|
||||
case T_DOUBLE:
|
||||
ret = debug_make_float_type (dhandle, 8);
|
||||
name = "double";
|
||||
break;
|
||||
|
||||
case T_LNGDBL:
|
||||
ret = debug_make_float_type (dhandle, 12);
|
||||
name = "long double";
|
||||
break;
|
||||
|
||||
case T_UCHAR:
|
||||
ret = debug_make_int_type (dhandle, 1, true);
|
||||
name = "unsigned char";
|
||||
break;
|
||||
|
||||
case T_USHORT:
|
||||
ret = debug_make_int_type (dhandle, 2, true);
|
||||
name = "unsigned short";
|
||||
break;
|
||||
|
||||
case T_UINT:
|
||||
ret = debug_make_int_type (dhandle, 4, true);
|
||||
name = "unsigned int";
|
||||
break;
|
||||
|
||||
case T_ULONG:
|
||||
ret = debug_make_int_type (dhandle, 4, true);
|
||||
name = "unsigned long";
|
||||
break;
|
||||
|
||||
case T_STRUCT:
|
||||
if (pauxent == NULL)
|
||||
ret = debug_make_struct_type (dhandle, true, 0,
|
||||
(debug_field *) NULL);
|
||||
else
|
||||
ret = parse_coff_struct_type (abfd, symbols, types, ntype, pauxent,
|
||||
dhandle);
|
||||
|
||||
slot = coff_get_slot (types, coff_symno);
|
||||
*slot = ret;
|
||||
|
||||
set_basic = false;
|
||||
break;
|
||||
|
||||
case T_UNION:
|
||||
if (pauxent == NULL)
|
||||
ret = debug_make_struct_type (dhandle, false, 0, (debug_field *) NULL);
|
||||
else
|
||||
ret = parse_coff_struct_type (abfd, symbols, types, ntype, pauxent,
|
||||
dhandle);
|
||||
|
||||
slot = coff_get_slot (types, coff_symno);
|
||||
*slot = ret;
|
||||
|
||||
set_basic = false;
|
||||
break;
|
||||
|
||||
case T_ENUM:
|
||||
if (pauxent == NULL)
|
||||
ret = debug_make_enum_type (dhandle, (const char **) NULL,
|
||||
(bfd_signed_vma *) NULL);
|
||||
else
|
||||
ret = parse_coff_enum_type (abfd, symbols, types, pauxent, dhandle);
|
||||
|
||||
slot = coff_get_slot (types, coff_symno);
|
||||
*slot = ret;
|
||||
|
||||
set_basic = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (name != NULL)
|
||||
ret = debug_name_type (dhandle, name, ret);
|
||||
|
||||
if (set_basic
|
||||
&& ntype >= 0
|
||||
&& ntype <= T_MAX)
|
||||
types->basic[ntype] = ret;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Parse a struct type. */
|
||||
|
||||
static debug_type
|
||||
parse_coff_struct_type (abfd, symbols, types, ntype, pauxent, dhandle)
|
||||
bfd *abfd;
|
||||
struct coff_symbols *symbols;
|
||||
struct coff_types *types;
|
||||
int ntype;
|
||||
union internal_auxent *pauxent;
|
||||
PTR dhandle;
|
||||
{
|
||||
long symend;
|
||||
int alloc;
|
||||
debug_field *fields;
|
||||
int count;
|
||||
boolean done;
|
||||
|
||||
symend = pauxent->x_sym.x_fcnary.x_fcn.x_endndx.l;
|
||||
|
||||
alloc = 10;
|
||||
fields = (debug_field *) xmalloc (alloc * sizeof *fields);
|
||||
count = 0;
|
||||
|
||||
done = false;
|
||||
while (! done
|
||||
&& symbols->coff_symno < symend
|
||||
&& symbols->symno < symbols->symcount)
|
||||
{
|
||||
asymbol *sym;
|
||||
long this_coff_symno;
|
||||
struct internal_syment syment;
|
||||
union internal_auxent auxent;
|
||||
union internal_auxent *psubaux;
|
||||
bfd_vma bitpos = 0, bitsize = 0;
|
||||
|
||||
sym = symbols->syms[symbols->symno];
|
||||
|
||||
if (! bfd_coff_get_syment (abfd, sym, &syment))
|
||||
{
|
||||
non_fatal (_("bfd_coff_get_syment failed: %s"),
|
||||
bfd_errmsg (bfd_get_error ()));
|
||||
return DEBUG_TYPE_NULL;
|
||||
}
|
||||
|
||||
this_coff_symno = symbols->coff_symno;
|
||||
|
||||
++symbols->symno;
|
||||
symbols->coff_symno += 1 + syment.n_numaux;
|
||||
|
||||
if (syment.n_numaux == 0)
|
||||
psubaux = NULL;
|
||||
else
|
||||
{
|
||||
if (! bfd_coff_get_auxent (abfd, sym, 0, &auxent))
|
||||
{
|
||||
non_fatal (_("bfd_coff_get_auxent failed: %s"),
|
||||
bfd_errmsg (bfd_get_error ()));
|
||||
return DEBUG_TYPE_NULL;
|
||||
}
|
||||
psubaux = &auxent;
|
||||
}
|
||||
|
||||
switch (syment.n_sclass)
|
||||
{
|
||||
case C_MOS:
|
||||
case C_MOU:
|
||||
bitpos = 8 * bfd_asymbol_value (sym);
|
||||
bitsize = 0;
|
||||
break;
|
||||
|
||||
case C_FIELD:
|
||||
bitpos = bfd_asymbol_value (sym);
|
||||
bitsize = auxent.x_sym.x_misc.x_lnsz.x_size;
|
||||
break;
|
||||
|
||||
case C_EOS:
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (! done)
|
||||
{
|
||||
debug_type ftype;
|
||||
debug_field f;
|
||||
|
||||
ftype = parse_coff_type (abfd, symbols, types, this_coff_symno,
|
||||
syment.n_type, psubaux, true, dhandle);
|
||||
f = debug_make_field (dhandle, bfd_asymbol_name (sym), ftype,
|
||||
bitpos, bitsize, DEBUG_VISIBILITY_PUBLIC);
|
||||
if (f == DEBUG_FIELD_NULL)
|
||||
return DEBUG_TYPE_NULL;
|
||||
|
||||
if (count + 1 >= alloc)
|
||||
{
|
||||
alloc += 10;
|
||||
fields = ((debug_field *)
|
||||
xrealloc (fields, alloc * sizeof *fields));
|
||||
}
|
||||
|
||||
fields[count] = f;
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
fields[count] = DEBUG_FIELD_NULL;
|
||||
|
||||
return debug_make_struct_type (dhandle, ntype == T_STRUCT,
|
||||
pauxent->x_sym.x_misc.x_lnsz.x_size,
|
||||
fields);
|
||||
}
|
||||
|
||||
/* Parse an enum type. */
|
||||
|
||||
static debug_type
|
||||
parse_coff_enum_type (abfd, symbols, types, pauxent, dhandle)
|
||||
bfd *abfd;
|
||||
struct coff_symbols *symbols;
|
||||
struct coff_types *types ATTRIBUTE_UNUSED;
|
||||
union internal_auxent *pauxent;
|
||||
PTR dhandle;
|
||||
{
|
||||
long symend;
|
||||
int alloc;
|
||||
const char **names;
|
||||
bfd_signed_vma *vals;
|
||||
int count;
|
||||
boolean done;
|
||||
|
||||
symend = pauxent->x_sym.x_fcnary.x_fcn.x_endndx.l;
|
||||
|
||||
alloc = 10;
|
||||
names = (const char **) xmalloc (alloc * sizeof *names);
|
||||
vals = (bfd_signed_vma *) xmalloc (alloc * sizeof *vals);
|
||||
count = 0;
|
||||
|
||||
done = false;
|
||||
while (! done
|
||||
&& symbols->coff_symno < symend
|
||||
&& symbols->symno < symbols->symcount)
|
||||
{
|
||||
asymbol *sym;
|
||||
struct internal_syment syment;
|
||||
|
||||
sym = symbols->syms[symbols->symno];
|
||||
|
||||
if (! bfd_coff_get_syment (abfd, sym, &syment))
|
||||
{
|
||||
non_fatal (_("bfd_coff_get_syment failed: %s"),
|
||||
bfd_errmsg (bfd_get_error ()));
|
||||
return DEBUG_TYPE_NULL;
|
||||
}
|
||||
|
||||
++symbols->symno;
|
||||
symbols->coff_symno += 1 + syment.n_numaux;
|
||||
|
||||
switch (syment.n_sclass)
|
||||
{
|
||||
case C_MOE:
|
||||
if (count + 1 >= alloc)
|
||||
{
|
||||
alloc += 10;
|
||||
names = ((const char **)
|
||||
xrealloc (names, alloc * sizeof *names));
|
||||
vals = ((bfd_signed_vma *)
|
||||
xrealloc (vals, alloc * sizeof *vals));
|
||||
}
|
||||
|
||||
names[count] = bfd_asymbol_name (sym);
|
||||
vals[count] = bfd_asymbol_value (sym);
|
||||
++count;
|
||||
break;
|
||||
|
||||
case C_EOS:
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
names[count] = NULL;
|
||||
|
||||
return debug_make_enum_type (dhandle, names, vals);
|
||||
}
|
||||
|
||||
/* Handle a single COFF symbol. */
|
||||
|
||||
static boolean
|
||||
parse_coff_symbol (abfd, types, sym, coff_symno, psyment, dhandle, type,
|
||||
within_function)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
struct coff_types *types;
|
||||
asymbol *sym;
|
||||
long coff_symno;
|
||||
struct internal_syment *psyment;
|
||||
PTR dhandle;
|
||||
debug_type type;
|
||||
boolean within_function;
|
||||
{
|
||||
switch (psyment->n_sclass)
|
||||
{
|
||||
case C_NULL:
|
||||
break;
|
||||
|
||||
case C_AUTO:
|
||||
if (! debug_record_variable (dhandle, bfd_asymbol_name (sym), type,
|
||||
DEBUG_LOCAL, bfd_asymbol_value (sym)))
|
||||
return false;
|
||||
break;
|
||||
|
||||
case C_EXT:
|
||||
if (! debug_record_variable (dhandle, bfd_asymbol_name (sym), type,
|
||||
DEBUG_GLOBAL, bfd_asymbol_value (sym)))
|
||||
return false;
|
||||
break;
|
||||
|
||||
case C_STAT:
|
||||
if (! debug_record_variable (dhandle, bfd_asymbol_name (sym), type,
|
||||
(within_function
|
||||
? DEBUG_LOCAL_STATIC
|
||||
: DEBUG_STATIC),
|
||||
bfd_asymbol_value (sym)))
|
||||
return false;
|
||||
break;
|
||||
|
||||
case C_REG:
|
||||
/* FIXME: We may need to convert the register number. */
|
||||
if (! debug_record_variable (dhandle, bfd_asymbol_name (sym), type,
|
||||
DEBUG_REGISTER, bfd_asymbol_value (sym)))
|
||||
return false;
|
||||
break;
|
||||
|
||||
case C_LABEL:
|
||||
break;
|
||||
|
||||
case C_ARG:
|
||||
if (! debug_record_parameter (dhandle, bfd_asymbol_name (sym), type,
|
||||
DEBUG_PARM_STACK, bfd_asymbol_value (sym)))
|
||||
return false;
|
||||
break;
|
||||
|
||||
case C_REGPARM:
|
||||
/* FIXME: We may need to convert the register number. */
|
||||
if (! debug_record_parameter (dhandle, bfd_asymbol_name (sym), type,
|
||||
DEBUG_PARM_REG, bfd_asymbol_value (sym)))
|
||||
return false;
|
||||
break;
|
||||
|
||||
case C_TPDEF:
|
||||
type = debug_name_type (dhandle, bfd_asymbol_name (sym), type);
|
||||
if (type == DEBUG_TYPE_NULL)
|
||||
return false;
|
||||
break;
|
||||
|
||||
case C_STRTAG:
|
||||
case C_UNTAG:
|
||||
case C_ENTAG:
|
||||
{
|
||||
debug_type *slot;
|
||||
|
||||
type = debug_tag_type (dhandle, bfd_asymbol_name (sym), type);
|
||||
if (type == DEBUG_TYPE_NULL)
|
||||
return false;
|
||||
|
||||
/* Store the named type into the slot, so that references get
|
||||
the name. */
|
||||
slot = coff_get_slot (types, coff_symno);
|
||||
*slot = type;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* This is the main routine. It looks through all the symbols and
|
||||
handles them. */
|
||||
|
||||
boolean
|
||||
parse_coff (abfd, syms, symcount, dhandle)
|
||||
bfd *abfd;
|
||||
asymbol **syms;
|
||||
long symcount;
|
||||
PTR dhandle;
|
||||
{
|
||||
struct coff_symbols symbols;
|
||||
struct coff_types types;
|
||||
int i;
|
||||
long next_c_file;
|
||||
const char *fnname;
|
||||
int fnclass;
|
||||
int fntype;
|
||||
bfd_vma fnend;
|
||||
alent *linenos;
|
||||
boolean within_function;
|
||||
long this_coff_symno;
|
||||
|
||||
symbols.syms = syms;
|
||||
symbols.symcount = symcount;
|
||||
symbols.symno = 0;
|
||||
symbols.coff_symno = 0;
|
||||
|
||||
types.slots = NULL;
|
||||
for (i = 0; i <= T_MAX; i++)
|
||||
types.basic[i] = DEBUG_TYPE_NULL;
|
||||
|
||||
next_c_file = -1;
|
||||
fnname = NULL;
|
||||
fnclass = 0;
|
||||
fntype = 0;
|
||||
fnend = 0;
|
||||
linenos = NULL;
|
||||
within_function = false;
|
||||
|
||||
while (symbols.symno < symcount)
|
||||
{
|
||||
asymbol *sym;
|
||||
const char *name;
|
||||
struct internal_syment syment;
|
||||
union internal_auxent auxent;
|
||||
union internal_auxent *paux;
|
||||
debug_type type;
|
||||
|
||||
sym = syms[symbols.symno];
|
||||
|
||||
if (! bfd_coff_get_syment (abfd, sym, &syment))
|
||||
{
|
||||
non_fatal (_("bfd_coff_get_syment failed: %s"),
|
||||
bfd_errmsg (bfd_get_error ()));
|
||||
return false;
|
||||
}
|
||||
|
||||
name = bfd_asymbol_name (sym);
|
||||
|
||||
this_coff_symno = symbols.coff_symno;
|
||||
|
||||
++symbols.symno;
|
||||
symbols.coff_symno += 1 + syment.n_numaux;
|
||||
|
||||
/* We only worry about the first auxent, because that is the
|
||||
only one which is relevant for debugging information. */
|
||||
if (syment.n_numaux == 0)
|
||||
paux = NULL;
|
||||
else
|
||||
{
|
||||
if (! bfd_coff_get_auxent (abfd, sym, 0, &auxent))
|
||||
{
|
||||
non_fatal (_("bfd_coff_get_auxent failed: %s"),
|
||||
bfd_errmsg (bfd_get_error ()));
|
||||
return false;
|
||||
}
|
||||
paux = &auxent;
|
||||
}
|
||||
|
||||
if (this_coff_symno == next_c_file && syment.n_sclass != C_FILE)
|
||||
{
|
||||
/* The last C_FILE symbol points to the first external
|
||||
symbol. */
|
||||
if (! debug_set_filename (dhandle, "*globals*"))
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (syment.n_sclass)
|
||||
{
|
||||
case C_EFCN:
|
||||
case C_EXTDEF:
|
||||
case C_ULABEL:
|
||||
case C_USTATIC:
|
||||
case C_LINE:
|
||||
case C_ALIAS:
|
||||
case C_HIDDEN:
|
||||
/* Just ignore these classes. */
|
||||
break;
|
||||
|
||||
case C_FILE:
|
||||
next_c_file = syment.n_value;
|
||||
if (! debug_set_filename (dhandle, name))
|
||||
return false;
|
||||
break;
|
||||
|
||||
case C_STAT:
|
||||
/* Ignore static symbols with a type of T_NULL. These
|
||||
represent section entries. */
|
||||
if (syment.n_type == T_NULL)
|
||||
break;
|
||||
/* Fall through. */
|
||||
case C_EXT:
|
||||
if (ISFCN (syment.n_type))
|
||||
{
|
||||
fnname = name;
|
||||
fnclass = syment.n_sclass;
|
||||
fntype = syment.n_type;
|
||||
if (syment.n_numaux > 0)
|
||||
fnend = bfd_asymbol_value (sym) + auxent.x_sym.x_misc.x_fsize;
|
||||
else
|
||||
fnend = 0;
|
||||
linenos = BFD_SEND (abfd, _get_lineno, (abfd, sym));
|
||||
break;
|
||||
}
|
||||
type = parse_coff_type (abfd, &symbols, &types, this_coff_symno,
|
||||
syment.n_type, paux, true, dhandle);
|
||||
if (type == DEBUG_TYPE_NULL)
|
||||
return false;
|
||||
if (! parse_coff_symbol (abfd, &types, sym, this_coff_symno, &syment,
|
||||
dhandle, type, within_function))
|
||||
return false;
|
||||
break;
|
||||
|
||||
case C_FCN:
|
||||
if (strcmp (name, ".bf") == 0)
|
||||
{
|
||||
if (fnname == NULL)
|
||||
{
|
||||
non_fatal (_("%ld: .bf without preceding function"),
|
||||
this_coff_symno);
|
||||
return false;
|
||||
}
|
||||
|
||||
type = parse_coff_type (abfd, &symbols, &types, this_coff_symno,
|
||||
DECREF (fntype), paux, false, dhandle);
|
||||
if (type == DEBUG_TYPE_NULL)
|
||||
return false;
|
||||
|
||||
if (! debug_record_function (dhandle, fnname, type,
|
||||
fnclass == C_EXT,
|
||||
bfd_asymbol_value (sym)))
|
||||
return false;
|
||||
|
||||
if (linenos != NULL)
|
||||
{
|
||||
int base;
|
||||
bfd_vma addr;
|
||||
|
||||
if (syment.n_numaux == 0)
|
||||
base = 0;
|
||||
else
|
||||
base = auxent.x_sym.x_misc.x_lnsz.x_lnno - 1;
|
||||
|
||||
addr = bfd_get_section_vma (abfd, bfd_get_section (sym));
|
||||
|
||||
++linenos;
|
||||
|
||||
while (linenos->line_number != 0)
|
||||
{
|
||||
if (! debug_record_line (dhandle,
|
||||
linenos->line_number + base,
|
||||
linenos->u.offset + addr))
|
||||
return false;
|
||||
++linenos;
|
||||
}
|
||||
}
|
||||
|
||||
fnname = NULL;
|
||||
linenos = NULL;
|
||||
fnclass = 0;
|
||||
fntype = 0;
|
||||
|
||||
within_function = true;
|
||||
}
|
||||
else if (strcmp (name, ".ef") == 0)
|
||||
{
|
||||
if (! within_function)
|
||||
{
|
||||
non_fatal (_("%ld: unexpected .ef\n"), this_coff_symno);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (bfd_asymbol_value (sym) > fnend)
|
||||
fnend = bfd_asymbol_value (sym);
|
||||
if (! debug_end_function (dhandle, fnend))
|
||||
return false;
|
||||
|
||||
fnend = 0;
|
||||
within_function = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case C_BLOCK:
|
||||
if (strcmp (name, ".bb") == 0)
|
||||
{
|
||||
if (! debug_start_block (dhandle, bfd_asymbol_value (sym)))
|
||||
return false;
|
||||
}
|
||||
else if (strcmp (name, ".eb") == 0)
|
||||
{
|
||||
if (! debug_end_block (dhandle, bfd_asymbol_value (sym)))
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
type = parse_coff_type (abfd, &symbols, &types, this_coff_symno,
|
||||
syment.n_type, paux, true, dhandle);
|
||||
if (type == DEBUG_TYPE_NULL)
|
||||
return false;
|
||||
if (! parse_coff_symbol (abfd, &types, sym, this_coff_symno, &syment,
|
||||
dhandle, type, within_function))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
458
binutils/rddbg.c
458
binutils/rddbg.c
@@ -1,458 +0,0 @@
|
||||
/* rddbg.c -- Read debugging information into a generic form.
|
||||
Copyright (C) 1995, 96, 97, 98, 2000 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor <ian@cygnus.com>.
|
||||
|
||||
This file is part of 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 2 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
/* This file reads debugging information into a generic form. This
|
||||
file knows how to dig the debugging information out of an object
|
||||
file. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "bucomm.h"
|
||||
#include "libiberty.h"
|
||||
#include "debug.h"
|
||||
#include "budbg.h"
|
||||
|
||||
static boolean read_section_stabs_debugging_info
|
||||
PARAMS ((bfd *, asymbol **, long, PTR, boolean *));
|
||||
static boolean read_symbol_stabs_debugging_info
|
||||
PARAMS ((bfd *, asymbol **, long, PTR, boolean *));
|
||||
static boolean read_ieee_debugging_info PARAMS ((bfd *, PTR, boolean *));
|
||||
static void save_stab PARAMS ((int, int, bfd_vma, const char *));
|
||||
static void stab_context PARAMS ((void));
|
||||
static void free_saved_stabs PARAMS ((void));
|
||||
|
||||
/* Read debugging information from a BFD. Returns a generic debugging
|
||||
pointer. */
|
||||
|
||||
PTR
|
||||
read_debugging_info (abfd, syms, symcount)
|
||||
bfd *abfd;
|
||||
asymbol **syms;
|
||||
long symcount;
|
||||
{
|
||||
PTR dhandle;
|
||||
boolean found;
|
||||
|
||||
dhandle = debug_init ();
|
||||
if (dhandle == NULL)
|
||||
return NULL;
|
||||
|
||||
if (! read_section_stabs_debugging_info (abfd, syms, symcount, dhandle,
|
||||
&found))
|
||||
return NULL;
|
||||
|
||||
if (bfd_get_flavour (abfd) == bfd_target_aout_flavour)
|
||||
{
|
||||
if (! read_symbol_stabs_debugging_info (abfd, syms, symcount, dhandle,
|
||||
&found))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (bfd_get_flavour (abfd) == bfd_target_ieee_flavour)
|
||||
{
|
||||
if (! read_ieee_debugging_info (abfd, dhandle, &found))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Try reading the COFF symbols if we didn't find any stabs in COFF
|
||||
sections. */
|
||||
if (! found
|
||||
&& bfd_get_flavour (abfd) == bfd_target_coff_flavour
|
||||
&& symcount > 0)
|
||||
{
|
||||
if (! parse_coff (abfd, syms, symcount, dhandle))
|
||||
return NULL;
|
||||
found = true;
|
||||
}
|
||||
|
||||
if (! found)
|
||||
{
|
||||
non_fatal (_("%s: no recognized debugging information"),
|
||||
bfd_get_filename (abfd));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return dhandle;
|
||||
}
|
||||
|
||||
/* Read stabs in sections debugging information from a BFD. */
|
||||
|
||||
static boolean
|
||||
read_section_stabs_debugging_info (abfd, syms, symcount, dhandle, pfound)
|
||||
bfd *abfd;
|
||||
asymbol **syms;
|
||||
long symcount;
|
||||
PTR dhandle;
|
||||
boolean *pfound;
|
||||
{
|
||||
static struct
|
||||
{
|
||||
const char *secname;
|
||||
const char *strsecname;
|
||||
} names[] = { { ".stab", ".stabstr" } };
|
||||
unsigned int i;
|
||||
PTR shandle;
|
||||
|
||||
*pfound = false;
|
||||
shandle = NULL;
|
||||
|
||||
for (i = 0; i < sizeof names / sizeof names[0]; i++)
|
||||
{
|
||||
asection *sec, *strsec;
|
||||
|
||||
sec = bfd_get_section_by_name (abfd, names[i].secname);
|
||||
strsec = bfd_get_section_by_name (abfd, names[i].strsecname);
|
||||
if (sec != NULL && strsec != NULL)
|
||||
{
|
||||
bfd_size_type stabsize, strsize;
|
||||
bfd_byte *stabs, *strings;
|
||||
bfd_byte *stab;
|
||||
bfd_size_type stroff, next_stroff;
|
||||
|
||||
stabsize = bfd_section_size (abfd, sec);
|
||||
stabs = (bfd_byte *) xmalloc (stabsize);
|
||||
if (! bfd_get_section_contents (abfd, sec, stabs, 0, stabsize))
|
||||
{
|
||||
fprintf (stderr, "%s: %s: %s\n",
|
||||
bfd_get_filename (abfd), names[i].secname,
|
||||
bfd_errmsg (bfd_get_error ()));
|
||||
return false;
|
||||
}
|
||||
|
||||
strsize = bfd_section_size (abfd, strsec);
|
||||
strings = (bfd_byte *) xmalloc (strsize);
|
||||
if (! bfd_get_section_contents (abfd, strsec, strings, 0, strsize))
|
||||
{
|
||||
fprintf (stderr, "%s: %s: %s\n",
|
||||
bfd_get_filename (abfd), names[i].strsecname,
|
||||
bfd_errmsg (bfd_get_error ()));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (shandle == NULL)
|
||||
{
|
||||
shandle = start_stab (dhandle, abfd, true, syms, symcount);
|
||||
if (shandle == NULL)
|
||||
return false;
|
||||
}
|
||||
|
||||
*pfound = true;
|
||||
|
||||
stroff = 0;
|
||||
next_stroff = 0;
|
||||
for (stab = stabs; stab < stabs + stabsize; stab += 12)
|
||||
{
|
||||
unsigned int strx;
|
||||
int type;
|
||||
int other;
|
||||
int desc;
|
||||
bfd_vma value;
|
||||
|
||||
/* This code presumes 32 bit values. */
|
||||
|
||||
strx = bfd_get_32 (abfd, stab);
|
||||
type = bfd_get_8 (abfd, stab + 4);
|
||||
other = bfd_get_8 (abfd, stab + 5);
|
||||
desc = bfd_get_16 (abfd, stab + 6);
|
||||
value = bfd_get_32 (abfd, stab + 8);
|
||||
|
||||
if (type == 0)
|
||||
{
|
||||
/* Special type 0 stabs indicate the offset to the
|
||||
next string table. */
|
||||
stroff = next_stroff;
|
||||
next_stroff += value;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *f, *s;
|
||||
|
||||
f = NULL;
|
||||
|
||||
if (stroff + strx > strsize)
|
||||
{
|
||||
fprintf (stderr, "%s: %s: stab entry %d is corrupt, strx = 0x%x, type = %d\n",
|
||||
bfd_get_filename (abfd), names[i].secname,
|
||||
(stab - stabs) / 12, strx, type);
|
||||
continue;
|
||||
}
|
||||
|
||||
s = (char *) strings + stroff + strx;
|
||||
|
||||
while (s[strlen (s) - 1] == '\\'
|
||||
&& stab + 12 < stabs + stabsize)
|
||||
{
|
||||
char *p;
|
||||
|
||||
stab += 12;
|
||||
p = s + strlen (s) - 1;
|
||||
*p = '\0';
|
||||
s = concat (s,
|
||||
((char *) strings
|
||||
+ stroff
|
||||
+ bfd_get_32 (abfd, stab)),
|
||||
(const char *) NULL);
|
||||
|
||||
/* We have to restore the backslash, because, if
|
||||
the linker is hashing stabs strings, we may
|
||||
see the same string more than once. */
|
||||
*p = '\\';
|
||||
|
||||
if (f != NULL)
|
||||
free (f);
|
||||
f = s;
|
||||
}
|
||||
|
||||
save_stab (type, desc, value, s);
|
||||
|
||||
if (! parse_stab (dhandle, shandle, type, desc, value, s))
|
||||
{
|
||||
stab_context ();
|
||||
free_saved_stabs ();
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Don't free f, since I think the stabs code
|
||||
expects strings to hang around. This should be
|
||||
straightened out. FIXME. */
|
||||
}
|
||||
}
|
||||
|
||||
free_saved_stabs ();
|
||||
free (stabs);
|
||||
|
||||
/* Don't free strings, since I think the stabs code expects
|
||||
the strings to hang around. This should be straightened
|
||||
out. FIXME. */
|
||||
}
|
||||
}
|
||||
|
||||
if (shandle != NULL)
|
||||
{
|
||||
if (! finish_stab (dhandle, shandle))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Read stabs in the symbol table. */
|
||||
|
||||
static boolean
|
||||
read_symbol_stabs_debugging_info (abfd, syms, symcount, dhandle, pfound)
|
||||
bfd *abfd;
|
||||
asymbol **syms;
|
||||
long symcount;
|
||||
PTR dhandle;
|
||||
boolean *pfound;
|
||||
{
|
||||
PTR shandle;
|
||||
asymbol **ps, **symend;
|
||||
|
||||
shandle = NULL;
|
||||
symend = syms + symcount;
|
||||
for (ps = syms; ps < symend; ps++)
|
||||
{
|
||||
symbol_info i;
|
||||
|
||||
bfd_get_symbol_info (abfd, *ps, &i);
|
||||
|
||||
if (i.type == '-')
|
||||
{
|
||||
const char *s;
|
||||
char *f;
|
||||
|
||||
if (shandle == NULL)
|
||||
{
|
||||
shandle = start_stab (dhandle, abfd, false, syms, symcount);
|
||||
if (shandle == NULL)
|
||||
return false;
|
||||
}
|
||||
|
||||
*pfound = true;
|
||||
|
||||
s = i.name;
|
||||
f = NULL;
|
||||
while (s[strlen (s) - 1] == '\\'
|
||||
&& ps + 1 < symend)
|
||||
{
|
||||
char *sc, *n;
|
||||
|
||||
++ps;
|
||||
sc = xstrdup (s);
|
||||
sc[strlen (sc) - 1] = '\0';
|
||||
n = concat (sc, bfd_asymbol_name (*ps), (const char *) NULL);
|
||||
free (sc);
|
||||
if (f != NULL)
|
||||
free (f);
|
||||
f = n;
|
||||
s = n;
|
||||
}
|
||||
|
||||
save_stab (i.stab_type, i.stab_desc, i.value, s);
|
||||
|
||||
if (! parse_stab (dhandle, shandle, i.stab_type, i.stab_desc,
|
||||
i.value, s))
|
||||
{
|
||||
stab_context ();
|
||||
free_saved_stabs ();
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Don't free f, since I think the stabs code expects
|
||||
strings to hang around. This should be straightened out.
|
||||
FIXME. */
|
||||
}
|
||||
}
|
||||
|
||||
free_saved_stabs ();
|
||||
|
||||
if (shandle != NULL)
|
||||
{
|
||||
if (! finish_stab (dhandle, shandle))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Read IEEE debugging information. */
|
||||
|
||||
static boolean
|
||||
read_ieee_debugging_info (abfd, dhandle, pfound)
|
||||
bfd *abfd;
|
||||
PTR dhandle;
|
||||
boolean *pfound;
|
||||
{
|
||||
asection *dsec;
|
||||
bfd_size_type size;
|
||||
bfd_byte *contents;
|
||||
|
||||
/* The BFD backend puts the debugging information into a section
|
||||
named .debug. */
|
||||
|
||||
dsec = bfd_get_section_by_name (abfd, ".debug");
|
||||
if (dsec == NULL)
|
||||
return true;
|
||||
|
||||
size = bfd_section_size (abfd, dsec);
|
||||
contents = (bfd_byte *) xmalloc (size);
|
||||
if (! bfd_get_section_contents (abfd, dsec, contents, 0, size))
|
||||
return false;
|
||||
|
||||
if (! parse_ieee (dhandle, abfd, contents, size))
|
||||
return false;
|
||||
|
||||
free (contents);
|
||||
|
||||
*pfound = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Record stabs strings, so that we can give some context for errors. */
|
||||
|
||||
#define SAVE_STABS_COUNT (16)
|
||||
|
||||
struct saved_stab
|
||||
{
|
||||
int type;
|
||||
int desc;
|
||||
bfd_vma value;
|
||||
char *string;
|
||||
};
|
||||
|
||||
static struct saved_stab saved_stabs[SAVE_STABS_COUNT];
|
||||
static int saved_stabs_index;
|
||||
|
||||
/* Save a stabs string. */
|
||||
|
||||
static void
|
||||
save_stab (type, desc, value, string)
|
||||
int type;
|
||||
int desc;
|
||||
bfd_vma value;
|
||||
const char *string;
|
||||
{
|
||||
if (saved_stabs[saved_stabs_index].string != NULL)
|
||||
free (saved_stabs[saved_stabs_index].string);
|
||||
saved_stabs[saved_stabs_index].type = type;
|
||||
saved_stabs[saved_stabs_index].desc = desc;
|
||||
saved_stabs[saved_stabs_index].value = value;
|
||||
saved_stabs[saved_stabs_index].string = xstrdup (string);
|
||||
saved_stabs_index = (saved_stabs_index + 1) % SAVE_STABS_COUNT;
|
||||
}
|
||||
|
||||
/* Provide context for an error. */
|
||||
|
||||
static void
|
||||
stab_context ()
|
||||
{
|
||||
int i;
|
||||
|
||||
fprintf (stderr, _("Last stabs entries before error:\n"));
|
||||
fprintf (stderr, "n_type n_desc n_value string\n");
|
||||
|
||||
i = saved_stabs_index;
|
||||
do
|
||||
{
|
||||
struct saved_stab *stabp;
|
||||
|
||||
stabp = saved_stabs + i;
|
||||
if (stabp->string != NULL)
|
||||
{
|
||||
const char *s;
|
||||
|
||||
s = bfd_get_stab_name (stabp->type);
|
||||
if (s != NULL)
|
||||
fprintf (stderr, "%-6s", s);
|
||||
else if (stabp->type == 0)
|
||||
fprintf (stderr, "HdrSym");
|
||||
else
|
||||
fprintf (stderr, "%-6d", stabp->type);
|
||||
fprintf (stderr, " %-6d ", stabp->desc);
|
||||
fprintf_vma (stderr, stabp->value);
|
||||
if (stabp->type != 0)
|
||||
fprintf (stderr, " %s", stabp->string);
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
i = (i + 1) % SAVE_STABS_COUNT;
|
||||
}
|
||||
while (i != saved_stabs_index);
|
||||
}
|
||||
|
||||
/* Free the saved stab strings. */
|
||||
|
||||
static void
|
||||
free_saved_stabs ()
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < SAVE_STABS_COUNT; i++)
|
||||
{
|
||||
if (saved_stabs[i].string != NULL)
|
||||
{
|
||||
free (saved_stabs[i].string);
|
||||
saved_stabs[i].string = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
saved_stabs_index = 0;
|
||||
}
|
||||
7318
binutils/readelf.c
7318
binutils/readelf.c
File diff suppressed because it is too large
Load Diff
@@ -1,220 +0,0 @@
|
||||
/* rename.c -- rename a file, preserving symlinks.
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of 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 2 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "bucomm.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef HAVE_GOOD_UTIME_H
|
||||
#include <utime.h>
|
||||
#else /* ! HAVE_GOOD_UTIME_H */
|
||||
#ifdef HAVE_UTIMES
|
||||
#include <sys/time.h>
|
||||
#endif /* HAVE_UTIMES */
|
||||
#endif /* ! HAVE_GOOD_UTIME_H */
|
||||
|
||||
/* We need to open the file in binary modes on system where that makes
|
||||
a difference. */
|
||||
#ifndef O_BINARY
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
|
||||
static int simple_copy PARAMS ((const char *, const char *));
|
||||
|
||||
/* The number of bytes to copy at once. */
|
||||
#define COPY_BUF 8192
|
||||
|
||||
/* Copy file FROM to file TO, performing no translations.
|
||||
Return 0 if ok, -1 if error. */
|
||||
|
||||
static int
|
||||
simple_copy (from, to)
|
||||
const char *from;
|
||||
const char *to;
|
||||
{
|
||||
int fromfd, tofd, nread;
|
||||
int saved;
|
||||
char buf[COPY_BUF];
|
||||
|
||||
fromfd = open (from, O_RDONLY | O_BINARY);
|
||||
if (fromfd < 0)
|
||||
return -1;
|
||||
#ifdef O_CREAT
|
||||
tofd = open (to, O_CREAT | O_WRONLY | O_TRUNC | O_BINARY, 0777);
|
||||
#else
|
||||
tofd = creat (to, 0777);
|
||||
#endif
|
||||
if (tofd < 0)
|
||||
{
|
||||
saved = errno;
|
||||
close (fromfd);
|
||||
errno = saved;
|
||||
return -1;
|
||||
}
|
||||
while ((nread = read (fromfd, buf, sizeof buf)) > 0)
|
||||
{
|
||||
if (write (tofd, buf, nread) != nread)
|
||||
{
|
||||
saved = errno;
|
||||
close (fromfd);
|
||||
close (tofd);
|
||||
errno = saved;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
saved = errno;
|
||||
close (fromfd);
|
||||
close (tofd);
|
||||
if (nread < 0)
|
||||
{
|
||||
errno = saved;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Set the times of the file DESTINATION to be the same as those in
|
||||
STATBUF. */
|
||||
|
||||
void
|
||||
set_times (destination, statbuf)
|
||||
const char *destination;
|
||||
const struct stat *statbuf;
|
||||
{
|
||||
int result;
|
||||
|
||||
{
|
||||
#ifdef HAVE_GOOD_UTIME_H
|
||||
struct utimbuf tb;
|
||||
|
||||
tb.actime = statbuf->st_atime;
|
||||
tb.modtime = statbuf->st_mtime;
|
||||
result = utime (destination, &tb);
|
||||
#else /* ! HAVE_GOOD_UTIME_H */
|
||||
#ifndef HAVE_UTIMES
|
||||
long tb[2];
|
||||
|
||||
tb[0] = statbuf->st_atime;
|
||||
tb[1] = statbuf->st_mtime;
|
||||
result = utime (destination, tb);
|
||||
#else /* HAVE_UTIMES */
|
||||
struct timeval tv[2];
|
||||
|
||||
tv[0].tv_sec = statbuf->st_atime;
|
||||
tv[0].tv_usec = 0;
|
||||
tv[1].tv_sec = statbuf->st_mtime;
|
||||
tv[1].tv_usec = 0;
|
||||
result = utimes (destination, tv);
|
||||
#endif /* HAVE_UTIMES */
|
||||
#endif /* ! HAVE_GOOD_UTIME_H */
|
||||
}
|
||||
|
||||
if (result != 0)
|
||||
non_fatal (_("%s: cannot set time: %s"), destination, strerror (errno));
|
||||
}
|
||||
|
||||
#ifndef S_ISLNK
|
||||
#ifdef S_IFLNK
|
||||
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
|
||||
#else
|
||||
#define S_ISLNK(m) 0
|
||||
#define lstat stat
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Rename FROM to TO, copying if TO is a link.
|
||||
Return 0 if ok, -1 if error. */
|
||||
|
||||
int
|
||||
smart_rename (from, to, preserve_dates)
|
||||
const char *from;
|
||||
const char *to;
|
||||
int preserve_dates;
|
||||
{
|
||||
boolean exists;
|
||||
struct stat s;
|
||||
int ret = 0;
|
||||
|
||||
exists = lstat (to, &s) == 0;
|
||||
|
||||
#if defined (_WIN32) && !defined (__CYGWIN32__)
|
||||
/* Win32, unlike unix, will not erase `to' in `rename(from, to)' but
|
||||
fail instead. Also, chown is not present. */
|
||||
|
||||
if (exists)
|
||||
remove (to);
|
||||
|
||||
ret = rename (from, to);
|
||||
if (ret != 0)
|
||||
{
|
||||
/* We have to clean up here. */
|
||||
|
||||
non_fatal (_("%s: rename: %s"), to, strerror (errno));
|
||||
unlink (from);
|
||||
}
|
||||
#else
|
||||
/* Use rename only if TO is not a symbolic link and has
|
||||
only one hard link. */
|
||||
if (! exists || (!S_ISLNK (s.st_mode) && s.st_nlink == 1))
|
||||
{
|
||||
ret = rename (from, to);
|
||||
if (ret == 0)
|
||||
{
|
||||
if (exists)
|
||||
{
|
||||
/* Try to preserve the permission bits and ownership of
|
||||
TO. First get the mode right except for the setuid
|
||||
bit. Then change the ownership. Then fix the setuid
|
||||
bit. We do the chmod before the chown because if the
|
||||
chown succeeds, and we are a normal user, we won't be
|
||||
able to do the chmod afterward. We don't bother to
|
||||
fix the setuid bit first because that might introduce
|
||||
a fleeting security problem, and because the chown
|
||||
will clear the setuid bit anyhow. We only fix the
|
||||
setuid bit if the chown succeeds, because we don't
|
||||
want to introduce an unexpected setuid file owned by
|
||||
the user running objcopy. */
|
||||
chmod (to, s.st_mode & 0777);
|
||||
if (chown (to, s.st_uid, s.st_gid) >= 0)
|
||||
chmod (to, s.st_mode & 07777);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We have to clean up here. */
|
||||
non_fatal (_("%s: rename: %s"), to, strerror (errno));
|
||||
unlink (from);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = simple_copy (from, to);
|
||||
if (ret != 0)
|
||||
non_fatal (_("%s: simple_copy: %s"), to, strerror (errno));
|
||||
|
||||
if (preserve_dates)
|
||||
set_times (to, &s);
|
||||
unlink (from);
|
||||
}
|
||||
#endif /* _WIN32 && !__CYGWIN32__ */
|
||||
|
||||
return ret;
|
||||
}
|
||||
2387
binutils/resbin.c
2387
binutils/resbin.c
File diff suppressed because it is too large
Load Diff
@@ -1,785 +0,0 @@
|
||||
/* rescoff.c -- read and write resources in Windows COFF files.
|
||||
Copyright 1997, 1998, 2000 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Cygnus Support.
|
||||
|
||||
This file is part of 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 2 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
/* This file contains function that read and write Windows resources
|
||||
in COFF files. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "bucomm.h"
|
||||
#include "libiberty.h"
|
||||
#include "windres.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
/* In order to use the address of a resource data entry, we need to
|
||||
get the image base of the file. Right now we extract it from
|
||||
internal BFD information. FIXME. */
|
||||
|
||||
#include "coff/internal.h"
|
||||
#include "libcoff.h"
|
||||
|
||||
/* Information we extract from the file. */
|
||||
|
||||
struct coff_file_info
|
||||
{
|
||||
/* File name. */
|
||||
const char *filename;
|
||||
/* Data read from the file. */
|
||||
const bfd_byte *data;
|
||||
/* End of data read from file. */
|
||||
const bfd_byte *data_end;
|
||||
/* Address of the resource section minus the image base of the file. */
|
||||
bfd_vma secaddr;
|
||||
/* Non-zero if the file is big endian. */
|
||||
int big_endian;
|
||||
};
|
||||
|
||||
/* A resource directory table in a COFF file. */
|
||||
|
||||
struct extern_res_directory
|
||||
{
|
||||
/* Characteristics. */
|
||||
bfd_byte characteristics[4];
|
||||
/* Time stamp. */
|
||||
bfd_byte time[4];
|
||||
/* Major version number. */
|
||||
bfd_byte major[2];
|
||||
/* Minor version number. */
|
||||
bfd_byte minor[2];
|
||||
/* Number of named directory entries. */
|
||||
bfd_byte name_count[2];
|
||||
/* Number of directory entries with IDs. */
|
||||
bfd_byte id_count[2];
|
||||
};
|
||||
|
||||
/* A resource directory entry in a COFF file. */
|
||||
|
||||
struct extern_res_entry
|
||||
{
|
||||
/* Name or ID. */
|
||||
bfd_byte name[4];
|
||||
/* Address of resource entry or subdirectory. */
|
||||
bfd_byte rva[4];
|
||||
};
|
||||
|
||||
/* A resource data entry in a COFF file. */
|
||||
|
||||
struct extern_res_data
|
||||
{
|
||||
/* Address of resource data. This is apparently a file relative
|
||||
address, rather than a section offset. */
|
||||
bfd_byte rva[4];
|
||||
/* Size of resource data. */
|
||||
bfd_byte size[4];
|
||||
/* Code page. */
|
||||
bfd_byte codepage[4];
|
||||
/* Reserved. */
|
||||
bfd_byte reserved[4];
|
||||
};
|
||||
|
||||
/* Macros to swap in values. */
|
||||
|
||||
#define getfi_16(fi, s) ((fi)->big_endian ? bfd_getb16 (s) : bfd_getl16 (s))
|
||||
#define getfi_32(fi, s) ((fi)->big_endian ? bfd_getb32 (s) : bfd_getl32 (s))
|
||||
|
||||
/* Local functions. */
|
||||
|
||||
static void overrun PARAMS ((const struct coff_file_info *, const char *));
|
||||
static struct res_directory *read_coff_res_dir
|
||||
PARAMS ((const bfd_byte *, const struct coff_file_info *,
|
||||
const struct res_id *, int));
|
||||
static struct res_resource *read_coff_data_entry
|
||||
PARAMS ((const bfd_byte *, const struct coff_file_info *,
|
||||
const struct res_id *));
|
||||
|
||||
/* Read the resources in a COFF file. */
|
||||
|
||||
struct res_directory *
|
||||
read_coff_rsrc (filename, target)
|
||||
const char *filename;
|
||||
const char *target;
|
||||
{
|
||||
bfd *abfd;
|
||||
char **matching;
|
||||
asection *sec;
|
||||
bfd_size_type size;
|
||||
bfd_byte *data;
|
||||
struct coff_file_info finfo;
|
||||
|
||||
if (filename == NULL)
|
||||
fatal (_("filename required for COFF input"));
|
||||
|
||||
abfd = bfd_openr (filename, target);
|
||||
if (abfd == NULL)
|
||||
bfd_fatal (filename);
|
||||
|
||||
if (! bfd_check_format_matches (abfd, bfd_object, &matching))
|
||||
{
|
||||
bfd_nonfatal (bfd_get_filename (abfd));
|
||||
if (bfd_get_error () == bfd_error_file_ambiguously_recognized)
|
||||
list_matching_formats (matching);
|
||||
xexit (1);
|
||||
}
|
||||
|
||||
sec = bfd_get_section_by_name (abfd, ".rsrc");
|
||||
if (sec == NULL)
|
||||
{
|
||||
fatal (_("%s: no resource section"), filename);
|
||||
}
|
||||
|
||||
size = bfd_section_size (abfd, sec);
|
||||
data = (bfd_byte *) res_alloc (size);
|
||||
|
||||
if (! bfd_get_section_contents (abfd, sec, data, 0, size))
|
||||
bfd_fatal (_("can't read resource section"));
|
||||
|
||||
finfo.filename = filename;
|
||||
finfo.data = data;
|
||||
finfo.data_end = data + size;
|
||||
finfo.secaddr = (bfd_get_section_vma (abfd, sec)
|
||||
- pe_data (abfd)->pe_opthdr.ImageBase);
|
||||
finfo.big_endian = bfd_big_endian (abfd);
|
||||
|
||||
bfd_close (abfd);
|
||||
|
||||
/* Now just read in the top level resource directory. Note that we
|
||||
don't free data, since we create resource entries that point into
|
||||
it. If we ever want to free up the resource information we read,
|
||||
this will have to be cleaned up. */
|
||||
|
||||
return read_coff_res_dir (data, &finfo, (const struct res_id *) NULL, 0);
|
||||
}
|
||||
|
||||
/* Give an error if we are out of bounds. */
|
||||
|
||||
static void
|
||||
overrun (finfo, msg)
|
||||
const struct coff_file_info *finfo;
|
||||
const char *msg;
|
||||
{
|
||||
fatal (_("%s: %s: address out of bounds"), finfo->filename, msg);
|
||||
}
|
||||
|
||||
/* Read a resource directory. */
|
||||
|
||||
static struct res_directory *
|
||||
read_coff_res_dir (data, finfo, type, level)
|
||||
const bfd_byte *data;
|
||||
const struct coff_file_info *finfo;
|
||||
const struct res_id *type;
|
||||
int level;
|
||||
{
|
||||
const struct extern_res_directory *erd;
|
||||
struct res_directory *rd;
|
||||
int name_count, id_count, i;
|
||||
struct res_entry **pp;
|
||||
const struct extern_res_entry *ere;
|
||||
|
||||
if ((size_t) (finfo->data_end - data) < sizeof (struct extern_res_directory))
|
||||
overrun (finfo, _("directory"));
|
||||
|
||||
erd = (const struct extern_res_directory *) data;
|
||||
|
||||
rd = (struct res_directory *) res_alloc (sizeof *rd);
|
||||
rd->characteristics = getfi_32 (finfo, erd->characteristics);
|
||||
rd->time = getfi_32 (finfo, erd->time);
|
||||
rd->major = getfi_16 (finfo, erd->major);
|
||||
rd->minor = getfi_16 (finfo, erd->minor);
|
||||
rd->entries = NULL;
|
||||
|
||||
name_count = getfi_16 (finfo, erd->name_count);
|
||||
id_count = getfi_16 (finfo, erd->id_count);
|
||||
|
||||
pp = &rd->entries;
|
||||
|
||||
/* The resource directory entries immediately follow the directory
|
||||
table. */
|
||||
ere = (const struct extern_res_entry *) (erd + 1);
|
||||
|
||||
for (i = 0; i < name_count; i++, ere++)
|
||||
{
|
||||
unsigned long name, rva;
|
||||
struct res_entry *re;
|
||||
const bfd_byte *ers;
|
||||
int length, j;
|
||||
|
||||
if ((const bfd_byte *) ere >= finfo->data_end)
|
||||
overrun (finfo, _("named directory entry"));
|
||||
|
||||
name = getfi_32 (finfo, ere->name);
|
||||
rva = getfi_32 (finfo, ere->rva);
|
||||
|
||||
/* For some reason the high bit in NAME is set. */
|
||||
name &=~ 0x80000000;
|
||||
|
||||
if (name > (size_t) (finfo->data_end - finfo->data))
|
||||
overrun (finfo, _("directory entry name"));
|
||||
|
||||
ers = finfo->data + name;
|
||||
|
||||
re = (struct res_entry *) res_alloc (sizeof *re);
|
||||
re->next = NULL;
|
||||
re->id.named = 1;
|
||||
length = getfi_16 (finfo, ers);
|
||||
re->id.u.n.length = length;
|
||||
re->id.u.n.name = (unichar *) res_alloc (length * sizeof (unichar));
|
||||
for (j = 0; j < length; j++)
|
||||
re->id.u.n.name[j] = getfi_16 (finfo, ers + j * 2 + 2);
|
||||
|
||||
if (level == 0)
|
||||
type = &re->id;
|
||||
|
||||
if ((rva & 0x80000000) != 0)
|
||||
{
|
||||
rva &=~ 0x80000000;
|
||||
if (rva >= (size_t) (finfo->data_end - finfo->data))
|
||||
overrun (finfo, _("named subdirectory"));
|
||||
re->subdir = 1;
|
||||
re->u.dir = read_coff_res_dir (finfo->data + rva, finfo, type,
|
||||
level + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rva >= (size_t) (finfo->data_end - finfo->data))
|
||||
overrun (finfo, _("named resource"));
|
||||
re->subdir = 0;
|
||||
re->u.res = read_coff_data_entry (finfo->data + rva, finfo, type);
|
||||
}
|
||||
|
||||
*pp = re;
|
||||
pp = &re->next;
|
||||
}
|
||||
|
||||
for (i = 0; i < id_count; i++, ere++)
|
||||
{
|
||||
unsigned long name, rva;
|
||||
struct res_entry *re;
|
||||
|
||||
if ((const bfd_byte *) ere >= finfo->data_end)
|
||||
overrun (finfo, _("ID directory entry"));
|
||||
|
||||
name = getfi_32 (finfo, ere->name);
|
||||
rva = getfi_32 (finfo, ere->rva);
|
||||
|
||||
re = (struct res_entry *) res_alloc (sizeof *re);
|
||||
re->next = NULL;
|
||||
re->id.named = 0;
|
||||
re->id.u.id = name;
|
||||
|
||||
if (level == 0)
|
||||
type = &re->id;
|
||||
|
||||
if ((rva & 0x80000000) != 0)
|
||||
{
|
||||
rva &=~ 0x80000000;
|
||||
if (rva >= (size_t) (finfo->data_end - finfo->data))
|
||||
overrun (finfo, _("ID subdirectory"));
|
||||
re->subdir = 1;
|
||||
re->u.dir = read_coff_res_dir (finfo->data + rva, finfo, type,
|
||||
level + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rva >= (size_t) (finfo->data_end - finfo->data))
|
||||
overrun (finfo, _("ID resource"));
|
||||
re->subdir = 0;
|
||||
re->u.res = read_coff_data_entry (finfo->data + rva, finfo, type);
|
||||
}
|
||||
|
||||
*pp = re;
|
||||
pp = &re->next;
|
||||
}
|
||||
|
||||
return rd;
|
||||
}
|
||||
|
||||
/* Read a resource data entry. */
|
||||
|
||||
static struct res_resource *
|
||||
read_coff_data_entry (data, finfo, type)
|
||||
const bfd_byte *data;
|
||||
const struct coff_file_info *finfo;
|
||||
const struct res_id *type;
|
||||
{
|
||||
const struct extern_res_data *erd;
|
||||
struct res_resource *r;
|
||||
unsigned long size, rva;
|
||||
const bfd_byte *resdata;
|
||||
|
||||
if (type == NULL)
|
||||
fatal (_("resource type unknown"));
|
||||
|
||||
if ((size_t) (finfo->data_end - data) < sizeof (struct extern_res_data))
|
||||
overrun (finfo, _("data entry"));
|
||||
|
||||
erd = (const struct extern_res_data *) data;
|
||||
|
||||
size = getfi_32 (finfo, erd->size);
|
||||
rva = getfi_32 (finfo, erd->rva);
|
||||
if (rva < finfo->secaddr
|
||||
|| rva - finfo->secaddr >= (size_t) (finfo->data_end - finfo->data))
|
||||
overrun (finfo, _("resource data"));
|
||||
|
||||
resdata = finfo->data + (rva - finfo->secaddr);
|
||||
|
||||
if (size > (size_t) (finfo->data_end - resdata))
|
||||
overrun (finfo, _("resource data size"));
|
||||
|
||||
r = bin_to_res (*type, resdata, size, finfo->big_endian);
|
||||
|
||||
memset (&r->res_info, 0, sizeof (struct res_res_info));
|
||||
r->coff_info.codepage = getfi_32 (finfo, erd->codepage);
|
||||
r->coff_info.reserved = getfi_32 (finfo, erd->reserved);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/* This structure is used to build a list of bindata structures. */
|
||||
|
||||
struct bindata_build
|
||||
{
|
||||
/* The data. */
|
||||
struct bindata *d;
|
||||
/* The last structure we have added to the list. */
|
||||
struct bindata *last;
|
||||
/* The size of the list as a whole. */
|
||||
unsigned long length;
|
||||
};
|
||||
|
||||
/* This structure keeps track of information as we build the directory
|
||||
tree. */
|
||||
|
||||
struct coff_write_info
|
||||
{
|
||||
/* These fields are based on the BFD. */
|
||||
/* The BFD itself. */
|
||||
bfd *abfd;
|
||||
/* Non-zero if the file is big endian. */
|
||||
int big_endian;
|
||||
/* Pointer to section symbol used to build RVA relocs. */
|
||||
asymbol **sympp;
|
||||
|
||||
/* These fields are computed initially, and then not changed. */
|
||||
/* Length of directory tables and entries. */
|
||||
unsigned long dirsize;
|
||||
/* Length of directory entry strings. */
|
||||
unsigned long dirstrsize;
|
||||
/* Length of resource data entries. */
|
||||
unsigned long dataentsize;
|
||||
|
||||
/* These fields are updated as we add data. */
|
||||
/* Directory tables and entries. */
|
||||
struct bindata_build dirs;
|
||||
/* Directory entry strings. */
|
||||
struct bindata_build dirstrs;
|
||||
/* Resource data entries. */
|
||||
struct bindata_build dataents;
|
||||
/* Actual resource data. */
|
||||
struct bindata_build resources;
|
||||
/* Relocations. */
|
||||
arelent **relocs;
|
||||
/* Number of relocations. */
|
||||
unsigned int reloc_count;
|
||||
};
|
||||
|
||||
/* Macros to swap out values. */
|
||||
|
||||
#define putcwi_16(cwi, v, s) \
|
||||
((cwi->big_endian) ? bfd_putb16 ((v), (s)) : bfd_putl16 ((v), (s)))
|
||||
#define putcwi_32(cwi, v, s) \
|
||||
((cwi->big_endian) ? bfd_putb32 ((v), (s)) : bfd_putl32 ((v), (s)))
|
||||
|
||||
static void coff_bin_sizes
|
||||
PARAMS ((const struct res_directory *, struct coff_write_info *));
|
||||
static unsigned char *coff_alloc PARAMS ((struct bindata_build *, size_t));
|
||||
static void coff_to_bin
|
||||
PARAMS ((const struct res_directory *, struct coff_write_info *));
|
||||
static void coff_res_to_bin
|
||||
PARAMS ((const struct res_resource *, struct coff_write_info *));
|
||||
|
||||
/* Write resources to a COFF file. RESOURCES should already be
|
||||
sorted.
|
||||
|
||||
Right now we always create a new file. Someday we should also
|
||||
offer the ability to merge resources into an existing file. This
|
||||
would require doing the basic work of objcopy, just modifying or
|
||||
adding the .rsrc section. */
|
||||
|
||||
void
|
||||
write_coff_file (filename, target, resources)
|
||||
const char *filename;
|
||||
const char *target;
|
||||
const struct res_directory *resources;
|
||||
{
|
||||
bfd *abfd;
|
||||
asection *sec;
|
||||
struct coff_write_info cwi;
|
||||
struct bindata *d;
|
||||
unsigned long length, offset;
|
||||
|
||||
if (filename == NULL)
|
||||
fatal (_("filename required for COFF output"));
|
||||
|
||||
abfd = bfd_openw (filename, target);
|
||||
if (abfd == NULL)
|
||||
bfd_fatal (filename);
|
||||
|
||||
if (! bfd_set_format (abfd, bfd_object))
|
||||
bfd_fatal ("bfd_set_format");
|
||||
|
||||
#if defined DLLTOOL_SH
|
||||
if (! bfd_set_arch_mach (abfd, bfd_arch_sh, 0))
|
||||
bfd_fatal ("bfd_set_arch_mach(sh)");
|
||||
#elif defined DLLTOOL_MIPS
|
||||
if (! bfd_set_arch_mach (abfd, bfd_arch_mips, 0))
|
||||
bfd_fatal ("bfd_set_arch_mach(mips)");
|
||||
#elif defined DLLTOOL_ARM
|
||||
if (! bfd_set_arch_mach (abfd, bfd_arch_arm, 0))
|
||||
bfd_fatal ("bfd_set_arch_mach(arm)");
|
||||
#else
|
||||
/* FIXME: This is obviously i386 specific. */
|
||||
if (! bfd_set_arch_mach (abfd, bfd_arch_i386, 0))
|
||||
bfd_fatal ("bfd_set_arch_mach(i386)");
|
||||
#endif
|
||||
|
||||
if (! bfd_set_file_flags (abfd, HAS_SYMS | HAS_RELOC))
|
||||
bfd_fatal ("bfd_set_file_flags");
|
||||
|
||||
sec = bfd_make_section (abfd, ".rsrc");
|
||||
if (sec == NULL)
|
||||
bfd_fatal ("bfd_make_section");
|
||||
|
||||
if (! bfd_set_section_flags (abfd, sec,
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC
|
||||
| SEC_LOAD | SEC_DATA)))
|
||||
bfd_fatal ("bfd_set_section_flags");
|
||||
|
||||
if (! bfd_set_symtab (abfd, sec->symbol_ptr_ptr, 1))
|
||||
bfd_fatal ("bfd_set_symtab");
|
||||
|
||||
/* Requiring this is probably a bug in BFD. */
|
||||
sec->output_section = sec;
|
||||
|
||||
/* The order of data in the .rsrc section is
|
||||
resource directory tables and entries
|
||||
resource directory strings
|
||||
resource data entries
|
||||
actual resource data
|
||||
|
||||
We build these different types of data in different lists. */
|
||||
|
||||
cwi.abfd = abfd;
|
||||
cwi.big_endian = bfd_big_endian (abfd);
|
||||
cwi.sympp = sec->symbol_ptr_ptr;
|
||||
cwi.dirsize = 0;
|
||||
cwi.dirstrsize = 0;
|
||||
cwi.dataentsize = 0;
|
||||
cwi.dirs.d = NULL;
|
||||
cwi.dirs.last = NULL;
|
||||
cwi.dirs.length = 0;
|
||||
cwi.dirstrs.d = NULL;
|
||||
cwi.dirstrs.last = NULL;
|
||||
cwi.dirstrs.length = 0;
|
||||
cwi.dataents.d = NULL;
|
||||
cwi.dataents.last = NULL;
|
||||
cwi.dataents.length = 0;
|
||||
cwi.resources.d = NULL;
|
||||
cwi.resources.last = NULL;
|
||||
cwi.resources.length = 0;
|
||||
cwi.relocs = NULL;
|
||||
cwi.reloc_count = 0;
|
||||
|
||||
/* Work out the sizes of the resource directory entries, so that we
|
||||
know the various offsets we will need. */
|
||||
coff_bin_sizes (resources, &cwi);
|
||||
|
||||
/* Force the directory strings to be 32 bit aligned. Every other
|
||||
structure is 32 bit aligned anyhow. */
|
||||
cwi.dirstrsize = (cwi.dirstrsize + 3) &~ 3;
|
||||
|
||||
/* Actually convert the resources to binary. */
|
||||
coff_to_bin (resources, &cwi);
|
||||
|
||||
/* Add another 2 bytes to the directory strings if needed for
|
||||
alignment. */
|
||||
if ((cwi.dirstrs.length & 3) != 0)
|
||||
{
|
||||
unsigned char *ex;
|
||||
|
||||
ex = coff_alloc (&cwi.dirstrs, 2);
|
||||
ex[0] = 0;
|
||||
ex[1] = 0;
|
||||
}
|
||||
|
||||
/* Make sure that the data we built came out to the same size as we
|
||||
calculated initially. */
|
||||
assert (cwi.dirs.length == cwi.dirsize);
|
||||
assert (cwi.dirstrs.length == cwi.dirstrsize);
|
||||
assert (cwi.dataents.length == cwi.dataentsize);
|
||||
|
||||
length = (cwi.dirsize
|
||||
+ cwi.dirstrsize
|
||||
+ cwi.dataentsize
|
||||
+ cwi.resources.length);
|
||||
|
||||
if (! bfd_set_section_size (abfd, sec, length))
|
||||
bfd_fatal ("bfd_set_section_size");
|
||||
|
||||
bfd_set_reloc (abfd, sec, cwi.relocs, cwi.reloc_count);
|
||||
|
||||
offset = 0;
|
||||
for (d = cwi.dirs.d; d != NULL; d = d->next)
|
||||
{
|
||||
if (! bfd_set_section_contents (abfd, sec, d->data, offset, d->length))
|
||||
bfd_fatal ("bfd_set_section_contents");
|
||||
offset += d->length;
|
||||
}
|
||||
for (d = cwi.dirstrs.d; d != NULL; d = d->next)
|
||||
{
|
||||
if (! bfd_set_section_contents (abfd, sec, d->data, offset, d->length))
|
||||
bfd_fatal ("bfd_set_section_contents");
|
||||
offset += d->length;
|
||||
}
|
||||
for (d = cwi.dataents.d; d != NULL; d = d->next)
|
||||
{
|
||||
if (! bfd_set_section_contents (abfd, sec, d->data, offset, d->length))
|
||||
bfd_fatal ("bfd_set_section_contents");
|
||||
offset += d->length;
|
||||
}
|
||||
for (d = cwi.resources.d; d != NULL; d = d->next)
|
||||
{
|
||||
if (! bfd_set_section_contents (abfd, sec, d->data, offset, d->length))
|
||||
bfd_fatal ("bfd_set_section_contents");
|
||||
offset += d->length;
|
||||
}
|
||||
|
||||
assert (offset == length);
|
||||
|
||||
if (! bfd_close (abfd))
|
||||
bfd_fatal ("bfd_close");
|
||||
|
||||
/* We allocated the relocs array using malloc. */
|
||||
free (cwi.relocs);
|
||||
}
|
||||
|
||||
/* Work out the sizes of the various fixed size resource directory
|
||||
entries. This updates fields in CWI. */
|
||||
|
||||
static void
|
||||
coff_bin_sizes (resdir, cwi)
|
||||
const struct res_directory *resdir;
|
||||
struct coff_write_info *cwi;
|
||||
{
|
||||
const struct res_entry *re;
|
||||
|
||||
cwi->dirsize += sizeof (struct extern_res_directory);
|
||||
|
||||
for (re = resdir->entries; re != NULL; re = re->next)
|
||||
{
|
||||
cwi->dirsize += sizeof (struct extern_res_entry);
|
||||
|
||||
if (re->id.named)
|
||||
cwi->dirstrsize += re->id.u.n.length * 2 + 2;
|
||||
|
||||
if (re->subdir)
|
||||
coff_bin_sizes (re->u.dir, cwi);
|
||||
else
|
||||
cwi->dataentsize += sizeof (struct extern_res_data);
|
||||
}
|
||||
}
|
||||
|
||||
/* Allocate data for a particular list. */
|
||||
|
||||
static unsigned char *
|
||||
coff_alloc (bb, size)
|
||||
struct bindata_build *bb;
|
||||
size_t size;
|
||||
{
|
||||
struct bindata *d;
|
||||
|
||||
d = (struct bindata *) reswr_alloc (sizeof *d);
|
||||
|
||||
d->next = NULL;
|
||||
d->data = (unsigned char *) reswr_alloc (size);
|
||||
d->length = size;
|
||||
|
||||
if (bb->d == NULL)
|
||||
bb->d = d;
|
||||
else
|
||||
bb->last->next = d;
|
||||
bb->last = d;
|
||||
bb->length += size;
|
||||
|
||||
return d->data;
|
||||
}
|
||||
|
||||
/* Convert the resource directory RESDIR to binary. */
|
||||
|
||||
static void
|
||||
coff_to_bin (resdir, cwi)
|
||||
const struct res_directory *resdir;
|
||||
struct coff_write_info *cwi;
|
||||
{
|
||||
struct extern_res_directory *erd;
|
||||
int ci, cn;
|
||||
const struct res_entry *e;
|
||||
struct extern_res_entry *ere;
|
||||
|
||||
/* Write out the directory table. */
|
||||
|
||||
erd = ((struct extern_res_directory *)
|
||||
coff_alloc (&cwi->dirs, sizeof (*erd)));
|
||||
|
||||
putcwi_32 (cwi, resdir->characteristics, erd->characteristics);
|
||||
putcwi_32 (cwi, resdir->time, erd->time);
|
||||
putcwi_16 (cwi, resdir->major, erd->major);
|
||||
putcwi_16 (cwi, resdir->minor, erd->minor);
|
||||
|
||||
ci = 0;
|
||||
cn = 0;
|
||||
for (e = resdir->entries; e != NULL; e = e->next)
|
||||
{
|
||||
if (e->id.named)
|
||||
++cn;
|
||||
else
|
||||
++ci;
|
||||
}
|
||||
|
||||
putcwi_16 (cwi, cn, erd->name_count);
|
||||
putcwi_16 (cwi, ci, erd->id_count);
|
||||
|
||||
/* Write out the data entries. Note that we allocate space for all
|
||||
the entries before writing them out. That permits a recursive
|
||||
call to work correctly when writing out subdirectories. */
|
||||
|
||||
ere = ((struct extern_res_entry *)
|
||||
coff_alloc (&cwi->dirs, (ci + cn) * sizeof (*ere)));
|
||||
for (e = resdir->entries; e != NULL; e = e->next, ere++)
|
||||
{
|
||||
if (! e->id.named)
|
||||
putcwi_32 (cwi, e->id.u.id, ere->name);
|
||||
else
|
||||
{
|
||||
unsigned char *str;
|
||||
int i;
|
||||
|
||||
/* For some reason existing files seem to have the high bit
|
||||
set on the address of the name, although that is not
|
||||
documented. */
|
||||
putcwi_32 (cwi,
|
||||
0x80000000 | (cwi->dirsize + cwi->dirstrs.length),
|
||||
ere->name);
|
||||
|
||||
str = coff_alloc (&cwi->dirstrs, e->id.u.n.length * 2 + 2);
|
||||
putcwi_16 (cwi, e->id.u.n.length, str);
|
||||
for (i = 0; i < e->id.u.n.length; i++)
|
||||
putcwi_16 (cwi, e->id.u.n.name[i], str + i * 2 + 2);
|
||||
}
|
||||
|
||||
if (e->subdir)
|
||||
{
|
||||
putcwi_32 (cwi, 0x80000000 | cwi->dirs.length, ere->rva);
|
||||
coff_to_bin (e->u.dir, cwi);
|
||||
}
|
||||
else
|
||||
{
|
||||
putcwi_32 (cwi,
|
||||
cwi->dirsize + cwi->dirstrsize + cwi->dataents.length,
|
||||
ere->rva);
|
||||
|
||||
coff_res_to_bin (e->u.res, cwi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Convert the resource RES to binary. */
|
||||
|
||||
static void
|
||||
coff_res_to_bin (res, cwi)
|
||||
const struct res_resource *res;
|
||||
struct coff_write_info *cwi;
|
||||
{
|
||||
arelent *r;
|
||||
struct extern_res_data *erd;
|
||||
struct bindata *d;
|
||||
unsigned long length;
|
||||
|
||||
/* For some reason, although every other address is a section
|
||||
offset, the address of the resource data itself is an RVA. That
|
||||
means that we need to generate a relocation for it. We allocate
|
||||
the relocs array using malloc so that we can use realloc. FIXME:
|
||||
This relocation handling is correct for the i386, but probably
|
||||
not for any other target. */
|
||||
|
||||
r = (arelent *) reswr_alloc (sizeof (arelent));
|
||||
r->sym_ptr_ptr = cwi->sympp;
|
||||
r->address = cwi->dirsize + cwi->dirstrsize + cwi->dataents.length;
|
||||
r->addend = 0;
|
||||
r->howto = bfd_reloc_type_lookup (cwi->abfd, BFD_RELOC_RVA);
|
||||
if (r->howto == NULL)
|
||||
bfd_fatal (_("can't get BFD_RELOC_RVA relocation type"));
|
||||
|
||||
cwi->relocs = xrealloc (cwi->relocs,
|
||||
(cwi->reloc_count + 2) * sizeof (arelent *));
|
||||
cwi->relocs[cwi->reloc_count] = r;
|
||||
cwi->relocs[cwi->reloc_count + 1] = NULL;
|
||||
++cwi->reloc_count;
|
||||
|
||||
erd = (struct extern_res_data *) coff_alloc (&cwi->dataents, sizeof (*erd));
|
||||
|
||||
putcwi_32 (cwi,
|
||||
(cwi->dirsize
|
||||
+ cwi->dirstrsize
|
||||
+ cwi->dataentsize
|
||||
+ cwi->resources.length),
|
||||
erd->rva);
|
||||
putcwi_32 (cwi, res->coff_info.codepage, erd->codepage);
|
||||
putcwi_32 (cwi, res->coff_info.reserved, erd->reserved);
|
||||
|
||||
d = res_to_bin (res, cwi->big_endian);
|
||||
|
||||
if (cwi->resources.d == NULL)
|
||||
cwi->resources.d = d;
|
||||
else
|
||||
cwi->resources.last->next = d;
|
||||
|
||||
length = 0;
|
||||
for (; d->next != NULL; d = d->next)
|
||||
length += d->length;
|
||||
length += d->length;
|
||||
cwi->resources.last = d;
|
||||
cwi->resources.length += length;
|
||||
|
||||
putcwi_32 (cwi, length, erd->size);
|
||||
|
||||
/* Force the next resource to have 32 bit alignment. */
|
||||
|
||||
if ((length & 3) != 0)
|
||||
{
|
||||
int add;
|
||||
unsigned char *ex;
|
||||
|
||||
add = 4 - (length & 3);
|
||||
|
||||
ex = coff_alloc (&cwi->resources, add);
|
||||
memset (ex, 0, add);
|
||||
}
|
||||
}
|
||||
2650
binutils/resrc.c
2650
binutils/resrc.c
File diff suppressed because it is too large
Load Diff
@@ -1,659 +0,0 @@
|
||||
/* resres.c: read_res_file and write_res_file implementation for windres.
|
||||
Copyright 1998, 1999 Free Software Foundation, Inc.
|
||||
Written by Anders Norlander <anorland@hem2.passagen.se>.
|
||||
|
||||
This file is part of 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 2 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
/* FIXME: This file does not work correctly in a cross configuration.
|
||||
It assumes that it can use fread and fwrite to read and write
|
||||
integers. It does no swapping. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "bucomm.h"
|
||||
#include "libiberty.h"
|
||||
#include "windres.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <time.h>
|
||||
|
||||
struct res_hdr
|
||||
{
|
||||
unsigned long data_size;
|
||||
unsigned long header_size;
|
||||
};
|
||||
|
||||
static void write_res_directory
|
||||
PARAMS ((const struct res_directory *,
|
||||
const struct res_id *, const struct res_id *,
|
||||
int *, int));
|
||||
static void write_res_resource
|
||||
PARAMS ((const struct res_id *, const struct res_id *,
|
||||
const struct res_resource *, int *));
|
||||
static void write_res_bin
|
||||
PARAMS ((const struct res_resource *, const struct res_id *,
|
||||
const struct res_id *, const struct res_res_info *));
|
||||
|
||||
static void write_res_id PARAMS ((const struct res_id *));
|
||||
static void write_res_info PARAMS ((const struct res_res_info *));
|
||||
static void write_res_data PARAMS ((const void *, size_t, int));
|
||||
static void write_res_header
|
||||
PARAMS ((unsigned long, const struct res_id *, const struct res_id *,
|
||||
const struct res_res_info *));
|
||||
|
||||
static int read_resource_entry PARAMS ((void));
|
||||
static void read_res_data PARAMS ((void *, size_t, int));
|
||||
static void read_res_id PARAMS ((struct res_id *));
|
||||
static unichar *read_unistring PARAMS ((int *));
|
||||
static void skip_null_resource PARAMS ((void));
|
||||
|
||||
static unsigned long get_id_size PARAMS ((const struct res_id *));
|
||||
static void res_align_file PARAMS ((void));
|
||||
|
||||
static void
|
||||
res_add_resource
|
||||
PARAMS ((struct res_resource *, const struct res_id *,
|
||||
const struct res_id *, int, int));
|
||||
|
||||
void
|
||||
res_append_resource
|
||||
PARAMS ((struct res_directory **, struct res_resource *,
|
||||
int, const struct res_id *, int));
|
||||
|
||||
static struct res_directory *resources = NULL;
|
||||
|
||||
static FILE *fres;
|
||||
static const char *filename;
|
||||
|
||||
extern char *program_name;
|
||||
|
||||
/* Read resource file */
|
||||
struct res_directory *
|
||||
read_res_file (fn)
|
||||
const char *fn;
|
||||
{
|
||||
filename = fn;
|
||||
fres = fopen (filename, "rb");
|
||||
if (fres == NULL)
|
||||
fatal ("can't open `%s' for output: %s", filename, strerror (errno));
|
||||
|
||||
skip_null_resource ();
|
||||
|
||||
while (read_resource_entry ())
|
||||
;
|
||||
|
||||
fclose (fres);
|
||||
|
||||
return resources;
|
||||
}
|
||||
|
||||
/* Write resource file */
|
||||
void
|
||||
write_res_file (fn, resdir)
|
||||
const char *fn;
|
||||
const struct res_directory *resdir;
|
||||
{
|
||||
int language;
|
||||
static const unsigned char sign[] =
|
||||
{0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
|
||||
0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
long fpos;
|
||||
|
||||
filename = fn;
|
||||
|
||||
fres = fopen (filename, "wb");
|
||||
if (fres == NULL)
|
||||
fatal ("can't open `%s' for output: %s", filename, strerror (errno));
|
||||
|
||||
/* Write 32 bit resource signature */
|
||||
write_res_data (sign, sizeof (sign), 1);
|
||||
|
||||
/* write resources */
|
||||
|
||||
language = -1;
|
||||
write_res_directory (resdir, (const struct res_id *) NULL,
|
||||
(const struct res_id *) NULL, &language, 1);
|
||||
|
||||
/* end file on DWORD boundary */
|
||||
fpos = ftell (fres);
|
||||
if (fpos % 4)
|
||||
write_res_data (sign, fpos % 4, 1);
|
||||
|
||||
fclose (fres);
|
||||
}
|
||||
|
||||
/* Read a resource entry, returns 0 when all resources are read */
|
||||
static int
|
||||
read_resource_entry (void)
|
||||
{
|
||||
struct res_id type;
|
||||
struct res_id name;
|
||||
struct res_res_info resinfo;
|
||||
struct res_hdr reshdr;
|
||||
long version;
|
||||
void *buff;
|
||||
|
||||
struct res_resource *r;
|
||||
|
||||
res_align_file ();
|
||||
|
||||
/* Read header */
|
||||
if (fread (&reshdr, sizeof (reshdr), 1, fres) != 1)
|
||||
return 0;
|
||||
|
||||
/* read resource type */
|
||||
read_res_id (&type);
|
||||
/* read resource id */
|
||||
read_res_id (&name);
|
||||
|
||||
res_align_file ();
|
||||
|
||||
/* Read additional resource header */
|
||||
read_res_data (&resinfo.version, sizeof (resinfo.version), 1);
|
||||
read_res_data (&resinfo.memflags, sizeof (resinfo.memflags), 1);
|
||||
read_res_data (&resinfo.language, sizeof (resinfo.language), 1);
|
||||
read_res_data (&version, sizeof (version), 1);
|
||||
read_res_data (&resinfo.characteristics, sizeof (resinfo.characteristics), 1);
|
||||
|
||||
res_align_file ();
|
||||
|
||||
/* Allocate buffer for data */
|
||||
buff = res_alloc (reshdr.data_size);
|
||||
/* Read data */
|
||||
read_res_data (buff, reshdr.data_size, 1);
|
||||
/* Convert binary data to resource */
|
||||
r = bin_to_res (type, buff, reshdr.data_size, 0);
|
||||
r->res_info = resinfo;
|
||||
/* Add resource to resource directory */
|
||||
res_add_resource (r, &type, &name, resinfo.language, 0);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* write resource directory to binary resource file */
|
||||
static void
|
||||
write_res_directory (rd, type, name, language, level)
|
||||
const struct res_directory *rd;
|
||||
const struct res_id *type;
|
||||
const struct res_id *name;
|
||||
int *language;
|
||||
int level;
|
||||
{
|
||||
const struct res_entry *re;
|
||||
|
||||
for (re = rd->entries; re != NULL; re = re->next)
|
||||
{
|
||||
switch (level)
|
||||
{
|
||||
case 1:
|
||||
/* If we're at level 1, the key of this resource is the
|
||||
type. This normally duplicates the information we have
|
||||
stored with the resource itself, but we need to remember
|
||||
the type if this is a user define resource type. */
|
||||
type = &re->id;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
/* If we're at level 2, the key of this resource is the name
|
||||
we are going to use in the rc printout. */
|
||||
name = &re->id;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
/* If we're at level 3, then this key represents a language.
|
||||
Use it to update the current language. */
|
||||
if (!re->id.named
|
||||
&& re->id.u.id != (unsigned long) *language
|
||||
&& (re->id.u.id & 0xffff) == re->id.u.id)
|
||||
{
|
||||
*language = re->id.u.id;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (re->subdir)
|
||||
write_res_directory (re->u.dir, type, name, language, level + 1);
|
||||
else
|
||||
{
|
||||
if (level == 3)
|
||||
{
|
||||
/* This is the normal case: the three levels are
|
||||
TYPE/NAME/LANGUAGE. NAME will have been set at level
|
||||
2, and represents the name to use. We probably just
|
||||
set LANGUAGE, and it will probably match what the
|
||||
resource itself records if anything. */
|
||||
write_res_resource (type, name, re->u.res, language);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "// Resource at unexpected level %d\n", level);
|
||||
write_res_resource (type, (struct res_id *) NULL, re->u.res,
|
||||
language);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
write_res_resource (type, name, res, language)
|
||||
const struct res_id *type;
|
||||
const struct res_id *name;
|
||||
const struct res_resource *res;
|
||||
int *language ATTRIBUTE_UNUSED;
|
||||
{
|
||||
int rt;
|
||||
|
||||
switch (res->type)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
|
||||
case RES_TYPE_ACCELERATOR:
|
||||
rt = RT_ACCELERATOR;
|
||||
break;
|
||||
|
||||
case RES_TYPE_BITMAP:
|
||||
rt = RT_BITMAP;
|
||||
break;
|
||||
|
||||
case RES_TYPE_CURSOR:
|
||||
rt = RT_CURSOR;
|
||||
break;
|
||||
|
||||
case RES_TYPE_GROUP_CURSOR:
|
||||
rt = RT_GROUP_CURSOR;
|
||||
break;
|
||||
|
||||
case RES_TYPE_DIALOG:
|
||||
rt = RT_DIALOG;
|
||||
break;
|
||||
|
||||
case RES_TYPE_FONT:
|
||||
rt = RT_FONT;
|
||||
break;
|
||||
|
||||
case RES_TYPE_FONTDIR:
|
||||
rt = RT_FONTDIR;
|
||||
break;
|
||||
|
||||
case RES_TYPE_ICON:
|
||||
rt = RT_ICON;
|
||||
break;
|
||||
|
||||
case RES_TYPE_GROUP_ICON:
|
||||
rt = RT_GROUP_ICON;
|
||||
break;
|
||||
|
||||
case RES_TYPE_MENU:
|
||||
rt = RT_MENU;
|
||||
break;
|
||||
|
||||
case RES_TYPE_MESSAGETABLE:
|
||||
rt = RT_MESSAGETABLE;
|
||||
break;
|
||||
|
||||
case RES_TYPE_RCDATA:
|
||||
rt = RT_RCDATA;
|
||||
break;
|
||||
|
||||
case RES_TYPE_STRINGTABLE:
|
||||
rt = RT_STRING;
|
||||
break;
|
||||
|
||||
case RES_TYPE_USERDATA:
|
||||
rt = 0;
|
||||
break;
|
||||
|
||||
case RES_TYPE_VERSIONINFO:
|
||||
rt = RT_VERSION;
|
||||
break;
|
||||
}
|
||||
|
||||
if (rt != 0
|
||||
&& type != NULL
|
||||
&& (type->named || type->u.id != (unsigned long) rt))
|
||||
{
|
||||
fprintf (stderr, "// Unexpected resource type mismatch: ");
|
||||
res_id_print (stderr, *type, 1);
|
||||
fprintf (stderr, " != %d", rt);
|
||||
abort ();
|
||||
}
|
||||
|
||||
write_res_bin (res, type, name, &res->res_info);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Write a resource in binary resource format */
|
||||
static void
|
||||
write_res_bin (res, type, name, resinfo)
|
||||
const struct res_resource *res;
|
||||
const struct res_id *type;
|
||||
const struct res_id *name;
|
||||
const struct res_res_info *resinfo;
|
||||
{
|
||||
unsigned long datasize = 0;
|
||||
const struct bindata *bin_rep, *data;
|
||||
|
||||
bin_rep = res_to_bin (res, 0);
|
||||
for (data = bin_rep; data != NULL; data = data->next)
|
||||
datasize += data->length;
|
||||
|
||||
write_res_header (datasize, type, name, resinfo);
|
||||
|
||||
for (data = bin_rep; data != NULL; data = data->next)
|
||||
write_res_data (data->data, data->length, 1);
|
||||
}
|
||||
|
||||
/* Get number of bytes needed to store an id in binary format */
|
||||
static unsigned long
|
||||
get_id_size (id)
|
||||
const struct res_id *id;
|
||||
{
|
||||
if (id->named)
|
||||
return sizeof (unichar) * (id->u.n.length + 1);
|
||||
else
|
||||
return sizeof (unichar) * 2;
|
||||
}
|
||||
|
||||
/* Write a resource header */
|
||||
static void
|
||||
write_res_header (datasize, type, name, resinfo)
|
||||
unsigned long datasize;
|
||||
const struct res_id *type;
|
||||
const struct res_id *name;
|
||||
const struct res_res_info *resinfo;
|
||||
{
|
||||
struct res_hdr reshdr;
|
||||
reshdr.data_size = datasize;
|
||||
reshdr.header_size = 24 + get_id_size (type) + get_id_size (name);
|
||||
|
||||
res_align_file ();
|
||||
write_res_data (&reshdr, sizeof (reshdr), 1);
|
||||
write_res_id (type);
|
||||
write_res_id (name);
|
||||
|
||||
res_align_file ();
|
||||
|
||||
write_res_info (resinfo);
|
||||
res_align_file ();
|
||||
}
|
||||
|
||||
|
||||
/* Write data to file, abort on failure */
|
||||
static void
|
||||
write_res_data (data, size, count)
|
||||
const void *data;
|
||||
size_t size;
|
||||
int count;
|
||||
{
|
||||
if (fwrite (data, size, count, fres) != (size_t) count)
|
||||
fatal ("%s: could not write to file", filename);
|
||||
}
|
||||
|
||||
/* Read data from file, abort on failure */
|
||||
static void
|
||||
read_res_data (data, size, count)
|
||||
void *data;
|
||||
size_t size;
|
||||
int count;
|
||||
{
|
||||
if (fread (data, size, count, fres) != (size_t) count)
|
||||
fatal ("%s: unexpected end of file", filename);
|
||||
}
|
||||
|
||||
/* Write a resource id */
|
||||
static void
|
||||
write_res_id (id)
|
||||
const struct res_id *id;
|
||||
{
|
||||
if (id->named)
|
||||
{
|
||||
unsigned long len = id->u.n.length;
|
||||
unichar null_term = 0;
|
||||
write_res_data (id->u.n.name, len * sizeof (unichar), 1);
|
||||
write_res_data (&null_term, sizeof (null_term), 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned short i = 0xFFFF;
|
||||
write_res_data (&i, sizeof (i), 1);
|
||||
i = id->u.id;
|
||||
write_res_data (&i, sizeof (i), 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Write resource info */
|
||||
static void
|
||||
write_res_info (info)
|
||||
const struct res_res_info *info;
|
||||
{
|
||||
write_res_data (&info->version, sizeof (info->version), 1);
|
||||
write_res_data (&info->memflags, sizeof (info->memflags), 1);
|
||||
write_res_data (&info->language, sizeof (info->language), 1);
|
||||
write_res_data (&info->version, sizeof (info->version), 1);
|
||||
write_res_data (&info->characteristics, sizeof (info->characteristics), 1);
|
||||
}
|
||||
|
||||
/* read a resource identifier */
|
||||
void
|
||||
read_res_id (id)
|
||||
struct res_id *id;
|
||||
{
|
||||
unsigned short ord;
|
||||
unichar *id_s = NULL;
|
||||
int len;
|
||||
|
||||
read_res_data (&ord, sizeof (ord), 1);
|
||||
if (ord == 0xFFFF) /* an ordinal id */
|
||||
{
|
||||
read_res_data (&ord, sizeof (ord), 1);
|
||||
id->named = 0;
|
||||
id->u.id = ord;
|
||||
}
|
||||
else
|
||||
/* named id */
|
||||
{
|
||||
if (fseek (fres, -sizeof (ord), SEEK_CUR) != 0)
|
||||
fatal ("%s: %s: could not seek in file", program_name, filename);
|
||||
id_s = read_unistring (&len);
|
||||
id->named = 1;
|
||||
id->u.n.length = len;
|
||||
id->u.n.name = id_s;
|
||||
}
|
||||
}
|
||||
|
||||
/* Read a null terminated UNICODE string */
|
||||
static unichar *
|
||||
read_unistring (len)
|
||||
int *len;
|
||||
{
|
||||
unichar *s;
|
||||
unichar c;
|
||||
unichar *p;
|
||||
int l;
|
||||
|
||||
*len = 0;
|
||||
l = 0;
|
||||
|
||||
/* there are hardly any names longer than 256 characters */
|
||||
p = s = (unichar *) xmalloc (sizeof (unichar) * 256);
|
||||
do
|
||||
{
|
||||
read_res_data (&c, sizeof (c), 1);
|
||||
*p++ = c;
|
||||
if (c != 0)
|
||||
l++;
|
||||
}
|
||||
while (c != 0);
|
||||
*len = l;
|
||||
return s;
|
||||
}
|
||||
|
||||
/* align file on DWORD boundary */
|
||||
static void
|
||||
res_align_file (void)
|
||||
{
|
||||
if (fseek (fres, ftell (fres) % 4, SEEK_CUR) != 0)
|
||||
fatal ("%s: %s: unable to align file", program_name, filename);
|
||||
}
|
||||
|
||||
/* Check if file is a win32 binary resource file, if so
|
||||
skip past the null resource. Returns 0 if successful, -1 on
|
||||
error.
|
||||
*/
|
||||
static void
|
||||
skip_null_resource (void)
|
||||
{
|
||||
struct res_hdr reshdr =
|
||||
{0, 0};
|
||||
read_res_data (&reshdr, sizeof (reshdr), 1);
|
||||
if ((reshdr.data_size != 0) || (reshdr.header_size != 0x20))
|
||||
goto skip_err;
|
||||
|
||||
/* Subtract size of HeaderSize and DataSize */
|
||||
if (fseek (fres, reshdr.header_size - 8, SEEK_CUR) != 0)
|
||||
goto skip_err;
|
||||
|
||||
return;
|
||||
|
||||
skip_err:
|
||||
fprintf (stderr, "%s: %s: Not a valid WIN32 resource file\n", program_name,
|
||||
filename);
|
||||
xexit (1);
|
||||
}
|
||||
|
||||
/* Add a resource to resource directory */
|
||||
void
|
||||
res_add_resource (r, type, id, language, dupok)
|
||||
struct res_resource *r;
|
||||
const struct res_id *type;
|
||||
const struct res_id *id;
|
||||
int language;
|
||||
int dupok;
|
||||
{
|
||||
struct res_id a[3];
|
||||
|
||||
a[0] = *type;
|
||||
a[1] = *id;
|
||||
a[2].named = 0;
|
||||
a[2].u.id = language;
|
||||
res_append_resource (&resources, r, 3, a, dupok);
|
||||
}
|
||||
|
||||
/* Append a resource to resource directory.
|
||||
This is just copied from define_resource
|
||||
and modified to add an existing resource.
|
||||
*/
|
||||
void
|
||||
res_append_resource (resources, resource, cids, ids, dupok)
|
||||
struct res_directory **resources;
|
||||
struct res_resource *resource;
|
||||
int cids;
|
||||
const struct res_id *ids;
|
||||
int dupok;
|
||||
{
|
||||
struct res_entry *re = NULL;
|
||||
int i;
|
||||
|
||||
assert (cids > 0);
|
||||
for (i = 0; i < cids; i++)
|
||||
{
|
||||
struct res_entry **pp;
|
||||
|
||||
if (*resources == NULL)
|
||||
{
|
||||
static unsigned long timeval;
|
||||
|
||||
/* Use the same timestamp for every resource created in a
|
||||
single run. */
|
||||
if (timeval == 0)
|
||||
timeval = time (NULL);
|
||||
|
||||
*resources = ((struct res_directory *)
|
||||
res_alloc (sizeof **resources));
|
||||
(*resources)->characteristics = 0;
|
||||
(*resources)->time = timeval;
|
||||
(*resources)->major = 0;
|
||||
(*resources)->minor = 0;
|
||||
(*resources)->entries = NULL;
|
||||
}
|
||||
|
||||
for (pp = &(*resources)->entries; *pp != NULL; pp = &(*pp)->next)
|
||||
if (res_id_cmp ((*pp)->id, ids[i]) == 0)
|
||||
break;
|
||||
|
||||
if (*pp != NULL)
|
||||
re = *pp;
|
||||
else
|
||||
{
|
||||
re = (struct res_entry *) res_alloc (sizeof *re);
|
||||
re->next = NULL;
|
||||
re->id = ids[i];
|
||||
if ((i + 1) < cids)
|
||||
{
|
||||
re->subdir = 1;
|
||||
re->u.dir = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
re->subdir = 0;
|
||||
re->u.res = NULL;
|
||||
}
|
||||
|
||||
*pp = re;
|
||||
}
|
||||
|
||||
if ((i + 1) < cids)
|
||||
{
|
||||
if (!re->subdir)
|
||||
{
|
||||
fprintf (stderr, "%s: ", program_name);
|
||||
res_ids_print (stderr, i, ids);
|
||||
fprintf (stderr, ": expected to be a directory\n");
|
||||
xexit (1);
|
||||
}
|
||||
|
||||
resources = &re->u.dir;
|
||||
}
|
||||
}
|
||||
|
||||
if (re->subdir)
|
||||
{
|
||||
fprintf (stderr, "%s: ", program_name);
|
||||
res_ids_print (stderr, cids, ids);
|
||||
fprintf (stderr, ": expected to be a leaf\n");
|
||||
xexit (1);
|
||||
}
|
||||
|
||||
if (re->u.res != NULL)
|
||||
{
|
||||
if (dupok)
|
||||
return;
|
||||
|
||||
fprintf (stderr, "%s: warning: ", program_name);
|
||||
res_ids_print (stderr, cids, ids);
|
||||
fprintf (stderr, ": duplicate value\n");
|
||||
}
|
||||
|
||||
re->u.res = resource;
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
#!/bin/sh
|
||||
### quick sanity test for the binutils.
|
||||
###
|
||||
### This file was written and is maintained by K. Richard Pixley,
|
||||
### rich@cygnus.com.
|
||||
|
||||
### fail on errors
|
||||
set -e
|
||||
|
||||
### first arg is directory in which binaries to be tested reside.
|
||||
case "$1" in
|
||||
"") BIN=. ;;
|
||||
*) BIN="$1" ;;
|
||||
esac
|
||||
|
||||
### size
|
||||
for i in size objdump nm ar strip ranlib ; do
|
||||
${BIN}/size ${BIN}/$i > /dev/null
|
||||
done
|
||||
|
||||
### objdump
|
||||
for i in size objdump nm ar strip ranlib ; do
|
||||
${BIN}/objdump -ahifdrtxsl ${BIN}/$i > /dev/null
|
||||
done
|
||||
|
||||
### nm
|
||||
for i in size objdump nm ar strip ranlib ; do
|
||||
${BIN}/nm ${BIN}/$i > /dev/null
|
||||
done
|
||||
|
||||
### strip
|
||||
TMPDIR=./binutils-$$
|
||||
mkdir ${TMPDIR}
|
||||
|
||||
cp ${BIN}/strip ${TMPDIR}/strip
|
||||
|
||||
for i in size objdump nm ar ranlib ; do
|
||||
cp ${BIN}/$i ${TMPDIR}/$i
|
||||
${BIN}/strip ${TMPDIR}/$i
|
||||
cp ${BIN}/$i ${TMPDIR}/$i
|
||||
${TMPDIR}/strip ${TMPDIR}/$i
|
||||
done
|
||||
|
||||
### ar
|
||||
|
||||
### ranlib
|
||||
|
||||
rm -rf ${TMPDIR}
|
||||
|
||||
exit 0
|
||||
161
binutils/size.1
161
binutils/size.1
@@ -1,161 +0,0 @@
|
||||
.\" Copyright (c) 1991 Free Software Foundation
|
||||
.\" See section COPYING for conditions for redistribution
|
||||
.TH size 1 "5 November 1991" "cygnus support" "GNU Development Tools"
|
||||
.de BP
|
||||
.sp
|
||||
.ti \-.2i
|
||||
\(**
|
||||
..
|
||||
|
||||
.SH NAME
|
||||
size \- list section sizes and total size.
|
||||
|
||||
.SH SYNOPSIS
|
||||
.hy 0
|
||||
.na
|
||||
.TP
|
||||
.B size
|
||||
.RB "[\|" \-A \||\| \-B \||\| \c
|
||||
.BI "\-\-format=" compatibility\c
|
||||
\&\|]
|
||||
.RB "[\|" \-\-help "\|]"
|
||||
.RB "[\|" \-d \||\| \-o \||\| \-x\c
|
||||
\||\|\c
|
||||
.BI "\-\-radix=" number\c
|
||||
\&\|]
|
||||
.RB "[\|" \c
|
||||
.BI "\-\-target=" bfdname\c
|
||||
\&\|]
|
||||
.RB "[\|" \-V \||\| \-\-version "\|]"
|
||||
.I objfile\c
|
||||
\&.\|.\|.
|
||||
.ad b
|
||||
.hy 1
|
||||
.SH DESCRIPTION
|
||||
The GNU \c
|
||||
.B size\c
|
||||
\& utility lists the section sizes\(em\&and the total
|
||||
size\(em\&for each of the object files
|
||||
.I objfile
|
||||
in its argument list.
|
||||
By default, one line of output is generated for each object file or each
|
||||
module in an archive.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-A
|
||||
.TP
|
||||
.B \-B
|
||||
.TP
|
||||
.BI "\-\-format " "compatibility"
|
||||
Using one of these options, you can choose whether the output from GNU
|
||||
\c
|
||||
.B size\c
|
||||
\& resembles output from System V \c
|
||||
.B size\c
|
||||
\& (using `\|\c
|
||||
.B \-A\c
|
||||
\|',
|
||||
or `\|\c
|
||||
.B \-\-format=sysv\c
|
||||
\|'), or Berkeley \c
|
||||
.B size\c
|
||||
\& (using `\|\c
|
||||
.B \-B\c
|
||||
\|', or
|
||||
`\|\c
|
||||
.B \-\-format=berkeley\c
|
||||
\|'). The default is the one-line format similar to
|
||||
Berkeley's.
|
||||
|
||||
.TP
|
||||
.B \-\-help
|
||||
Show a summary of acceptable arguments and options.
|
||||
|
||||
.TP
|
||||
.B \-d
|
||||
.TP
|
||||
.B \-o
|
||||
.TP
|
||||
.B \-x
|
||||
.TP
|
||||
.BI "\-\-radix " "number"
|
||||
Using one of these options, you can control whether the size of each
|
||||
section is given in decimal (`\|\c
|
||||
.B \-d\c
|
||||
\|', or `\|\c
|
||||
.B \-\-radix 10\c
|
||||
\|'); octal
|
||||
(`\|\c
|
||||
.B \-o\c
|
||||
\|', or `\|\c
|
||||
.B \-\-radix 8\c
|
||||
\|'); or hexadecimal (`\|\c
|
||||
.B \-x\c
|
||||
\|', or
|
||||
`\|\c
|
||||
.B \-\-radix 16\c
|
||||
\|'). In `\|\c
|
||||
.B \-\-radix \c
|
||||
.I number\c
|
||||
\&\c
|
||||
\|', only the three
|
||||
values (8, 10, 16) are supported. The total size is always given in two
|
||||
radices; decimal and hexadecimal for `\|\c
|
||||
.B \-d\c
|
||||
\|' or `\|\c
|
||||
.B \-x\c
|
||||
\|' output, or
|
||||
octal and hexadecimal if you're using `\|\c
|
||||
.B \-o\c
|
||||
\|'.
|
||||
|
||||
.TP
|
||||
.BI "\-\-target " "bfdname"
|
||||
You can specify a particular object-code format for \c
|
||||
.I objfile\c
|
||||
\& as
|
||||
\c
|
||||
.I bfdname\c
|
||||
\&. This may not be necessary; \c
|
||||
.I size\c
|
||||
\& can
|
||||
automatically recognize many formats. See
|
||||
.BR objdump ( 1 )
|
||||
for information
|
||||
on listing available formats.
|
||||
|
||||
.TP
|
||||
.B \-V
|
||||
.TP
|
||||
.B \-\-version
|
||||
Display version number information on \c
|
||||
.B size\c
|
||||
\& itself.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.RB "`\|" binutils "\|'"
|
||||
entry in
|
||||
.BR info ;
|
||||
.IR "The GNU Binary Utilities" ,
|
||||
Roland H. Pesch (October 1991);
|
||||
.BR ar "(" 1 "),"
|
||||
.BR objdump ( 1 ).
|
||||
|
||||
.SH COPYING
|
||||
Copyright (c) 1991 Free Software Foundation, Inc.
|
||||
.PP
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
.PP
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the
|
||||
entire resulting derived work is distributed under the terms of a
|
||||
permission notice identical to this one.
|
||||
.PP
|
||||
Permission is granted to copy and distribute translations of this
|
||||
manual into another language, under the above conditions for modified
|
||||
versions, except that this permission notice may be included in
|
||||
translations approved by the Free Software Foundation instead of in
|
||||
the original English.
|
||||
515
binutils/size.c
515
binutils/size.c
@@ -1,515 +0,0 @@
|
||||
/* size.c -- report size of various sections of an executable file.
|
||||
Copyright 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Extensions/incompatibilities:
|
||||
o - BSD output has filenames at the end.
|
||||
o - BSD output can appear in different radicies.
|
||||
o - SysV output has less redundant whitespace. Filename comes at end.
|
||||
o - SysV output doesn't show VMA which is always the same as the PMA.
|
||||
o - We also handle core files.
|
||||
o - We also handle archives.
|
||||
If you write shell scripts which manipulate this info then you may be
|
||||
out of luck; there's no --compatibility or --pedantic option.
|
||||
*/
|
||||
|
||||
#include "bfd.h"
|
||||
#include "getopt.h"
|
||||
#include "bucomm.h"
|
||||
#include "libiberty.h"
|
||||
|
||||
#ifndef BSD_DEFAULT
|
||||
#define BSD_DEFAULT 1
|
||||
#endif
|
||||
|
||||
/* Program options. */
|
||||
|
||||
enum
|
||||
{
|
||||
decimal, octal, hex
|
||||
} radix = decimal;
|
||||
int berkeley_format = BSD_DEFAULT; /* 0 means use AT&T-style output. */
|
||||
int show_version = 0;
|
||||
int show_help = 0;
|
||||
|
||||
/* Program exit status. */
|
||||
int return_code = 0;
|
||||
|
||||
static char *target = NULL;
|
||||
|
||||
/* Static declarations */
|
||||
|
||||
static void usage PARAMS ((FILE *, int));
|
||||
static void display_file PARAMS ((char *filename));
|
||||
static void display_bfd PARAMS ((bfd *));
|
||||
static void display_archive PARAMS ((bfd *));
|
||||
static int size_number PARAMS ((bfd_size_type));
|
||||
#if 0
|
||||
static void lprint_number PARAMS ((int, bfd_size_type));
|
||||
#endif
|
||||
static void rprint_number PARAMS ((int, bfd_size_type));
|
||||
static void print_berkeley_format PARAMS ((bfd *));
|
||||
static void sysv_internal_sizer PARAMS ((bfd *, asection *, PTR));
|
||||
static void sysv_internal_printer PARAMS ((bfd *, asection *, PTR));
|
||||
static void print_sysv_format PARAMS ((bfd *));
|
||||
static void print_sizes PARAMS ((bfd * file));
|
||||
static void berkeley_sum PARAMS ((bfd *, sec_ptr, PTR));
|
||||
|
||||
static void
|
||||
usage (stream, status)
|
||||
FILE *stream;
|
||||
int status;
|
||||
{
|
||||
fprintf (stream, _("\
|
||||
Usage: %s [-ABdoxV] [--format=berkeley|sysv] [--radix=8|10|16]\n\
|
||||
[--target=bfdname] [--version] [--help] [file...]\n"), program_name);
|
||||
#if BSD_DEFAULT
|
||||
fputs (_("default is --format=berkeley\n"), stream);
|
||||
#else
|
||||
fputs (_("default is --format=sysv\n"), stream);
|
||||
#endif
|
||||
list_supported_targets (program_name, stream);
|
||||
if (status == 0)
|
||||
fprintf (stream, _("Report bugs to %s\n"), REPORT_BUGS_TO);
|
||||
exit (status);
|
||||
}
|
||||
|
||||
struct option long_options[] =
|
||||
{
|
||||
{"format", required_argument, 0, 200},
|
||||
{"radix", required_argument, 0, 201},
|
||||
{"target", required_argument, 0, 202},
|
||||
{"version", no_argument, &show_version, 1},
|
||||
{"help", no_argument, &show_help, 1},
|
||||
{0, no_argument, 0, 0}
|
||||
};
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
int temp;
|
||||
int c;
|
||||
|
||||
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
|
||||
setlocale (LC_MESSAGES, "");
|
||||
#endif
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
program_name = *argv;
|
||||
xmalloc_set_program_name (program_name);
|
||||
|
||||
bfd_init ();
|
||||
set_default_bfd_target ();
|
||||
|
||||
while ((c = getopt_long (argc, argv, "ABVdox", long_options,
|
||||
(int *) 0)) != EOF)
|
||||
switch (c)
|
||||
{
|
||||
case 200: /* --format */
|
||||
switch (*optarg)
|
||||
{
|
||||
case 'B':
|
||||
case 'b':
|
||||
berkeley_format = 1;
|
||||
break;
|
||||
case 'S':
|
||||
case 's':
|
||||
berkeley_format = 0;
|
||||
break;
|
||||
default:
|
||||
non_fatal (_("invalid argument to --format: %s"), optarg);
|
||||
usage (stderr, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case 202: /* --target */
|
||||
target = optarg;
|
||||
break;
|
||||
|
||||
case 201: /* --radix */
|
||||
#ifdef ANSI_LIBRARIES
|
||||
temp = strtol (optarg, NULL, 10);
|
||||
#else
|
||||
temp = atol (optarg);
|
||||
#endif
|
||||
switch (temp)
|
||||
{
|
||||
case 10:
|
||||
radix = decimal;
|
||||
break;
|
||||
case 8:
|
||||
radix = octal;
|
||||
break;
|
||||
case 16:
|
||||
radix = hex;
|
||||
break;
|
||||
default:
|
||||
non_fatal (_("Invalid radix: %s\n"), optarg);
|
||||
usage (stderr, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'A':
|
||||
berkeley_format = 0;
|
||||
break;
|
||||
case 'B':
|
||||
berkeley_format = 1;
|
||||
break;
|
||||
case 'V':
|
||||
show_version = 1;
|
||||
break;
|
||||
case 'd':
|
||||
radix = decimal;
|
||||
break;
|
||||
case 'x':
|
||||
radix = hex;
|
||||
break;
|
||||
case 'o':
|
||||
radix = octal;
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
case '?':
|
||||
usage (stderr, 1);
|
||||
}
|
||||
|
||||
if (show_version)
|
||||
print_version ("size");
|
||||
if (show_help)
|
||||
usage (stdout, 0);
|
||||
|
||||
if (optind == argc)
|
||||
display_file ("a.out");
|
||||
else
|
||||
for (; optind < argc;)
|
||||
display_file (argv[optind++]);
|
||||
|
||||
return return_code;
|
||||
}
|
||||
|
||||
/* Display stats on file or archive member ABFD. */
|
||||
|
||||
static void
|
||||
display_bfd (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
char **matching;
|
||||
|
||||
if (bfd_check_format (abfd, bfd_archive))
|
||||
/* An archive within an archive. */
|
||||
return;
|
||||
|
||||
if (bfd_check_format_matches (abfd, bfd_object, &matching))
|
||||
{
|
||||
print_sizes (abfd);
|
||||
printf ("\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (bfd_get_error () == bfd_error_file_ambiguously_recognized)
|
||||
{
|
||||
bfd_nonfatal (bfd_get_filename (abfd));
|
||||
list_matching_formats (matching);
|
||||
free (matching);
|
||||
return_code = 3;
|
||||
return;
|
||||
}
|
||||
|
||||
if (bfd_check_format_matches (abfd, bfd_core, &matching))
|
||||
{
|
||||
CONST char *core_cmd;
|
||||
|
||||
print_sizes (abfd);
|
||||
fputs (" (core file", stdout);
|
||||
|
||||
core_cmd = bfd_core_file_failing_command (abfd);
|
||||
if (core_cmd)
|
||||
printf (" invoked as %s", core_cmd);
|
||||
|
||||
puts (")\n");
|
||||
return;
|
||||
}
|
||||
|
||||
bfd_nonfatal (bfd_get_filename (abfd));
|
||||
|
||||
if (bfd_get_error () == bfd_error_file_ambiguously_recognized)
|
||||
{
|
||||
list_matching_formats (matching);
|
||||
free (matching);
|
||||
}
|
||||
|
||||
return_code = 3;
|
||||
}
|
||||
|
||||
static void
|
||||
display_archive (file)
|
||||
bfd *file;
|
||||
{
|
||||
bfd *arfile = (bfd *) NULL;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
bfd_set_error (bfd_error_no_error);
|
||||
|
||||
arfile = bfd_openr_next_archived_file (file, arfile);
|
||||
if (arfile == NULL)
|
||||
{
|
||||
if (bfd_get_error () != bfd_error_no_more_archived_files)
|
||||
{
|
||||
bfd_nonfatal (bfd_get_filename (file));
|
||||
return_code = 2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
display_bfd (arfile);
|
||||
/* Don't close the archive elements; we need them for next_archive */
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
display_file (filename)
|
||||
char *filename;
|
||||
{
|
||||
bfd *file = bfd_openr (filename, target);
|
||||
if (file == NULL)
|
||||
{
|
||||
bfd_nonfatal (filename);
|
||||
return_code = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (bfd_check_format (file, bfd_archive) == true)
|
||||
display_archive (file);
|
||||
else
|
||||
display_bfd (file);
|
||||
|
||||
if (bfd_close (file) == false)
|
||||
{
|
||||
bfd_nonfatal (filename);
|
||||
return_code = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* This is what lexical functions are for. */
|
||||
|
||||
static int
|
||||
size_number (num)
|
||||
bfd_size_type num;
|
||||
{
|
||||
char buffer[40];
|
||||
sprintf (buffer,
|
||||
(radix == decimal ? "%lu" :
|
||||
((radix == octal) ? "0%lo" : "0x%lx")),
|
||||
(unsigned long) num);
|
||||
|
||||
return strlen (buffer);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
/* This is not used. */
|
||||
|
||||
static void
|
||||
lprint_number (width, num)
|
||||
int width;
|
||||
bfd_size_type num;
|
||||
{
|
||||
char buffer[40];
|
||||
sprintf (buffer,
|
||||
(radix == decimal ? "%lu" :
|
||||
((radix == octal) ? "0%lo" : "0x%lx")),
|
||||
(unsigned long) num);
|
||||
|
||||
printf ("%-*s", width, buffer);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
rprint_number (width, num)
|
||||
int width;
|
||||
bfd_size_type num;
|
||||
{
|
||||
char buffer[40];
|
||||
sprintf (buffer,
|
||||
(radix == decimal ? "%lu" :
|
||||
((radix == octal) ? "0%lo" : "0x%lx")),
|
||||
(unsigned long) num);
|
||||
|
||||
printf ("%*s", width, buffer);
|
||||
}
|
||||
|
||||
static bfd_size_type bsssize;
|
||||
static bfd_size_type datasize;
|
||||
static bfd_size_type textsize;
|
||||
|
||||
static void
|
||||
berkeley_sum (abfd, sec, ignore)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
sec_ptr sec;
|
||||
PTR ignore ATTRIBUTE_UNUSED;
|
||||
{
|
||||
flagword flags;
|
||||
bfd_size_type size;
|
||||
|
||||
flags = bfd_get_section_flags (abfd, sec);
|
||||
if ((flags & SEC_ALLOC) == 0)
|
||||
return;
|
||||
|
||||
size = bfd_get_section_size_before_reloc (sec);
|
||||
if ((flags & SEC_CODE) != 0 || (flags & SEC_READONLY) != 0)
|
||||
textsize += size;
|
||||
else if ((flags & SEC_HAS_CONTENTS) != 0)
|
||||
datasize += size;
|
||||
else
|
||||
bsssize += size;
|
||||
}
|
||||
|
||||
static void
|
||||
print_berkeley_format (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
static int files_seen = 0;
|
||||
bfd_size_type total;
|
||||
|
||||
bsssize = 0;
|
||||
datasize = 0;
|
||||
textsize = 0;
|
||||
|
||||
bfd_map_over_sections (abfd, berkeley_sum, (PTR) NULL);
|
||||
|
||||
if (files_seen++ == 0)
|
||||
#if 0
|
||||
/* Intel doesn't like bss/stk because they don't have core files. */
|
||||
puts ((radix == octal) ? " text\t data\tbss/stk\t oct\t hex\tfilename" :
|
||||
" text\t data\tbss/stk\t dec\t hex\tfilename");
|
||||
#else
|
||||
puts ((radix == octal) ? " text\t data\t bss\t oct\t hex\tfilename" :
|
||||
" text\t data\t bss\t dec\t hex\tfilename");
|
||||
#endif
|
||||
|
||||
total = textsize + datasize + bsssize;
|
||||
|
||||
rprint_number (7, textsize);
|
||||
putchar ('\t');
|
||||
rprint_number (7, datasize);
|
||||
putchar ('\t');
|
||||
rprint_number (7, bsssize);
|
||||
printf (((radix == octal) ? "\t%7lo\t%7lx\t" : "\t%7lu\t%7lx\t"),
|
||||
(unsigned long) total, (unsigned long) total);
|
||||
|
||||
fputs (bfd_get_filename (abfd), stdout);
|
||||
if (bfd_my_archive (abfd))
|
||||
printf (" (ex %s)", bfd_get_filename (bfd_my_archive (abfd)));
|
||||
}
|
||||
|
||||
/* I REALLY miss lexical functions! */
|
||||
bfd_size_type svi_total = 0;
|
||||
bfd_vma svi_maxvma = 0;
|
||||
int svi_namelen = 0;
|
||||
int svi_vmalen = 0;
|
||||
int svi_sizelen = 0;
|
||||
|
||||
static void
|
||||
sysv_internal_sizer (file, sec, ignore)
|
||||
bfd *file ATTRIBUTE_UNUSED;
|
||||
sec_ptr sec;
|
||||
PTR ignore ATTRIBUTE_UNUSED;
|
||||
{
|
||||
bfd_size_type size = bfd_section_size (file, sec);
|
||||
if (!bfd_is_abs_section (sec)
|
||||
&& !bfd_is_com_section (sec)
|
||||
&& !bfd_is_und_section (sec))
|
||||
{
|
||||
int namelen = strlen (bfd_section_name (file, sec));
|
||||
if (namelen > svi_namelen)
|
||||
svi_namelen = namelen;
|
||||
|
||||
svi_total += size;
|
||||
if (bfd_section_vma (file, sec) > svi_maxvma)
|
||||
svi_maxvma = bfd_section_vma (file, sec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
sysv_internal_printer (file, sec, ignore)
|
||||
bfd *file ATTRIBUTE_UNUSED;
|
||||
sec_ptr sec;
|
||||
PTR ignore ATTRIBUTE_UNUSED;
|
||||
{
|
||||
bfd_size_type size = bfd_section_size (file, sec);
|
||||
if (!bfd_is_abs_section (sec)
|
||||
&& !bfd_is_com_section (sec)
|
||||
&& !bfd_is_und_section (sec))
|
||||
{
|
||||
svi_total += size;
|
||||
|
||||
printf ("%-*s ", svi_namelen, bfd_section_name (file, sec));
|
||||
rprint_number (svi_sizelen, size);
|
||||
printf (" ");
|
||||
rprint_number (svi_vmalen, bfd_section_vma (file, sec));
|
||||
printf ("\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
print_sysv_format (file)
|
||||
bfd *file;
|
||||
{
|
||||
/* size all of the columns */
|
||||
svi_total = 0;
|
||||
svi_maxvma = 0;
|
||||
svi_namelen = 0;
|
||||
bfd_map_over_sections (file, sysv_internal_sizer, (PTR) NULL);
|
||||
svi_vmalen = size_number ((bfd_size_type)svi_maxvma);
|
||||
if ((size_t) svi_vmalen < sizeof ("addr") - 1)
|
||||
svi_vmalen = sizeof ("addr")-1;
|
||||
|
||||
svi_sizelen = size_number (svi_total);
|
||||
if ((size_t) svi_sizelen < sizeof ("size") - 1)
|
||||
svi_sizelen = sizeof ("size")-1;
|
||||
|
||||
svi_total = 0;
|
||||
printf ("%s ", bfd_get_filename (file));
|
||||
if (bfd_my_archive (file))
|
||||
printf (" (ex %s)", bfd_get_filename (bfd_my_archive (file)));
|
||||
|
||||
printf (":\n%-*s %*s %*s\n", svi_namelen, "section",
|
||||
svi_sizelen, "size", svi_vmalen, "addr");
|
||||
bfd_map_over_sections (file, sysv_internal_printer, (PTR) NULL);
|
||||
|
||||
printf ("%-*s ", svi_namelen, "Total");
|
||||
rprint_number (svi_sizelen, svi_total);
|
||||
printf ("\n\n");
|
||||
}
|
||||
|
||||
static void
|
||||
print_sizes (file)
|
||||
bfd *file;
|
||||
{
|
||||
if (berkeley_format)
|
||||
print_berkeley_format (file);
|
||||
else
|
||||
print_sysv_format (file);
|
||||
}
|
||||
2029
binutils/srconv.c
2029
binutils/srconv.c
File diff suppressed because it is too large
Load Diff
5209
binutils/stabs.c
5209
binutils/stabs.c
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
||||
timestamp
|
||||
@@ -1,151 +0,0 @@
|
||||
.\" Copyright (c) 1993, 94, 95, 2000 Free Software Foundation
|
||||
.\" See section COPYING for conditions for redistribution
|
||||
.TH strings 1 "09 March 2000" "cygnus support" "GNU Development Tools"
|
||||
.de BP
|
||||
.sp
|
||||
.ti \-.2i
|
||||
\(**
|
||||
..
|
||||
|
||||
.SH NAME
|
||||
strings \- print the strings of printable characters in files
|
||||
|
||||
.SH SYNOPSIS
|
||||
.hy 0
|
||||
.na
|
||||
.TP
|
||||
.B strings
|
||||
.RB "[\|" \-a | \-\c
|
||||
.RB | \-\-all "\|]"
|
||||
.RB "[\|" \-f | \-\-print\-file\-name "\|]"
|
||||
.RB "[\|" \-o "\|]"
|
||||
.RB "[\|" \-\-help "\|]"
|
||||
.RB "[\|" \-v | \-\-version "\|]"
|
||||
.RB "[\|" \-n
|
||||
.I min\-len\c
|
||||
.RI | \-min\-len\c
|
||||
.RB | "\-\-bytes="\c
|
||||
.I min\-len\c
|
||||
\&\|]
|
||||
.RB "[\|" \-t
|
||||
.I {o,x,d}\c
|
||||
.RB "[\|" "\-\-target=\fIbfdname" "\|]"
|
||||
.RB | "\-\-radix="\c
|
||||
.I {o,x,d}\c
|
||||
\&\|]
|
||||
.I file\c
|
||||
.ad b
|
||||
.hy 1
|
||||
.SH DESCRIPTION
|
||||
For each
|
||||
.I file
|
||||
given, GNU \c
|
||||
.B strings
|
||||
prints the printable character sequences that are at least 4
|
||||
characters long (or the number given with the options below) and are
|
||||
followed by an unprintable character. By default, it only prints the
|
||||
strings from the initialized and loaded sections of object files; for
|
||||
other types of files, it prints the strings from the whole file.
|
||||
|
||||
.PP
|
||||
.B strings
|
||||
is mainly useful for determining the contents of non-text files.
|
||||
|
||||
.SH OPTIONS
|
||||
The long and short forms of options, shown here as alternatives, are
|
||||
equivalent.
|
||||
|
||||
.TP
|
||||
.B \-a
|
||||
.TP
|
||||
.B \-\-all
|
||||
.TP
|
||||
.B \-
|
||||
Do not scan only the initialized and loaded sections of object files;
|
||||
scan the whole files.
|
||||
|
||||
.TP
|
||||
.B \-f
|
||||
.TP
|
||||
.B \-\-print\-file\-name
|
||||
Print the name of the file before each string.
|
||||
|
||||
.TP
|
||||
.B \-\-help
|
||||
Print a summary of the options to
|
||||
.B strings
|
||||
on the standard output and exit.
|
||||
|
||||
.TP
|
||||
.B \-v
|
||||
.TP
|
||||
.B \-\-version
|
||||
Print the version number
|
||||
of
|
||||
.B strings
|
||||
on the standard output and exit.
|
||||
|
||||
.TP
|
||||
.B "\-n \fImin\-len\fP"
|
||||
.TP
|
||||
.B "\-\fImin\-len\fP"
|
||||
.TP
|
||||
.B "\-\-bytes=\fImin\-len\fP"
|
||||
Print sequences of characters that are at least
|
||||
.I min\-len
|
||||
characters long, instead of the default 4.
|
||||
|
||||
.TP
|
||||
.BR "\-t " {o,x,d}
|
||||
.TP
|
||||
.BR "\-\-radix=" {o,x,d}
|
||||
Print the offset within the file before each string. The single
|
||||
character argument specifies the radix of the offset\(emoctal,
|
||||
hexadecimal, or decimal.
|
||||
|
||||
.TP
|
||||
.BI "\-\-target=" "bfdname"
|
||||
Specify an object code format other than your system's default format.
|
||||
See
|
||||
.BR objdump ( 1 ),
|
||||
for information on listing available formats.
|
||||
|
||||
.TP
|
||||
.B \-o
|
||||
Like
|
||||
.BR "\-t o" .
|
||||
|
||||
.PP
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.RB "`\|" binutils "\|'"
|
||||
entry in
|
||||
.B
|
||||
info\c
|
||||
\&;
|
||||
.I
|
||||
The GNU Binary Utilities\c
|
||||
\&, Roland H. Pesch (October 1991);
|
||||
.BR ar ( 1 ),
|
||||
.BR nm ( 1 ),
|
||||
.BR objdump ( 1 ),
|
||||
.BR ranlib ( 1 ).
|
||||
|
||||
|
||||
.SH COPYING
|
||||
Copyright (c) 1993 Free Software Foundation, Inc.
|
||||
.PP
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
.PP
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the
|
||||
entire resulting derived work is distributed under the terms of a
|
||||
permission notice identical to this one.
|
||||
.PP
|
||||
Permission is granted to copy and distribute translations of this
|
||||
manual into another language, under the above conditions for modified
|
||||
versions, except that this permission notice may be included in
|
||||
translations approved by the Free Software Foundation instead of in
|
||||
the original English.
|
||||
@@ -1,512 +0,0 @@
|
||||
/* strings -- print the strings of printable characters in files
|
||||
Copyright (C) 1993, 94, 95, 96, 97, 98, 99, 2000
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
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 2, 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
/* Usage: strings [options] file...
|
||||
|
||||
Options:
|
||||
--all
|
||||
-a
|
||||
- Do not scan only the initialized data section of object files.
|
||||
|
||||
--print-file-name
|
||||
-f Print the name of the file before each string.
|
||||
|
||||
--bytes=min-len
|
||||
-n min-len
|
||||
-min-len Print graphic char sequences, MIN-LEN or more bytes long,
|
||||
that are followed by a NUL or a newline. Default is 4.
|
||||
|
||||
--radix={o,x,d}
|
||||
-t {o,x,d} Print the offset within the file before each string,
|
||||
in octal/hex/decimal.
|
||||
|
||||
-o Like -to. (Some other implementations have -o like -to,
|
||||
others like -td. We chose one arbitrarily.)
|
||||
|
||||
--target=BFDNAME
|
||||
Specify a non-default object file format.
|
||||
|
||||
--help
|
||||
-h Print the usage message on the standard output.
|
||||
|
||||
--version
|
||||
-v Print the program version number.
|
||||
|
||||
Written by Richard Stallman <rms@gnu.ai.mit.edu>
|
||||
and David MacKenzie <djm@gnu.ai.mit.edu>. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include <stdio.h>
|
||||
#include <getopt.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include "bucomm.h"
|
||||
#include "libiberty.h"
|
||||
|
||||
#ifdef isascii
|
||||
#define isgraphic(c) (isascii (c) && isprint (c))
|
||||
#else
|
||||
#define isgraphic(c) (isprint (c))
|
||||
#endif
|
||||
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
/* The BFD section flags that identify an initialized data section. */
|
||||
#define DATA_FLAGS (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS)
|
||||
|
||||
/* Radix for printing addresses (must be 8, 10 or 16). */
|
||||
static int address_radix;
|
||||
|
||||
/* Minimum length of sequence of graphic chars to trigger output. */
|
||||
static int string_min;
|
||||
|
||||
/* true means print address within file for each string. */
|
||||
static boolean print_addresses;
|
||||
|
||||
/* true means print filename for each string. */
|
||||
static boolean print_filenames;
|
||||
|
||||
/* true means for object files scan only the data section. */
|
||||
static boolean datasection_only;
|
||||
|
||||
/* true if we found an initialized data section in the current file. */
|
||||
static boolean got_a_section;
|
||||
|
||||
/* The BFD object file format. */
|
||||
static char *target;
|
||||
|
||||
static struct option long_options[] =
|
||||
{
|
||||
{"all", no_argument, NULL, 'a'},
|
||||
{"print-file-name", no_argument, NULL, 'f'},
|
||||
{"bytes", required_argument, NULL, 'n'},
|
||||
{"radix", required_argument, NULL, 't'},
|
||||
{"target", required_argument, NULL, 'T'},
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{"version", no_argument, NULL, 'v'},
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
static void strings_a_section PARAMS ((bfd *, asection *, PTR));
|
||||
static boolean strings_object_file PARAMS ((const char *));
|
||||
static boolean strings_file PARAMS ((char *file));
|
||||
static int integer_arg PARAMS ((char *s));
|
||||
static void print_strings PARAMS ((const char *filename, FILE *stream,
|
||||
file_ptr address, int stop_point,
|
||||
int magiccount, char *magic));
|
||||
static void usage PARAMS ((FILE *stream, int status));
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
int optc;
|
||||
int exit_status = 0;
|
||||
boolean files_given = false;
|
||||
|
||||
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
|
||||
setlocale (LC_MESSAGES, "");
|
||||
#endif
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
program_name = argv[0];
|
||||
xmalloc_set_program_name (program_name);
|
||||
string_min = -1;
|
||||
print_addresses = false;
|
||||
print_filenames = false;
|
||||
datasection_only = true;
|
||||
target = NULL;
|
||||
|
||||
while ((optc = getopt_long (argc, argv, "afn:ot:v0123456789",
|
||||
long_options, (int *) 0)) != EOF)
|
||||
{
|
||||
switch (optc)
|
||||
{
|
||||
case 'a':
|
||||
datasection_only = false;
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
print_filenames = true;
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
usage (stdout, 0);
|
||||
|
||||
case 'n':
|
||||
string_min = integer_arg (optarg);
|
||||
if (string_min < 1)
|
||||
{
|
||||
fatal (_("invalid number %s"), optarg);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'o':
|
||||
print_addresses = true;
|
||||
address_radix = 8;
|
||||
break;
|
||||
|
||||
case 't':
|
||||
print_addresses = true;
|
||||
if (optarg[1] != '\0')
|
||||
usage (stderr, 1);
|
||||
switch (optarg[0])
|
||||
{
|
||||
case 'o':
|
||||
address_radix = 8;
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
address_radix = 10;
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
address_radix = 16;
|
||||
break;
|
||||
|
||||
default:
|
||||
usage (stderr, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'T':
|
||||
target = optarg;
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
print_version ("strings");
|
||||
break;
|
||||
|
||||
case '?':
|
||||
usage (stderr, 1);
|
||||
|
||||
default:
|
||||
if (string_min < 0)
|
||||
string_min = optc - '0';
|
||||
else
|
||||
string_min = string_min * 10 + optc - '0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (string_min < 0)
|
||||
string_min = 4;
|
||||
|
||||
bfd_init ();
|
||||
set_default_bfd_target ();
|
||||
|
||||
if (optind >= argc)
|
||||
{
|
||||
datasection_only = false;
|
||||
print_strings ("{standard input}", stdin, 0, 0, 0, (char *) NULL);
|
||||
files_given = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (; optind < argc; ++optind)
|
||||
{
|
||||
if (strcmp (argv[optind], "-") == 0)
|
||||
datasection_only = false;
|
||||
else
|
||||
{
|
||||
files_given = true;
|
||||
exit_status |= (strings_file (argv[optind]) == false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (files_given == false)
|
||||
usage (stderr, 1);
|
||||
|
||||
return (exit_status);
|
||||
}
|
||||
|
||||
/* Scan section SECT of the file ABFD, whose printable name is FILE.
|
||||
If it contains initialized data,
|
||||
set `got_a_section' and print the strings in it. */
|
||||
|
||||
static void
|
||||
strings_a_section (abfd, sect, filearg)
|
||||
bfd *abfd;
|
||||
asection *sect;
|
||||
PTR filearg;
|
||||
{
|
||||
const char *file = (const char *) filearg;
|
||||
|
||||
if ((sect->flags & DATA_FLAGS) == DATA_FLAGS)
|
||||
{
|
||||
bfd_size_type sz = bfd_get_section_size_before_reloc (sect);
|
||||
PTR mem = xmalloc (sz);
|
||||
if (bfd_get_section_contents (abfd, sect, mem, (file_ptr) 0, sz))
|
||||
{
|
||||
got_a_section = true;
|
||||
print_strings (file, (FILE *) NULL, sect->filepos, 0, sz, mem);
|
||||
}
|
||||
free (mem);
|
||||
}
|
||||
}
|
||||
|
||||
/* Scan all of the sections in FILE, and print the strings
|
||||
in the initialized data section(s).
|
||||
|
||||
Return true if successful,
|
||||
false if not (such as if FILE is not an object file). */
|
||||
|
||||
static boolean
|
||||
strings_object_file (file)
|
||||
const char *file;
|
||||
{
|
||||
bfd *abfd = bfd_openr (file, target);
|
||||
|
||||
if (abfd == NULL)
|
||||
{
|
||||
/* Treat the file as a non-object file. */
|
||||
return false;
|
||||
}
|
||||
|
||||
/* This call is mainly for its side effect of reading in the sections.
|
||||
We follow the traditional behavior of `strings' in that we don't
|
||||
complain if we don't recognize a file to be an object file. */
|
||||
if (bfd_check_format (abfd, bfd_object) == false)
|
||||
{
|
||||
bfd_close (abfd);
|
||||
return false;
|
||||
}
|
||||
|
||||
got_a_section = false;
|
||||
bfd_map_over_sections (abfd, strings_a_section, (PTR) file);
|
||||
|
||||
if (!bfd_close (abfd))
|
||||
{
|
||||
bfd_nonfatal (file);
|
||||
return false;
|
||||
}
|
||||
|
||||
return got_a_section;
|
||||
}
|
||||
|
||||
/* Print the strings in FILE. Return true if ok, false if an error occurs. */
|
||||
|
||||
static boolean
|
||||
strings_file (file)
|
||||
char *file;
|
||||
{
|
||||
/* If we weren't told to scan the whole file,
|
||||
try to open it as an object file and only look at
|
||||
initialized data sections. If that fails, fall back to the
|
||||
whole file. */
|
||||
if (!datasection_only || !strings_object_file (file))
|
||||
{
|
||||
FILE *stream;
|
||||
|
||||
stream = fopen (file, "rb");
|
||||
/* Not all systems permit "rb", so try "r" if it failed. */
|
||||
if (stream == NULL)
|
||||
stream = fopen (file, "r");
|
||||
if (stream == NULL)
|
||||
{
|
||||
fprintf (stderr, "%s: ", program_name);
|
||||
perror (file);
|
||||
return false;
|
||||
}
|
||||
|
||||
print_strings (file, stream, (file_ptr) 0, 0, 0, (char *) 0);
|
||||
|
||||
if (fclose (stream) == EOF)
|
||||
{
|
||||
fprintf (stderr, "%s: ", program_name);
|
||||
perror (file);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Find the strings in file FILENAME, read from STREAM.
|
||||
Assume that STREAM is positioned so that the next byte read
|
||||
is at address ADDRESS in the file.
|
||||
Stop reading at address STOP_POINT in the file, if nonzero.
|
||||
|
||||
If STREAM is NULL, do not read from it.
|
||||
The caller can supply a buffer of characters
|
||||
to be processed before the data in STREAM.
|
||||
MAGIC is the address of the buffer and
|
||||
MAGICCOUNT is how many characters are in it.
|
||||
Those characters come at address ADDRESS and the data in STREAM follow. */
|
||||
|
||||
static void
|
||||
print_strings (filename, stream, address, stop_point, magiccount, magic)
|
||||
const char *filename;
|
||||
FILE *stream;
|
||||
file_ptr address;
|
||||
int stop_point;
|
||||
int magiccount;
|
||||
char *magic;
|
||||
{
|
||||
char *buf = (char *) xmalloc (string_min + 1);
|
||||
|
||||
while (1)
|
||||
{
|
||||
file_ptr start;
|
||||
int i;
|
||||
int c;
|
||||
|
||||
/* See if the next `string_min' chars are all graphic chars. */
|
||||
tryline:
|
||||
if (stop_point && address >= stop_point)
|
||||
break;
|
||||
start = address;
|
||||
for (i = 0; i < string_min; i++)
|
||||
{
|
||||
if (magiccount)
|
||||
{
|
||||
magiccount--;
|
||||
c = *magic++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (stream == NULL)
|
||||
return;
|
||||
c = getc (stream);
|
||||
if (c == EOF)
|
||||
return;
|
||||
}
|
||||
address++;
|
||||
if (!isgraphic (c))
|
||||
/* Found a non-graphic. Try again starting with next char. */
|
||||
goto tryline;
|
||||
buf[i] = c;
|
||||
}
|
||||
|
||||
/* We found a run of `string_min' graphic characters. Print up
|
||||
to the next non-graphic character. */
|
||||
|
||||
if (print_filenames)
|
||||
printf ("%s: ", filename);
|
||||
if (print_addresses)
|
||||
switch (address_radix)
|
||||
{
|
||||
case 8:
|
||||
printf ("%7lo ", (unsigned long) start);
|
||||
break;
|
||||
|
||||
case 10:
|
||||
printf ("%7ld ", (long) start);
|
||||
break;
|
||||
|
||||
case 16:
|
||||
printf ("%7lx ", (unsigned long) start);
|
||||
break;
|
||||
}
|
||||
|
||||
buf[i] = '\0';
|
||||
fputs (buf, stdout);
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (magiccount)
|
||||
{
|
||||
magiccount--;
|
||||
c = *magic++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (stream == NULL)
|
||||
break;
|
||||
c = getc (stream);
|
||||
if (c == EOF)
|
||||
break;
|
||||
}
|
||||
address++;
|
||||
if (! isgraphic (c))
|
||||
break;
|
||||
putchar (c);
|
||||
}
|
||||
|
||||
putchar ('\n');
|
||||
}
|
||||
}
|
||||
|
||||
/* Parse string S as an integer, using decimal radix by default,
|
||||
but allowing octal and hex numbers as in C. */
|
||||
|
||||
static int
|
||||
integer_arg (s)
|
||||
char *s;
|
||||
{
|
||||
int value;
|
||||
int radix = 10;
|
||||
char *p = s;
|
||||
int c;
|
||||
|
||||
if (*p != '0')
|
||||
radix = 10;
|
||||
else if (*++p == 'x')
|
||||
{
|
||||
radix = 16;
|
||||
p++;
|
||||
}
|
||||
else
|
||||
radix = 8;
|
||||
|
||||
value = 0;
|
||||
while (((c = *p++) >= '0' && c <= '9')
|
||||
|| (radix == 16 && (c & ~40) >= 'A' && (c & ~40) <= 'Z'))
|
||||
{
|
||||
value *= radix;
|
||||
if (c >= '0' && c <= '9')
|
||||
value += c - '0';
|
||||
else
|
||||
value += (c & ~40) - 'A';
|
||||
}
|
||||
|
||||
if (c == 'b')
|
||||
value *= 512;
|
||||
else if (c == 'B')
|
||||
value *= 1024;
|
||||
else
|
||||
p--;
|
||||
|
||||
if (*p)
|
||||
{
|
||||
fatal (_("invalid integer argument %s"), s);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
static void
|
||||
usage (stream, status)
|
||||
FILE *stream;
|
||||
int status;
|
||||
{
|
||||
fprintf (stream, _("\
|
||||
Usage: %s [-afov] [-n min-len] [-min-len] [-t {o,x,d}] [-]\n\
|
||||
[--all] [--print-file-name] [--bytes=min-len] [--radix={o,x,d}]\n\
|
||||
[--target=bfdname] [--help] [--version] file...\n"),
|
||||
program_name);
|
||||
list_supported_targets (program_name, stream);
|
||||
if (status == 0)
|
||||
fprintf (stream, _("Report bugs to %s\n"), REPORT_BUGS_TO);
|
||||
exit (status);
|
||||
}
|
||||
185
binutils/strip.1
185
binutils/strip.1
@@ -1,185 +0,0 @@
|
||||
.\" Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation
|
||||
.\" See section COPYING for conditions for redistribution
|
||||
.TH strip 1 "5 November 1991" "cygnus support" "GNU Development Tools"
|
||||
.de BP
|
||||
.sp
|
||||
.ti \-.2i
|
||||
\(**
|
||||
..
|
||||
|
||||
.SH NAME
|
||||
strip \- Discard symbols from object files.
|
||||
|
||||
.SH SYNOPSIS
|
||||
.hy 0
|
||||
.na
|
||||
.TP
|
||||
.B strip
|
||||
.RB "[\|" \-F\ \fIbfdname\fR\ |\ \fB\-\-target=\fIbfdname\fP "\|]"
|
||||
.RB "[\|" \-I\ \fIbfdname\fR\ |\ \fB\-\-input\-target=\fIbfdname\fP "\|]"
|
||||
.RB "[\|" \-O\ \fIbfdname\fR\ |\ \fB\-\-output\-target=\fIbfdname\fP "\|]"
|
||||
.RB "[\|" \-R\ \fIsectionname\fR\ |\ \fB\-\-remove\-section=\fIsectionname\fP "\|]"
|
||||
.RB "[\|" \-s\fR\ |\ \fB\-\-strip\-all "\|]"
|
||||
.RB "[\|" \-S\fR\ |\ \fB\-g\fR\ |\ \fB\-\-strip\-debug "\|]"
|
||||
.RB "[\|" \-\-strip\-unneeded\fR "\|]"
|
||||
.RB "[\|" \-x\fR\ |\ \fB\-\-discard\-all "\|]"
|
||||
.RB "[\|" \-X\fR\ |\ \fB\-\-discard\-locals "\|]"
|
||||
.RB "[\|" \-K\ \fIsymbolname\fR\ |\ \fB\-\-keep\-symbol=\fIsymbolname\fR "\|]"
|
||||
.RB "[\|" \-N\ \fIsymbolname\fR\ |\ \fB\-\-strip\-symbol=\fIsymbolname\fR "\|]"
|
||||
.RB "[\|" \-o\ \fIfile\f\R "\|]"
|
||||
.RB "[\|" \-p\fR\ |\ \fB\-\-preserve\-dates "\|]"
|
||||
.RB "[\|" \-v\fR\ |\ \fB\-\-verbose "\|]"
|
||||
.RB "[\|" \-V\fR\ |\ \fB\-\-version "\|]"
|
||||
.RB "[\|" \-V\fR\ |\ \fB\-\-help "\|]"
|
||||
.I objfile\c
|
||||
\&.\|.\|.
|
||||
|
||||
.SH DESCRIPTION
|
||||
GNU
|
||||
.B strip
|
||||
discards all symbols from the object files
|
||||
.IR objfile .
|
||||
The list of object files may include archives.
|
||||
At least one object file must be given.
|
||||
|
||||
.P
|
||||
.B strip
|
||||
modifies the files named in its argument,
|
||||
rather than writing modified copies under different names.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B "\-F \fIbfdname"
|
||||
.TP
|
||||
.B "\-\-target=\fIbfdname"
|
||||
Treat the original \fIobjfile\fP as a file with the object
|
||||
code format \fIbfdname\fP, and rewrite it in the same format.
|
||||
|
||||
.TP
|
||||
.B \-\-help
|
||||
Show a summary of the options to
|
||||
.B strip
|
||||
and exit.
|
||||
|
||||
.TP
|
||||
.B "\-I \fIbfdname
|
||||
.TP
|
||||
.B "\-\-input\-target=\fIbfdname"
|
||||
Treat the original \fIobjfile\fP as a file with the object
|
||||
code format \fIbfdname\fP.
|
||||
|
||||
.TP
|
||||
.B "\-O \fIbfdname\fP"
|
||||
.TP
|
||||
.B "\-\-output\-target=\fIbfdname"
|
||||
Replace \fIobjfile\fP with a file in the output format \fIbfdname\fP.
|
||||
|
||||
.TP
|
||||
.B "\-R \fIsectionname\fP"
|
||||
.TP
|
||||
.B "\-\-remove\-section=\fIsectionname"
|
||||
Remove the named section from the file. This option may be given more
|
||||
than once. Note that using this option inappropriately may make the
|
||||
object file unusable.
|
||||
|
||||
.TP
|
||||
.B \-s
|
||||
.TP
|
||||
.B \-\-strip\-all
|
||||
Remove all symbols.
|
||||
|
||||
.TP
|
||||
.B \-S
|
||||
.TP
|
||||
.B \-g
|
||||
.TP
|
||||
.B \-\-strip\-debug
|
||||
Remove debugging symbols only.
|
||||
|
||||
.TP
|
||||
.B \-\-strip\-unneeded
|
||||
Strip all symbols that are not needed for relocation processing.
|
||||
|
||||
.TP
|
||||
.B \-N \fIsymbolname\fR
|
||||
.TP
|
||||
.B \-\-strip\-symbol=\fIsymbolname
|
||||
Remove symbol \fIsymbolname\fP from the source file. This option
|
||||
may be given more than once, and may be combined with other strip
|
||||
options.
|
||||
|
||||
.TP
|
||||
.B \-o \fIfile\fR
|
||||
Put the stripped output in \fIfile\fR, rather than replacing the
|
||||
existing file. When this argument is used, only one \fIobjfile\fR
|
||||
argument may be specified.
|
||||
|
||||
.TP
|
||||
.B \-p
|
||||
.TP
|
||||
.B \-\-preserve-dates
|
||||
Preserve the access and modification dates of the file.
|
||||
|
||||
.TP
|
||||
.B \-x
|
||||
.TP
|
||||
.B \-\-discard\-all
|
||||
Remove non-global symbols.
|
||||
|
||||
.TP
|
||||
.B \-X
|
||||
.TP
|
||||
.B \-\-discard\-locals
|
||||
Remove compiler-generated local symbols.
|
||||
(These usually start with ``L'' or ``.''.)
|
||||
|
||||
.TP
|
||||
.B \-K \fIsymbolname\fR, \fB\-\-keep\-symbol=\fIsymbolname
|
||||
Copy only symbol \fIsymbolname\fP from the source file. This option
|
||||
may be given more than once.
|
||||
|
||||
.TP
|
||||
.B \-N \fIsymbolname\fR, \fB\-\-strip\-symbol=\fIsymbolname
|
||||
Do not copy symbol \fIsymbolname\fP from the source file. This option
|
||||
may be given more than once, and may be combined with strip options
|
||||
other than \fB\-K\fR.
|
||||
|
||||
.TP
|
||||
.B \-v
|
||||
.TP
|
||||
.B \-\-verbose
|
||||
Verbose output: list all object files modified. In the case of
|
||||
archives,
|
||||
.B "strip \-v"
|
||||
lists all members of the archive.
|
||||
|
||||
.TP
|
||||
.B \-V
|
||||
.TP
|
||||
.B \-\-version
|
||||
Show the version number for \fBstrip\fP and exit.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.RB "`\|" binutils "\|'"
|
||||
entry in
|
||||
.BR info ;
|
||||
.IR "The GNU Binary Utilities" ,
|
||||
Roland H. Pesch (October 1991).
|
||||
|
||||
.SH COPYING
|
||||
Copyright (c) 1991 Free Software Foundation, Inc.
|
||||
.PP
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
.PP
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the
|
||||
entire resulting derived work is distributed under the terms of a
|
||||
permission notice identical to this one.
|
||||
.PP
|
||||
Permission is granted to copy and distribute translations of this
|
||||
manual into another language, under the above conditions for modified
|
||||
versions, except that this permission notice may be included in
|
||||
translations approved by the Free Software Foundation instead of in
|
||||
the original English.
|
||||
@@ -1,786 +0,0 @@
|
||||
/* Sysroff object format dumper.
|
||||
Copyright (C) 1994, 95, 98, 99, 2000 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of 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 2 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
|
||||
/* Written by Steve Chamberlain <sac@cygnus.com>.
|
||||
|
||||
This program reads a SYSROFF object file and prints it in an
|
||||
almost human readable form to stdout. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "bucomm.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <libiberty.h>
|
||||
#include <getopt.h>
|
||||
#include "sysroff.h"
|
||||
|
||||
#define PROGRAM_VERSION "1.0"
|
||||
|
||||
static int dump = 1;
|
||||
static int segmented_p;
|
||||
static int code;
|
||||
static int addrsize = 4;
|
||||
static FILE *file;
|
||||
|
||||
char *
|
||||
getCHARS (ptr, idx, size, max)
|
||||
unsigned char *ptr;
|
||||
int *idx;
|
||||
int size;
|
||||
int max;
|
||||
{
|
||||
int oc = *idx / 8;
|
||||
char *r;
|
||||
int b = size;
|
||||
if (b >= max)
|
||||
{
|
||||
return "*undefined*";
|
||||
}
|
||||
|
||||
if (b == 0)
|
||||
{
|
||||
/* Got to work out the length of the string from self */
|
||||
b = ptr[oc++];
|
||||
(*idx) += 8;
|
||||
}
|
||||
|
||||
*idx += b * 8;
|
||||
r = xcalloc (b + 1, 1);
|
||||
memcpy (r, ptr + oc, b);
|
||||
r[b] = 0;
|
||||
return r;
|
||||
}
|
||||
|
||||
static void
|
||||
dh (ptr, size)
|
||||
unsigned char *ptr;
|
||||
int size;
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
int span = 16;
|
||||
|
||||
printf ("\n************************************************************\n");
|
||||
|
||||
for (i = 0; i < size; i += span)
|
||||
{
|
||||
for (j = 0; j < span; j++)
|
||||
{
|
||||
if (j + i < size)
|
||||
printf ("%02x ", ptr[i + j]);
|
||||
else
|
||||
printf (" ");
|
||||
}
|
||||
|
||||
for (j = 0; j < span && j + i < size; j++)
|
||||
{
|
||||
int c = ptr[i + j];
|
||||
if (c < 32 || c > 127)
|
||||
c = '.';
|
||||
printf ("%c", c);
|
||||
}
|
||||
printf ("\n");
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
fillup (ptr)
|
||||
char *ptr;
|
||||
{
|
||||
int size;
|
||||
int sum;
|
||||
int i;
|
||||
size = getc (file) - 2;
|
||||
fread (ptr, 1, size, file);
|
||||
sum = code + size + 2;
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
sum += ptr[i];
|
||||
}
|
||||
|
||||
if ((sum & 0xff) != 0xff)
|
||||
{
|
||||
printf ("SUM IS %x\n", sum);
|
||||
}
|
||||
if (dump)
|
||||
dh (ptr, size);
|
||||
|
||||
return size - 1;
|
||||
}
|
||||
|
||||
barray
|
||||
getBARRAY (ptr, idx, dsize, max)
|
||||
unsigned char *ptr;
|
||||
int *idx;
|
||||
int dsize;
|
||||
int max;
|
||||
{
|
||||
barray res;
|
||||
int i;
|
||||
int byte = *idx / 8;
|
||||
int size = ptr[byte++];
|
||||
res.len = size;
|
||||
res.data = (unsigned char *) xmalloc (size);
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
res.data[i] = ptr[byte++];
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int
|
||||
getINT (ptr, idx, size, max)
|
||||
unsigned char *ptr;
|
||||
int *idx;
|
||||
int size;
|
||||
int max;
|
||||
{
|
||||
int n = 0;
|
||||
int byte = *idx / 8;
|
||||
|
||||
if (byte >= max)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (size == -2)
|
||||
size = addrsize;
|
||||
if (size == -1)
|
||||
size = 0;
|
||||
switch (size)
|
||||
{
|
||||
case 0:
|
||||
return 0;
|
||||
case 1:
|
||||
n = (ptr[byte]);
|
||||
break;
|
||||
case 2:
|
||||
n = (ptr[byte + 0] << 8) + ptr[byte + 1];
|
||||
break;
|
||||
case 4:
|
||||
n = (ptr[byte + 0] << 24) + (ptr[byte + 1] << 16) + (ptr[byte + 2] << 8) + (ptr[byte + 3]);
|
||||
break;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
*idx += size * 8;
|
||||
return n;
|
||||
}
|
||||
|
||||
int
|
||||
getBITS (ptr, idx, size, max)
|
||||
char *ptr;
|
||||
int *idx;
|
||||
int size, max;
|
||||
{
|
||||
int byte = *idx / 8;
|
||||
int bit = *idx % 8;
|
||||
|
||||
if (byte >= max)
|
||||
return 0;
|
||||
|
||||
*idx += size;
|
||||
|
||||
return (ptr[byte] >> (8 - bit - size)) & ((1 << size) - 1);
|
||||
}
|
||||
|
||||
static void
|
||||
itheader (name, code)
|
||||
char *name;
|
||||
int code;
|
||||
{
|
||||
printf ("\n%s 0x%02x\n", name, code);
|
||||
}
|
||||
|
||||
static int indent;
|
||||
static void
|
||||
p ()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < indent; i++)
|
||||
{
|
||||
printf ("| ");
|
||||
}
|
||||
printf ("> ");
|
||||
}
|
||||
|
||||
static void
|
||||
tabout ()
|
||||
{
|
||||
p ();
|
||||
}
|
||||
|
||||
static void
|
||||
pbarray (y)
|
||||
barray *y;
|
||||
{
|
||||
int x;
|
||||
printf ("%d (", y->len);
|
||||
for (x = 0; x < y->len; x++)
|
||||
{
|
||||
printf ("(%02x %c)", y->data[x], isprint (y->data[x]) ? y->data[x] : '.');
|
||||
}
|
||||
printf (")\n");
|
||||
}
|
||||
|
||||
#define SYSROFF_PRINT
|
||||
#define SYSROFF_SWAP_IN
|
||||
|
||||
#include "sysroff.c"
|
||||
|
||||
/*
|
||||
* FIXME: sysinfo, which generates sysroff.[ch] from sysroff.info, can't
|
||||
* hack the special case of the tr block, which has no contents. So we
|
||||
* implement our own functions for reading in and printing out the tr
|
||||
* block.
|
||||
*/
|
||||
|
||||
#define IT_tr_CODE 0x7f
|
||||
void
|
||||
sysroff_swap_tr_in()
|
||||
{
|
||||
char raw[255];
|
||||
|
||||
memset(raw, 0, 255);
|
||||
fillup(raw);
|
||||
}
|
||||
|
||||
void
|
||||
sysroff_print_tr_out()
|
||||
{
|
||||
itheader("tr", IT_tr_CODE);
|
||||
}
|
||||
|
||||
static int
|
||||
getone (type)
|
||||
int type;
|
||||
{
|
||||
int c = getc (file);
|
||||
code = c;
|
||||
|
||||
if ((c & 0x7f) != type)
|
||||
{
|
||||
ungetc (c, file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (c & 0x7f)
|
||||
{
|
||||
case IT_cs_CODE:
|
||||
{
|
||||
struct IT_cs dummy;
|
||||
sysroff_swap_cs_in (&dummy);
|
||||
sysroff_print_cs_out (&dummy);
|
||||
}
|
||||
break;
|
||||
case IT_dln_CODE:
|
||||
{
|
||||
struct IT_dln dummy;
|
||||
sysroff_swap_dln_in (&dummy);
|
||||
sysroff_print_dln_out (&dummy);
|
||||
}
|
||||
break;
|
||||
case IT_hd_CODE:
|
||||
{
|
||||
struct IT_hd dummy;
|
||||
sysroff_swap_hd_in (&dummy);
|
||||
addrsize = dummy.afl;
|
||||
sysroff_print_hd_out (&dummy);
|
||||
}
|
||||
break;
|
||||
case IT_dar_CODE:
|
||||
{
|
||||
struct IT_dar dummy;
|
||||
sysroff_swap_dar_in (&dummy);
|
||||
sysroff_print_dar_out (&dummy);
|
||||
}
|
||||
break;
|
||||
case IT_dsy_CODE:
|
||||
{
|
||||
struct IT_dsy dummy;
|
||||
sysroff_swap_dsy_in (&dummy);
|
||||
sysroff_print_dsy_out (&dummy);
|
||||
}
|
||||
break;
|
||||
case IT_dfp_CODE:
|
||||
{
|
||||
struct IT_dfp dummy;
|
||||
sysroff_swap_dfp_in (&dummy);
|
||||
sysroff_print_dfp_out (&dummy);
|
||||
}
|
||||
break;
|
||||
case IT_dso_CODE:
|
||||
{
|
||||
struct IT_dso dummy;
|
||||
sysroff_swap_dso_in (&dummy);
|
||||
sysroff_print_dso_out (&dummy);
|
||||
}
|
||||
break;
|
||||
case IT_dpt_CODE:
|
||||
{
|
||||
struct IT_dpt dummy;
|
||||
sysroff_swap_dpt_in (&dummy);
|
||||
sysroff_print_dpt_out (&dummy);
|
||||
}
|
||||
break;
|
||||
case IT_den_CODE:
|
||||
{
|
||||
struct IT_den dummy;
|
||||
sysroff_swap_den_in (&dummy);
|
||||
sysroff_print_den_out (&dummy);
|
||||
}
|
||||
break;
|
||||
case IT_dbt_CODE:
|
||||
{
|
||||
struct IT_dbt dummy;
|
||||
sysroff_swap_dbt_in (&dummy);
|
||||
sysroff_print_dbt_out (&dummy);
|
||||
}
|
||||
break;
|
||||
case IT_dty_CODE:
|
||||
{
|
||||
struct IT_dty dummy;
|
||||
sysroff_swap_dty_in (&dummy);
|
||||
sysroff_print_dty_out (&dummy);
|
||||
}
|
||||
break;
|
||||
case IT_un_CODE:
|
||||
{
|
||||
struct IT_un dummy;
|
||||
sysroff_swap_un_in (&dummy);
|
||||
sysroff_print_un_out (&dummy);
|
||||
}
|
||||
break;
|
||||
case IT_sc_CODE:
|
||||
{
|
||||
struct IT_sc dummy;
|
||||
sysroff_swap_sc_in (&dummy);
|
||||
sysroff_print_sc_out (&dummy);
|
||||
}
|
||||
break;
|
||||
case IT_er_CODE:
|
||||
{
|
||||
struct IT_er dummy;
|
||||
sysroff_swap_er_in (&dummy);
|
||||
sysroff_print_er_out (&dummy);
|
||||
}
|
||||
break;
|
||||
case IT_ed_CODE:
|
||||
{
|
||||
struct IT_ed dummy;
|
||||
sysroff_swap_ed_in (&dummy);
|
||||
sysroff_print_ed_out (&dummy);
|
||||
}
|
||||
break;
|
||||
case IT_sh_CODE:
|
||||
{
|
||||
struct IT_sh dummy;
|
||||
sysroff_swap_sh_in (&dummy);
|
||||
sysroff_print_sh_out (&dummy);
|
||||
}
|
||||
break;
|
||||
case IT_ob_CODE:
|
||||
{
|
||||
struct IT_ob dummy;
|
||||
sysroff_swap_ob_in (&dummy);
|
||||
sysroff_print_ob_out (&dummy);
|
||||
}
|
||||
break;
|
||||
case IT_rl_CODE:
|
||||
{
|
||||
struct IT_rl dummy;
|
||||
sysroff_swap_rl_in (&dummy);
|
||||
sysroff_print_rl_out (&dummy);
|
||||
}
|
||||
break;
|
||||
case IT_du_CODE:
|
||||
{
|
||||
struct IT_du dummy;
|
||||
sysroff_swap_du_in (&dummy);
|
||||
|
||||
sysroff_print_du_out (&dummy);
|
||||
}
|
||||
break;
|
||||
case IT_dus_CODE:
|
||||
{
|
||||
struct IT_dus dummy;
|
||||
sysroff_swap_dus_in (&dummy);
|
||||
sysroff_print_dus_out (&dummy);
|
||||
}
|
||||
break;
|
||||
case IT_dul_CODE:
|
||||
{
|
||||
struct IT_dul dummy;
|
||||
sysroff_swap_dul_in (&dummy);
|
||||
sysroff_print_dul_out (&dummy);
|
||||
}
|
||||
break;
|
||||
case IT_dss_CODE:
|
||||
{
|
||||
struct IT_dss dummy;
|
||||
sysroff_swap_dss_in (&dummy);
|
||||
sysroff_print_dss_out (&dummy);
|
||||
}
|
||||
break;
|
||||
case IT_hs_CODE:
|
||||
{
|
||||
struct IT_hs dummy;
|
||||
sysroff_swap_hs_in (&dummy);
|
||||
sysroff_print_hs_out (&dummy);
|
||||
}
|
||||
break;
|
||||
case IT_dps_CODE:
|
||||
{
|
||||
struct IT_dps dummy;
|
||||
sysroff_swap_dps_in (&dummy);
|
||||
sysroff_print_dps_out (&dummy);
|
||||
}
|
||||
break;
|
||||
case IT_tr_CODE:
|
||||
{
|
||||
sysroff_swap_tr_in ();
|
||||
sysroff_print_tr_out ();
|
||||
}
|
||||
break;
|
||||
case IT_dds_CODE:
|
||||
{
|
||||
struct IT_dds dummy;
|
||||
sysroff_swap_dds_in (&dummy);
|
||||
sysroff_print_dds_out (&dummy);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf ("GOT A %x\n", c);
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
opt (x)
|
||||
int x;
|
||||
{
|
||||
return getone (x);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
/* This is no longer used. */
|
||||
|
||||
static void
|
||||
unit_info_list ()
|
||||
{
|
||||
while (opt (IT_un_CODE))
|
||||
{
|
||||
getone (IT_us_CODE);
|
||||
|
||||
while (getone (IT_sc_CODE))
|
||||
getone (IT_ss_CODE);
|
||||
|
||||
while (getone (IT_er_CODE))
|
||||
;
|
||||
|
||||
while (getone (IT_ed_CODE))
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
|
||||
/* This is no longer used. */
|
||||
|
||||
static void
|
||||
object_body_list ()
|
||||
{
|
||||
while (getone (IT_sh_CODE))
|
||||
{
|
||||
while (getone (IT_ob_CODE))
|
||||
;
|
||||
while (getone (IT_rl_CODE))
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
must (x)
|
||||
int x;
|
||||
{
|
||||
if (!getone (x))
|
||||
{
|
||||
printf ("WANTED %x!!\n", x);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
tab (i, s)
|
||||
int i;
|
||||
char *s;
|
||||
{
|
||||
indent += i;
|
||||
if (s)
|
||||
{
|
||||
p ();
|
||||
printf (s);
|
||||
printf ("\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void derived_type ();
|
||||
|
||||
static void
|
||||
dump_symbol_info ()
|
||||
{
|
||||
tab (1, "SYMBOL INFO");
|
||||
while (opt (IT_dsy_CODE))
|
||||
{
|
||||
if (opt (IT_dty_CODE))
|
||||
{
|
||||
must (IT_dbt_CODE);
|
||||
derived_type ();
|
||||
must (IT_dty_CODE);
|
||||
}
|
||||
}
|
||||
tab (-1, "");
|
||||
}
|
||||
|
||||
static void
|
||||
derived_type ()
|
||||
{
|
||||
tab (1, "DERIVED TYPE");
|
||||
while (1)
|
||||
{
|
||||
if (opt (IT_dpp_CODE))
|
||||
{
|
||||
dump_symbol_info ();
|
||||
must (IT_dpp_CODE);
|
||||
}
|
||||
else if (opt (IT_dfp_CODE))
|
||||
{
|
||||
dump_symbol_info ();
|
||||
must (IT_dfp_CODE);
|
||||
}
|
||||
else if (opt (IT_den_CODE))
|
||||
{
|
||||
dump_symbol_info ();
|
||||
must (IT_den_CODE);
|
||||
}
|
||||
else if (opt (IT_den_CODE))
|
||||
{
|
||||
dump_symbol_info ();
|
||||
must (IT_den_CODE);
|
||||
}
|
||||
else if (opt (IT_dds_CODE))
|
||||
{
|
||||
dump_symbol_info ();
|
||||
must (IT_dds_CODE);
|
||||
}
|
||||
else if (opt (IT_dar_CODE))
|
||||
{
|
||||
}
|
||||
else if (opt (IT_dpt_CODE))
|
||||
{
|
||||
}
|
||||
else if (opt (IT_dul_CODE))
|
||||
{
|
||||
}
|
||||
else if (opt (IT_dse_CODE))
|
||||
{
|
||||
}
|
||||
else if (opt (IT_dot_CODE))
|
||||
{
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
tab (-1, "");
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
/* This is no longer used. */
|
||||
|
||||
static void
|
||||
program_structure ()
|
||||
{
|
||||
tab (1, "PROGRAM STRUCTURE");
|
||||
while (opt (IT_dps_CODE))
|
||||
{
|
||||
must (IT_dso_CODE);
|
||||
opt (IT_dss_CODE);
|
||||
dump_symbol_info ();
|
||||
must (IT_dps_CODE);
|
||||
}
|
||||
tab (-1, "");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
|
||||
/* This is no longer used. */
|
||||
|
||||
static void
|
||||
debug_list ()
|
||||
{
|
||||
tab (1, "DEBUG LIST");
|
||||
|
||||
must (IT_du_CODE);
|
||||
opt (IT_dus_CODE);
|
||||
program_structure ();
|
||||
must (IT_dln_CODE);
|
||||
|
||||
tab (-1, "");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
module ()
|
||||
{
|
||||
int c = 0;
|
||||
int l = 0;
|
||||
|
||||
tab (1, "MODULE***\n");
|
||||
|
||||
do
|
||||
{
|
||||
c = getc (file);
|
||||
ungetc (c, file);
|
||||
|
||||
c &= 0x7f;
|
||||
}
|
||||
while (getone (c) && c != IT_tr_CODE);
|
||||
|
||||
#if 0
|
||||
must (IT_cs_CODE);
|
||||
must (IT_hd_CODE);
|
||||
opt (IT_hs_CODE);
|
||||
|
||||
unit_info_list ();
|
||||
object_body_list ();
|
||||
debug_list ();
|
||||
|
||||
must (IT_tr_CODE);
|
||||
#endif
|
||||
tab (-1, "");
|
||||
|
||||
c = getc (file);
|
||||
while (c != EOF)
|
||||
{
|
||||
printf ("%02x ", c);
|
||||
l++;
|
||||
if (l == 32)
|
||||
{
|
||||
printf ("\n");
|
||||
l = 0;
|
||||
}
|
||||
c = getc (file);
|
||||
}
|
||||
}
|
||||
|
||||
char *program_name;
|
||||
|
||||
static void
|
||||
show_usage (file, status)
|
||||
FILE *file;
|
||||
int status;
|
||||
{
|
||||
fprintf (file, _("Usage: %s [-hV] in-file\n"), program_name);
|
||||
exit (status);
|
||||
}
|
||||
|
||||
static void
|
||||
show_help ()
|
||||
{
|
||||
printf (_("%s: Print a human readable interpretation of a SYSROFF object file\n"),
|
||||
program_name);
|
||||
show_usage (stdout, 0);
|
||||
}
|
||||
|
||||
int
|
||||
main (ac, av)
|
||||
int ac;
|
||||
char **av;
|
||||
{
|
||||
char *input_file = NULL;
|
||||
int opt;
|
||||
static struct option long_options[] =
|
||||
{
|
||||
{"help", no_argument, 0, 'h'},
|
||||
{"version", no_argument, 0, 'V'},
|
||||
{NULL, no_argument, 0, 0}
|
||||
};
|
||||
|
||||
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
|
||||
setlocale (LC_MESSAGES, "");
|
||||
#endif
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
program_name = av[0];
|
||||
xmalloc_set_program_name (program_name);
|
||||
|
||||
while ((opt = getopt_long (ac, av, "hV", long_options, (int *) NULL)) != EOF)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
case 'h':
|
||||
show_help ();
|
||||
/*NOTREACHED*/
|
||||
case 'V':
|
||||
printf (_("GNU %s version %s\n"), program_name, PROGRAM_VERSION);
|
||||
exit (0);
|
||||
/*NOTREACHED*/
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
show_usage (stderr, 1);
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
}
|
||||
|
||||
/* The input and output files may be named on the command line. */
|
||||
|
||||
if (optind < ac)
|
||||
{
|
||||
input_file = av[optind];
|
||||
}
|
||||
|
||||
if (!input_file)
|
||||
{
|
||||
fatal (_("no input file specified"));
|
||||
}
|
||||
|
||||
file = fopen (input_file, FOPEN_RB);
|
||||
if (!file)
|
||||
{
|
||||
fatal (_("cannot open input file %s"), input_file);
|
||||
}
|
||||
|
||||
module ();
|
||||
return 0;
|
||||
}
|
||||
@@ -1,415 +0,0 @@
|
||||
%{
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
extern char *word;
|
||||
extern char writecode;
|
||||
extern int number;
|
||||
extern int unit;
|
||||
char nice_name[1000];
|
||||
char *it;
|
||||
int sofar;
|
||||
int width;
|
||||
int code;
|
||||
char * repeat;
|
||||
char *oldrepeat;
|
||||
char *name;
|
||||
int rdepth;
|
||||
char *loop [] = {"","n","m","/*BAD*/"};
|
||||
char *names[] = {" ","[n]","[n][m]"};
|
||||
char *pnames[]= {"","*","**"};
|
||||
%}
|
||||
|
||||
|
||||
%union {
|
||||
int i;
|
||||
char *s;
|
||||
}
|
||||
%token COND
|
||||
%token REPEAT
|
||||
%token '(' ')'
|
||||
%token <s> TYPE
|
||||
%token <s> NAME
|
||||
%token <i> NUMBER UNIT
|
||||
%type <i> attr_size
|
||||
%type <s> attr_desc attr_id attr_type
|
||||
%%
|
||||
|
||||
top: {
|
||||
switch (writecode)
|
||||
{
|
||||
case 'i':
|
||||
printf("#ifdef SYSROFF_SWAP_IN\n");
|
||||
break;
|
||||
case 'p':
|
||||
printf("#ifdef SYSROFF_p\n");
|
||||
break;
|
||||
case 'd':
|
||||
break;
|
||||
case 'g':
|
||||
printf("#ifdef SYSROFF_SWAP_OUT\n");
|
||||
break;
|
||||
case 'c':
|
||||
printf("#ifdef SYSROFF_PRINT\n");
|
||||
printf("#include <stdio.h>\n");
|
||||
printf("#include <stdlib.h>\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
it_list {
|
||||
switch (writecode) {
|
||||
case 'i':
|
||||
case 'p':
|
||||
case 'g':
|
||||
case 'c':
|
||||
printf("#endif\n");
|
||||
break;
|
||||
case 'd':
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
|
||||
it_list: it it_list
|
||||
|
|
||||
;
|
||||
|
||||
it:
|
||||
'(' NAME NUMBER
|
||||
{
|
||||
it = $2; code = $3;
|
||||
switch (writecode)
|
||||
{
|
||||
case 'd':
|
||||
printf("\n\n\n#define IT_%s_CODE 0x%x\n", it,code);
|
||||
printf("struct IT_%s { \n", it);
|
||||
break;
|
||||
case 'i':
|
||||
printf("void sysroff_swap_%s_in(ptr)\n",$2);
|
||||
printf("struct IT_%s *ptr;\n", it);
|
||||
printf("{\n");
|
||||
printf("char raw[255];\n");
|
||||
printf("\tint idx = 0 ;\n");
|
||||
printf("\tint size;\n");
|
||||
printf("memset(raw,0,255);\n");
|
||||
printf("memset(ptr,0,sizeof(*ptr));\n");
|
||||
printf("size = fillup(raw);\n");
|
||||
break;
|
||||
case 'g':
|
||||
printf("void sysroff_swap_%s_out(file,ptr)\n",$2);
|
||||
printf("FILE * file;\n");
|
||||
printf("struct IT_%s *ptr;\n", it);
|
||||
printf("{\n");
|
||||
printf("\tchar raw[255];\n");
|
||||
printf("\tint idx = 16 ;\n");
|
||||
printf("\tmemset (raw, 0, 255);\n");
|
||||
printf("\tcode = IT_%s_CODE;\n", it);
|
||||
break;
|
||||
case 'o':
|
||||
printf("void sysroff_swap_%s_out(abfd,ptr)\n",$2);
|
||||
printf("bfd * abfd;\n");
|
||||
printf("struct IT_%s *ptr;\n",it);
|
||||
printf("{\n");
|
||||
printf("int idx = 0 ;\n");
|
||||
break;
|
||||
case 'c':
|
||||
printf("void sysroff_print_%s_out(ptr)\n",$2);
|
||||
printf("struct IT_%s *ptr;\n", it);
|
||||
printf("{\n");
|
||||
printf("itheader(\"%s\", IT_%s_CODE);\n",$2,$2);
|
||||
break;
|
||||
|
||||
case 't':
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
it_field_list
|
||||
')'
|
||||
{
|
||||
switch (writecode) {
|
||||
case 'd':
|
||||
printf("};\n");
|
||||
break;
|
||||
case 'g':
|
||||
printf("\tchecksum(file,raw, idx, IT_%s_CODE);\n", it);
|
||||
|
||||
case 'i':
|
||||
|
||||
case 'o':
|
||||
case 'c':
|
||||
printf("}\n");
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
|
||||
it_field_list:
|
||||
it_field it_field_list
|
||||
| cond_it_field it_field_list
|
||||
| repeat_it_field it_field_list
|
||||
|
|
||||
;
|
||||
|
||||
repeat_it_field: '(' REPEAT NAME
|
||||
{
|
||||
rdepth++;
|
||||
switch (writecode)
|
||||
{
|
||||
case 'c':
|
||||
if (rdepth==1)
|
||||
printf("\tprintf(\"repeat %%d\\n\", %s);\n",$3);
|
||||
if (rdepth==2)
|
||||
printf("\tprintf(\"repeat %%d\\n\", %s[n]);\n",$3);
|
||||
case 'i':
|
||||
case 'g':
|
||||
case 'o':
|
||||
|
||||
if (rdepth==1)
|
||||
{
|
||||
printf("\t{ int n; for (n = 0; n < %s; n++) {\n", $3);
|
||||
}
|
||||
if (rdepth == 2) {
|
||||
printf("\t{ int m; for (m = 0; m < %s[n]; m++) {\n", $3);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
oldrepeat = repeat;
|
||||
repeat = $3;
|
||||
}
|
||||
|
||||
it_field_list ')'
|
||||
|
||||
{
|
||||
repeat = oldrepeat;
|
||||
oldrepeat =0;
|
||||
rdepth--;
|
||||
switch (writecode)
|
||||
{
|
||||
case 'i':
|
||||
case 'g':
|
||||
case 'o':
|
||||
case 'c':
|
||||
printf("\t}}\n");
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
cond_it_field: '(' COND NAME
|
||||
{
|
||||
switch (writecode)
|
||||
{
|
||||
case 'i':
|
||||
case 'g':
|
||||
case 'o':
|
||||
case 'c':
|
||||
printf("\tif (%s) {\n", $3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
it_field_list ')'
|
||||
{
|
||||
switch (writecode)
|
||||
{
|
||||
case 'i':
|
||||
case 'g':
|
||||
case 'o':
|
||||
case 'c':
|
||||
printf("\t}\n");
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
it_field:
|
||||
'(' attr_desc '(' attr_type attr_size ')' attr_id
|
||||
{name = $7; }
|
||||
enums ')'
|
||||
{
|
||||
char *desc = $2;
|
||||
char *type = $4;
|
||||
int size = $5;
|
||||
char *id = $7;
|
||||
char *p = names[rdepth];
|
||||
char *ptr = pnames[rdepth];
|
||||
switch (writecode)
|
||||
{
|
||||
case 'g':
|
||||
if (size % 8)
|
||||
{
|
||||
|
||||
printf("\twriteBITS(ptr->%s%s,raw,&idx,%d);\n",
|
||||
id,
|
||||
names[rdepth], size);
|
||||
|
||||
}
|
||||
else {
|
||||
printf("\twrite%s(ptr->%s%s,raw,&idx,%d,file);\n",
|
||||
type,
|
||||
id,
|
||||
names[rdepth],size/8);
|
||||
}
|
||||
break;
|
||||
case 'i':
|
||||
{
|
||||
|
||||
if (rdepth >= 1)
|
||||
|
||||
{
|
||||
printf("if (!ptr->%s) ptr->%s = (%s*)xcalloc(%s, sizeof(ptr->%s[0]));\n",
|
||||
id,
|
||||
id,
|
||||
type,
|
||||
repeat,
|
||||
id);
|
||||
}
|
||||
|
||||
if (rdepth == 2)
|
||||
{
|
||||
printf("if (!ptr->%s[n]) ptr->%s[n] = (%s**)xcalloc(%s[n], sizeof(ptr->%s[n][0]));\n",
|
||||
id,
|
||||
id,
|
||||
type,
|
||||
repeat,
|
||||
id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (size % 8)
|
||||
{
|
||||
printf("\tptr->%s%s = getBITS(raw,&idx, %d,size);\n",
|
||||
id,
|
||||
names[rdepth],
|
||||
size);
|
||||
}
|
||||
else {
|
||||
printf("\tptr->%s%s = get%s(raw,&idx, %d,size);\n",
|
||||
id,
|
||||
names[rdepth],
|
||||
type,
|
||||
size/8);
|
||||
}
|
||||
break;
|
||||
case 'o':
|
||||
printf("\tput%s(raw,%d,%d,&idx,ptr->%s%s);\n", type,size/8,size%8,id,names[rdepth]);
|
||||
break;
|
||||
case 'd':
|
||||
if (repeat)
|
||||
printf("\t/* repeat %s */\n", repeat);
|
||||
|
||||
if (type[0] == 'I') {
|
||||
printf("\tint %s%s; \t/* %s */\n",ptr,id, desc);
|
||||
}
|
||||
else if (type[0] =='C') {
|
||||
printf("\tchar %s*%s;\t /* %s */\n",ptr,id, desc);
|
||||
}
|
||||
else {
|
||||
printf("\tbarray %s%s;\t /* %s */\n",ptr,id, desc);
|
||||
}
|
||||
break;
|
||||
case 'c':
|
||||
printf("tabout();\n");
|
||||
printf("\tprintf(\"/*%-30s*/ ptr->%s = \");\n", desc, id);
|
||||
|
||||
if (type[0] == 'I')
|
||||
printf("\tprintf(\"%%d\\n\",ptr->%s%s);\n", id,p);
|
||||
else if (type[0] == 'C')
|
||||
printf("\tprintf(\"%%s\\n\",ptr->%s%s);\n", id,p);
|
||||
|
||||
else if (type[0] == 'B')
|
||||
{
|
||||
printf("\tpbarray(&ptr->%s%s);\n", id,p);
|
||||
}
|
||||
else abort();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
|
||||
attr_type:
|
||||
TYPE { $$ = $1; }
|
||||
| { $$ = "INT";}
|
||||
;
|
||||
|
||||
attr_desc:
|
||||
'(' NAME ')'
|
||||
{ $$ = $2; }
|
||||
;
|
||||
|
||||
attr_size:
|
||||
NUMBER UNIT
|
||||
{ $$ = $1 * $2; }
|
||||
;
|
||||
|
||||
|
||||
attr_id:
|
||||
'(' NAME ')' { $$ = $2; }
|
||||
| { $$ = "dummy";}
|
||||
;
|
||||
|
||||
enums:
|
||||
| '(' enum_list ')' ;
|
||||
|
||||
enum_list:
|
||||
|
|
||||
enum_list '(' NAME NAME ')' {
|
||||
switch (writecode)
|
||||
{
|
||||
case 'd':
|
||||
printf("#define %s %s\n", $3,$4);
|
||||
break;
|
||||
case 'c':
|
||||
printf("if (ptr->%s%s == %s) { tabout(); printf(\"%s\\n\");}\n", name, names[rdepth],$4,$3);
|
||||
}
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
|
||||
|
||||
%%
|
||||
/* four modes
|
||||
|
||||
-d write structure defintions for sysroff in host format
|
||||
-i write functions to swap into sysroff format in
|
||||
-o write functions to swap into sysroff format out
|
||||
-c write code to print info in human form */
|
||||
|
||||
int yydebug;
|
||||
char writecode;
|
||||
|
||||
int
|
||||
main(ac,av)
|
||||
int ac;
|
||||
char **av;
|
||||
{
|
||||
yydebug=0;
|
||||
if (ac > 1)
|
||||
writecode = av[1][1];
|
||||
if (writecode == 'd')
|
||||
{
|
||||
printf("typedef struct { unsigned char *data; int len; } barray; \n");
|
||||
printf("typedef int INT;\n");
|
||||
printf("typedef char * CHARS;\n");
|
||||
|
||||
}
|
||||
yyparse();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
yyerror(s)
|
||||
char *s;
|
||||
{
|
||||
fprintf(stderr, "%s\n" , s);
|
||||
return 0;
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
%{
|
||||
#include "sysinfo.h"
|
||||
char *word;
|
||||
int number;
|
||||
int unit;
|
||||
|
||||
#ifndef yywrap
|
||||
static int yywrap () { return 1; }
|
||||
#endif
|
||||
%}
|
||||
%%
|
||||
"(" { return '(';}
|
||||
")" { return ')';}
|
||||
"[" { return '[';}
|
||||
"]" { return ']';}
|
||||
" " { ; }
|
||||
";".* { ; }
|
||||
"\t" { ; }
|
||||
"\n" { ; }
|
||||
"\""[^\"]*"\"" {
|
||||
yylval.s = malloc(strlen (yytext));
|
||||
strcpy(yylval.s, yytext+1);
|
||||
yylval.s[strlen(yylval.s)-1] = 0;
|
||||
return NAME;
|
||||
}
|
||||
|
||||
0x[0-9a-f]+ {
|
||||
yylval.i = strtol(yytext,0,16);
|
||||
return NUMBER;
|
||||
}
|
||||
|
||||
[0-9]+ {
|
||||
yylval.i = atoi(yytext);
|
||||
return NUMBER;
|
||||
}
|
||||
|
||||
|
||||
"bits" { yylval.i =1 ;return UNIT;}
|
||||
"bit" { yylval.i = 1; return UNIT;}
|
||||
"bytes" { yylval.i= 8; return UNIT;}
|
||||
"byte" { yylval.i = 8; return UNIT;}
|
||||
|
||||
"int" { yylval.s = "INT"; return TYPE;}
|
||||
"barray" { yylval.s = "BARRAY"; return TYPE;}
|
||||
"chars" { yylval.s = "CHARS"; return TYPE;}
|
||||
"variable" { yylval.i = 0; return NUMBER;}
|
||||
"counted" { yylval.i = -4; return NUMBER;}
|
||||
"addrsize" { yylval.i = -2; return NUMBER; }
|
||||
"segsize" { yylval.i = -1; return NUMBER; }
|
||||
"cond" { return COND;}
|
||||
"repeat" { return REPEAT;}
|
||||
@@ -1,504 +0,0 @@
|
||||
("cs" 0x0
|
||||
(("size") (1 byte) ("size"))
|
||||
|
||||
(("hd") (1 byte) ("hd"))
|
||||
(("hs") (1 byte) ("hs"))
|
||||
(("un") (1 byte) ("un"))
|
||||
(("us") (1 byte) ("us"))
|
||||
|
||||
(("sc") (1 byte) ("sc"))
|
||||
(("ss") (1 byte) ("ss"))
|
||||
(("er") (1 byte) ("er"))
|
||||
(("ed") (1 byte) ("ed"))
|
||||
|
||||
(("sh") (1 byte) ("sh"))
|
||||
(("ob") (1 byte) ("ob"))
|
||||
(("rl") (1 byte) ("rl"))
|
||||
(("du") (1 byte) ("du"))
|
||||
|
||||
(("dps") (1 byte) ("dps"))
|
||||
(("dsy") (1 byte) ("dsy"))
|
||||
(("dty") (1 byte) ("dty"))
|
||||
(("dln") (1 byte) ("dln"))
|
||||
|
||||
(("dso") (1 byte) ("dso"))
|
||||
(("dus") (1 byte) ("dus"))
|
||||
(("dss") (1 byte) ("dss"))
|
||||
(("dbt") (1 byte) ("dbt"))
|
||||
|
||||
(("dpp") (1 byte) ("dpp"))
|
||||
(("dfp") (1 byte) ("dfp"))
|
||||
(("den") (1 byte) ("den"))
|
||||
(("dds") (1 byte) ("dds"))
|
||||
|
||||
(("dar") (1 byte) ("dar"))
|
||||
(("dpt") (1 byte) ("dpt"))
|
||||
(("dul") (1 byte) ("dul"))
|
||||
(("dse") (1 byte) ("dse"))
|
||||
|
||||
(("dot") (1 byte) ("dot")))
|
||||
|
||||
|
||||
("hd" 0x04
|
||||
(("module type") (4 bits) ("mt")
|
||||
(("MTYPE_ABS_LM" "0")
|
||||
("MTYPE_REL_LM" "1")
|
||||
("MTYPE_OMS_OR_LMS" "2")
|
||||
("MTYPE_UNSPEC" "0xf")))
|
||||
(("spare")(4 bits) ("spare1"))
|
||||
(("creation date")( chars 12 bytes)( "cd"))
|
||||
(("number of units") (2 bytes) ("nu"))
|
||||
(("code") (1 byte) ("code"))
|
||||
(("version") (chars 4 bytes) ("ver"))
|
||||
(("address update") (1 byte) ("au"))
|
||||
(("segment identifier") (1 bit) ("si"))
|
||||
(("address field length") (4 bits) ("afl"))
|
||||
(("spare")(3 bits) ("spare2"))
|
||||
(("space size within segment") (1 byte) ("spcsz"))
|
||||
(("segment size") (1 byte) ("segsz"))
|
||||
(("segment shift") (1 byte) ("segsh"))
|
||||
(("entry point") (1 byte) ("ep"))
|
||||
(cond "ptr->ep"
|
||||
(cond "ptr->mt != MTYPE_ABS_LM"
|
||||
(("unit appearance number") (2 bytes) ("uan"))
|
||||
(("section appearance number") (2 bytes) ("sa")))
|
||||
(cond "segmented_p"
|
||||
(("segment address") (segsize bytes) ("sad")))
|
||||
(("address") (addrsize bytes) ("address")))
|
||||
(("os name") (chars variable bytes) ("os"))
|
||||
(("sys name") (chars variable bytes) ("sys"))
|
||||
(("module name") (chars variable bytes) ("mn"))
|
||||
(("cpu") (chars variable bytes) ("cpu")))
|
||||
|
||||
|
||||
("hs" 0x05
|
||||
(("neg number") (2 bytes) ("neg")))
|
||||
|
||||
|
||||
("un" 0x06
|
||||
(("format") (2 bits) ("format")
|
||||
(("FORMAT_LM" "0")
|
||||
("FORMAT_OM" "1")
|
||||
("FORMAT_OMS_OR_LMS" "2")))
|
||||
(("spare") (6 bits) ("spare1"))
|
||||
(("number of sections") (2 bytes) ("nsections"))
|
||||
(("number of external refs") (2 bytes) ("nextrefs"))
|
||||
(("number of external defs") (2 bytes) ("nextdefs"))
|
||||
(("unit name") (chars variable byte) ("name"))
|
||||
(("tool name") (chars variable byte) ("tool"))
|
||||
(("creation date") (chars 12 bytes) ("tcd"))
|
||||
(("linker name") (chars variable byte) ("linker"))
|
||||
(("creation date") (chars 12 bytes) ("lcd")))
|
||||
|
||||
|
||||
("us" 0x07
|
||||
(("negotiation number") (2 bytes) ("neg")))
|
||||
|
||||
|
||||
("sc" 0x08
|
||||
(("format") (2 bits) ("format"))
|
||||
(("spare") (6 bits) ("spare"))
|
||||
(("segment address") (segsize bytes) ("segadd"))
|
||||
(("address") (addrsize bytes) ("addr"))
|
||||
(("length") (addrsize bytes) ("length"))
|
||||
(("alignment") (addrsize bytes) ("align"))
|
||||
(("contents") (4 bits) ("contents")
|
||||
(("CONTENTS_CODE" "0")
|
||||
("CONTENTS_DATA" "1")
|
||||
("CONTENTS_STACK" "2")
|
||||
("CONTENTS_DUMMY" "3")
|
||||
("CONTENTS_SPECIAL" "4")
|
||||
("CONTENTS_NONSPEC" "0xf")))
|
||||
(("concat") (4 bits) ("concat")
|
||||
(("CONCAT_SIMPLE" "0")
|
||||
("CONCAT_SHAREDC" "1")
|
||||
("CONCAT_DUMMY" "2")
|
||||
("CONCAT_GROUP" "3")
|
||||
("CONCAT_SHARED" "4")
|
||||
("CONCAT_PRIVATE" "5")
|
||||
("CONCAT_UNSPEC" "0xf")))
|
||||
(("read") (2 bits) ("read"))
|
||||
(("write") (2 bits) ("write"))
|
||||
(("exec") (2 bits) ("exec"))
|
||||
(("initialized") (2 bits) ("init"))
|
||||
(("mode") (2 bits) ("mode"))
|
||||
(("spare") (6 bits) ("spare1"))
|
||||
(("name") (chars variable byte) ("name")))
|
||||
|
||||
|
||||
("ss" 0x09
|
||||
(("neg number") (2 bytes) ("neg")))
|
||||
|
||||
|
||||
("er" 0x0c
|
||||
(("symbol type") (2 bits) ("type")
|
||||
(("ER_ENTRY" "0")
|
||||
("ER_DATA" "1")
|
||||
("ER_NOTDEF" "2")
|
||||
("ER_NOTSPEC" "3")))
|
||||
(("spare") (6 bits) ("spare"))
|
||||
(("symbol name") (chars variable byte) ("name")))
|
||||
|
||||
|
||||
("ed" 0x14
|
||||
(("section appearance number") (2 bytes) ("section"))
|
||||
(("symbol type") (3 bits) ("type")
|
||||
(("ED_TYPE_ENTRY" "0")
|
||||
("ED_TYPE_DATA" "1")
|
||||
("ED_TYPE_CONST" "2")
|
||||
("ED_TYPE_NOTSPEC" "7")))
|
||||
(("spare") (5 bits) ("spare"))
|
||||
(cond "ptr->type==ED_TYPE_ENTRY || ptr->type==ED_TYPE_DATA"
|
||||
(("symbol address") (addrsize bytes) ("address")))
|
||||
(cond "ptr->type==ED_TYPE_CONST"
|
||||
(("constant value") (addrsize bytes) ("constant")))
|
||||
(("symbol name") (chars variable byte) ("name")))
|
||||
|
||||
|
||||
("sh" 0x1a
|
||||
(("unit appearance number") (2 bytes) ("unit"))
|
||||
(("section appearance number") (2 bytes) ("section")))
|
||||
|
||||
|
||||
("ob" 0x1c
|
||||
(("starting address flag") (1 bit) ("saf"))
|
||||
(("compression flag") (1 bit) ("cpf"))
|
||||
(("spare") (6 bits) ("spare"))
|
||||
(cond "ptr->saf"
|
||||
( ("starting address") (addrsize bytes) ("address")))
|
||||
(cond "ptr->cpf"
|
||||
(("comp reps") (addrsize bytes) ("compreps")))
|
||||
(("data") (barray counted byte) ("data")))
|
||||
|
||||
|
||||
("rl" 0x20
|
||||
(("boundary of relocateable area") (4 bits) ("boundary"))
|
||||
(("address polarity") (1 bit) ("apol"))
|
||||
(("segment number") (1 bit) ("segment"))
|
||||
(("sign of relocation") (1 bit) ("sign"))
|
||||
(("check range") (1 bit) ("check"))
|
||||
(("reloc address") (addrsize bytes) ("addr"))
|
||||
|
||||
(("bit loc") (1 byte) ("bitloc"))
|
||||
(("field length") (1 byte) ("flen"))
|
||||
(("bcount") (1 byte) ("bcount"))
|
||||
(("operator") (1 byte) ("op")
|
||||
(("OP_RELOC_ADDR" "1")
|
||||
("OP_SEC_REF" "0")
|
||||
("OP_EXT_REF" "2")))
|
||||
(cond "ptr->op == OP_EXT_REF"
|
||||
(("symbol number") (2 bytes) ("symn")) )
|
||||
|
||||
(cond "ptr->op == OP_SEC_REF"
|
||||
(("section number") (2 bytes) ("secn"))
|
||||
(("const opcode") (1 byte) ("copcode_is_3"))
|
||||
(("addend length") (1 byte) ("alength_is_4"))
|
||||
(("addend") (4 byte) ("addend"))
|
||||
(("plus opcode") (1 byte) ("aopcode_is_0x20")))
|
||||
|
||||
(cond "ptr->op == OP_RELOC_ADDR"
|
||||
(("dunno") (2 bytes) ("dunno")))
|
||||
|
||||
(("end") (1 byte) ("end")))
|
||||
|
||||
|
||||
("du" 0x30
|
||||
(("format") (2 bits) ("format"))
|
||||
(("optimized") (1 bit) ("optimized"))
|
||||
(("stackfrmt") (2 bits) ("stackfrmt"))
|
||||
(("spare") (3 bits) ("spare"))
|
||||
(("unit number") (2 bytes) ("unit"))
|
||||
(("sections") (2 bytes) ("sections"))
|
||||
(repeat "ptr->sections"
|
||||
(("section appearance number") (2 bytes) ("san"))
|
||||
(("address") (addrsize bytes) ("address"))
|
||||
(("section length") (addrsize bytes) ("length")))
|
||||
(("tool name") (chars variable byte) ("tool"))
|
||||
(("creation date") (chars 12 bytes) ("date")))
|
||||
|
||||
|
||||
("dsy" 0x34
|
||||
(("symbol type") (7 bits) ("type")
|
||||
(("STYPE_VAR" "0")
|
||||
("STYPE_LAB" "1")
|
||||
("STYPE_PROC" "2")
|
||||
("STYPE_FUNC" "3")
|
||||
("STYPE_TYPE" "4")
|
||||
("STYPE_CONST" "5")
|
||||
("STYPE_ENTRY" "6")
|
||||
("STYPE_MEMBER" "7")
|
||||
("STYPE_ENUM" "8")
|
||||
("STYPE_TAG" "9")
|
||||
("STYPE_PACKAGE" "10")
|
||||
("STYPE_GENERIC" "11")
|
||||
("STYPE_TASK" "12")
|
||||
("STYPE_EXCEPTION" "13")
|
||||
("STYPE_PARAMETER" "14")
|
||||
("STYPE_EQUATE" "15")
|
||||
("STYPE_UNSPEC" "0x7f")))
|
||||
(("assignment info") (1 bit) ("assign"))
|
||||
(("symbol id") (2 bytes) ("snumber"))
|
||||
(("symbol name") (chars variable bytes) ("sname"))
|
||||
(("nesting level") (2 bytes) ("nesting"))
|
||||
(cond "ptr->assign"
|
||||
(("assignment type") (1 byte) ("ainfo")
|
||||
(("AINFO_REG" "1")
|
||||
("AINFO_STATIC_EXT_DEF" "2")
|
||||
("AINFO_STATIC_EXT_REF" "3")
|
||||
("AINFO_STATIC_INT" "4")
|
||||
("AINFO_STATIC_COM" "5")
|
||||
("AINFO_AUTO" "6")
|
||||
("AINFO_CONST" "7")
|
||||
("AINFO_UNSPEC" "0xff")))
|
||||
(("data length") (addrsize bytes) ("dlength"))
|
||||
(cond "ptr->ainfo == AINFO_STATIC_EXT_DEF
|
||||
|| ptr->ainfo == AINFO_STATIC_INT
|
||||
|| ptr->ainfo == AINFO_STATIC_COM"
|
||||
(("section number") (2 bytes) ("section")))
|
||||
(cond "ptr->ainfo == AINFO_STATIC_EXT_DEF
|
||||
|| ptr->ainfo == AINFO_STATIC_INT
|
||||
|| ptr->ainfo == AINFO_STATIC_COM
|
||||
|| ptr->ainfo == AINFO_AUTO"
|
||||
(("address") (addrsize bytes) ("address")))
|
||||
(cond "ptr->ainfo == AINFO_REG"
|
||||
(("register name") (chars variable bytes) ("reg")))
|
||||
(cond "ptr->ainfo == AINFO_STATIC_EXT_DEF
|
||||
|| ptr->ainfo == AINFO_STATIC_EXT_REF"
|
||||
(("external name") (chars variable bytes) ("ename")))
|
||||
(cond "ptr->ainfo == AINFO_CONST"
|
||||
(("constant") (chars variable bytes) ("constant"))))
|
||||
(cond "ptr->type == STYPE_MEMBER"
|
||||
(("assignment unit") (1 bit) ("bitunit"))
|
||||
(("spare") (7 bits) ("spare2"))
|
||||
(("field length") (addrsize bytes) ("field_len"))
|
||||
(("field offset") (addrsize bytes) ("field_off"))
|
||||
(cond "ptr->bitunit"
|
||||
(("bit offset") (addrsize bytes) ("field_bitoff"))))
|
||||
(cond "ptr->type== STYPE_ENUM"
|
||||
(("value length") (1 byte) ("evallen"))
|
||||
(("value") (4 bytes) ("evalue")))
|
||||
(cond "ptr->type == STYPE_CONST"
|
||||
(("value") (chars variable bytes) ("cvalue")))
|
||||
(cond "ptr->type == STYPE_EQUATE"
|
||||
(("value length") (1 byte) ("qvallen"))
|
||||
(("value") (4 bytes) ("qvalue"))
|
||||
(("basic type") (1 byte) ("btype"))
|
||||
(("size information") (addrsize bytes) ("sizeinfo"))
|
||||
(("sign") (2 bits) ("sign"))
|
||||
(("floating point type") (6 bits) ("flt_type")))
|
||||
(("source file number") (2 bytes) ("sfn"))
|
||||
(("source line number") (2 bytes) ("sln"))
|
||||
(("negotiation number") (2 bytes) ("neg"))
|
||||
(cond "ptr->type == STYPE_TAG"
|
||||
(("magic") (1 byte) ("magic"))))
|
||||
|
||||
|
||||
|
||||
("dul" 0x52
|
||||
(("max declaration type flag") (1 bit) ("max_variable"))
|
||||
(("max spare") (7 bits) ("maxspare"))
|
||||
(cond "ptr->max_variable == 0"
|
||||
(("maximum") (addrsize bytes) ("max"))
|
||||
(("max mode") (chars variable bytes) ("maxmode")))
|
||||
|
||||
(("min declaration type flag") (1 bit) ("min_variable"))
|
||||
(("min spare") (7 bits) ("minspare"))
|
||||
(cond "ptr->min_variable == 0"
|
||||
(("minimum") (addrsize bytes) ("min"))
|
||||
(("min mode") (chars variable bytes) ("minmode"))))
|
||||
|
||||
|
||||
("dty" 0x36
|
||||
(("end flag") (1 bit) ("end"))
|
||||
(("spare") (7 bits) ("spare"))
|
||||
(cond "!ptr->end"
|
||||
(("negotiation") (2 bytes) ("neg"))))
|
||||
|
||||
|
||||
("dbt" 0x44
|
||||
(("basic type") (1 byte) ("btype")
|
||||
(("BTYPE_VOID" "0")
|
||||
("BTYPE_UNDEF" "1")
|
||||
("BTYPE_CHAR" "2")
|
||||
("BTYPE_INT" "3")
|
||||
("BTYPE_FLOAT" "4")
|
||||
("BTYPE_BIT" "5")
|
||||
("BTYPE_STRING" "6")
|
||||
("BTYPE_DECIMAL" "7")
|
||||
("BTYPE_ENUM" "8")
|
||||
("BTYPE_STRUCT" "9")
|
||||
("BTYPE_TYPE" "10")
|
||||
("BTYPE_TAG" "11")
|
||||
("BTYPE_UNSPEC" "0xff")))
|
||||
(("size info") (addrsize bytes) ("bitsize"))
|
||||
(("sign") (2 bits) ("sign")
|
||||
(("SIGN_SIGNED" "0")
|
||||
("SIGN_UNSIGNED" "1")
|
||||
("SIGN_UNSPEC" "3")))
|
||||
(("floating point type") (6 bits) ("fptype")
|
||||
(("FPTYPE_SINGLE" "0")
|
||||
("FPTYPE_DOUBLE" "1")
|
||||
("FPTYPE_EXTENDED" "2")
|
||||
("FPTYPE_NOTSPEC" "0x3f")))
|
||||
(cond "ptr->btype==BTYPE_TAG || ptr->btype == BTYPE_TYPE"
|
||||
(("symbol id") (2 bytes) ("sid")))
|
||||
(("negotiation") (2 bytes) ("neg")))
|
||||
|
||||
("dar" 0x4e
|
||||
(("element length" ) (addrsize bytes) ("length"))
|
||||
(("dims") (1 byte) ("dims"))
|
||||
(repeat "ptr->dims"
|
||||
(("variable flag") (1 bit) ("variable")
|
||||
(("VARIABLE_FIXED" "0")
|
||||
("VARIABLE_VARIABLE" "1")))
|
||||
|
||||
(("subscript type") (1 bit) ("subtype")
|
||||
(("SUB_INTEGER" "0")
|
||||
("SUB_TYPE" "1")))
|
||||
|
||||
(("spare") (6 bits) ("spare"))
|
||||
|
||||
(cond "ptr->subtype[n] == SUB_TYPE"
|
||||
(("sub symbol id") (2 bytes) ("sid")))
|
||||
|
||||
(cond "ptr->subtype[n] == SUB_INTEGER"
|
||||
(("max declaration type flag") (1 bit) ("max_variable"))
|
||||
(("max spare") (7 bits) ("maxspare"))
|
||||
;; FIXME: next field should be conditional on max_variable,
|
||||
(("maximum") (addrsize bytes) ("max"))
|
||||
|
||||
(("min declaration type flag") (1 bit) ("min_variable"))
|
||||
(("min spare") (7 bits) ("minspare"))
|
||||
;; FIXME: next field should be conditional on min_variable
|
||||
(("minimum") (addrsize bytes) ("min"))))
|
||||
(("negotiation") (2 bytes) ("neg")))
|
||||
|
||||
|
||||
("dso" 0x3a
|
||||
(("function name") (2 bytes) ("sid"))
|
||||
(("sp update count") (4 bytes) ("spupdates"))
|
||||
(repeat "ptr->spupdates"
|
||||
(("update address") (addrsize bytes) ("address"))
|
||||
(("offset") (addrsize bytes) ("offset"))))
|
||||
|
||||
("dln" 0x38
|
||||
(("number of lines") (2 bytes) ("nln"))
|
||||
(repeat "ptr->nln"
|
||||
(("source file number") (2 bytes) ("sfn"))
|
||||
(("source line number") (2 bytes) ("sln"))
|
||||
(("section number") (2 bytes) ("section"))
|
||||
(("from address") (addrsize bytes) ("from_address"))
|
||||
(("to address") (addrsize bytes) ("to_address"))
|
||||
(("call count") (2 bytes) ("cc"))
|
||||
)
|
||||
(("neg") (2 bytes) ("neg")))
|
||||
|
||||
("dpp" 0x46
|
||||
(("start/end") (1 bit) ("end"))
|
||||
(("spare") (7 bits) ("spare"))
|
||||
(cond "!ptr->end"
|
||||
(("params") (1 byte) ("params"))
|
||||
(("neg number") (2 bytes) ("neg"))))
|
||||
|
||||
("den" 0x4a
|
||||
(("start/end") (1 bit) ("end"))
|
||||
(("spare") (7 bits) ("spare"))
|
||||
(cond "!ptr->end"
|
||||
(("neg number") (2 bytes) ("neg"))))
|
||||
|
||||
("dfp" 0x48
|
||||
(("start/end flag") (1 bit) ("end"))
|
||||
(("spare") (7 bits) ("spare"))
|
||||
(cond "!ptr->end"
|
||||
(("number of parameters") (1 byte) ("nparams"))
|
||||
(("neg number") (2 bytes) ("neg"))))
|
||||
|
||||
("dds" 0x4c
|
||||
(("start/end") (1 bit) ("end"))
|
||||
(("spare") (7 bits) ("spare"))
|
||||
(cond "!ptr->end"
|
||||
(("neg number") (2 bytes) ("neg"))))
|
||||
|
||||
("dpt" 0x50
|
||||
(("neg number") (2 bytes) ("neg"))
|
||||
(("dunno") (1 byte) ("dunno")))
|
||||
|
||||
("dse" 0x54
|
||||
(("neg number") (2 bytes) ("neg"))
|
||||
(("dunno") (1 byte) ("dunno")))
|
||||
|
||||
("dot" 0x56
|
||||
(("unknown") (1 byte) ("unknown")))
|
||||
; FIXME: unknown field should be repeated symbol number?
|
||||
|
||||
|
||||
("dss" 0x42
|
||||
(("type") (1 byte) ("type"))
|
||||
(("external/internal") (1 bit) ("internal"))
|
||||
(("spare") (7 bits) ("spare"))
|
||||
(cond "!ptr->internal"
|
||||
( ("package name") (chars variable byte) ("package")))
|
||||
(cond "ptr->internal"
|
||||
(("symbol id") (2 bytes) ("id")))
|
||||
(("record type") (2 bytes) ("record"))
|
||||
(("rules") (chars variable byte) ("rules"))
|
||||
(("number of symbols") (2 bytes) ("nsymbols"))
|
||||
(("unknown" ) (2 bytes) ("fixme")))
|
||||
|
||||
("pss" 0x40
|
||||
(("negotiation number") (2 bytes) ("efn"))
|
||||
(("number of source files") (2 bytes) ("ns"))
|
||||
(repeat "ptr->ns"
|
||||
(("directory reference bit") (1 bit) ("drb"))
|
||||
(("spare") (7 bits) ("spare"))
|
||||
(("completed file name") (chars variable byte) ("fname"))
|
||||
(cond "ptr->drb[n]"
|
||||
(("directory apperance number") (2 bytes) ("dan"))))
|
||||
|
||||
(("number of directories") (2 bytes) ("ndir"))
|
||||
(repeat "ptr->ndir"
|
||||
(("directory name") (chars variable bytes) ("dname"))))
|
||||
|
||||
|
||||
; FIXME: the tr block has no contents. sysinfo, etc. aren't prepared
|
||||
; to deal with that.
|
||||
; ("tr" 0x7f)
|
||||
|
||||
|
||||
("dus" 0x40
|
||||
(("negotiation number") (2 bytes) ("efn"))
|
||||
(("number of source files") (2 bytes) ("ns"))
|
||||
(repeat "ptr->ns"
|
||||
(("directory reference bit") (1 bit) ("drb"))
|
||||
(("spare") (7 bits) ("spare"))
|
||||
(("completed file name") (chars variable byte) ("fname"))
|
||||
(cond "ptr->drb[n]"
|
||||
(("directory apperance number") (2 bytes) ("dan"))))
|
||||
(("number of directories") (2 bytes) ("ndir"))
|
||||
(repeat "ptr->ndir"
|
||||
(("directory name") (chars variable bytes) ("dname"))))
|
||||
|
||||
|
||||
("dps" 0x32
|
||||
(("start/end flag") (1 bit) ("end"))
|
||||
(("block type") (7 bits) ("type")
|
||||
(("BLOCK_TYPE_COMPUNIT" "0")
|
||||
("BLOCK_TYPE_PROCEDURE" "2")
|
||||
("BLOCK_TYPE_FUNCTION" "3")
|
||||
("BLOCK_TYPE_BLOCK" "4")
|
||||
("BLOCK_TYPE_BASIC" "9")))
|
||||
(cond "!ptr->end"
|
||||
(("optimization") (1 byte) ("opt"))
|
||||
(("section number") (2 bytes) ("san"))
|
||||
(("address") (addrsize bytes) ("address"))
|
||||
(("block size") (addrsize bytes) ("block_size"))
|
||||
(("nesting") (1 byte) ("nesting"))
|
||||
(cond "ptr->type == BLOCK_TYPE_PROCEDURE
|
||||
|| ptr->type == BLOCK_TYPE_FUNCTION"
|
||||
(("return address") (1 bit) ("retaddr"))
|
||||
(("interrupt function flag") (1 bit) ("intrflag"))
|
||||
(("stack update flag") (1 bit) ("stackflag"))
|
||||
(("intra page JMP") (1 bit) ("intrpagejmp"))
|
||||
(("spare") (4 bits) ("spare")))
|
||||
(("neg number") (2 bytes) ("neg"))))
|
||||
|
||||
@@ -1,641 +0,0 @@
|
||||
2000-03-13 Nick Clifton <nickc@cygnus.com>
|
||||
|
||||
* binutils-all/readelf.s: Adjust to match noew format of readelf
|
||||
output.
|
||||
* binutils-all/readelf.ss: Adjust to match noew format of readelf
|
||||
output.
|
||||
|
||||
1999-11-01 Nick Clifton <nickc@cygnus.com>
|
||||
|
||||
* binutils-all/objcopy.exp: Expect simple objcopy test for fail
|
||||
for COFF based ARM and Thumb ports.
|
||||
|
||||
Tue Sep 14 00:28:17 1999 Jeffrey A Law (law@cygnus.com)
|
||||
|
||||
* binutils-all/hppa/objdump.exp: Do not run for PA64.
|
||||
|
||||
1999-09-04 Steve Chamberlain <sac@pobox.com>
|
||||
|
||||
* binutils-all/objdump.exp: Add pj to cpus_expected.
|
||||
|
||||
Sat Aug 28 00:24:27 1999 Jerry Quinn <jquinn@nortelnetworks.com>
|
||||
|
||||
* binutils-all/hppa/freg.s: New file.
|
||||
* binutils-all/hppa/objdump.exp: Add freg.s test.
|
||||
|
||||
1999-08-09 Ian Lance Taylor <ian@zembu.com>
|
||||
|
||||
* binutils-all/objcopy.exp: Add setup_xfail for simple copy test
|
||||
for i*86-*-msdos*.
|
||||
|
||||
1999-07-21 H.J. Lu <hjl@gnu.org>
|
||||
|
||||
* binutils-all/testprog.c: Include <stdio.h>.
|
||||
|
||||
1999-06-29 Nick Clifton <nickc@cygnus.com>
|
||||
|
||||
* binutils-all/objdump.exp: Add fr30 and MCore to expected cpus
|
||||
list.
|
||||
|
||||
* binutils-all/readelf.r: Do not assume a fixed number of spaces
|
||||
in the output.
|
||||
|
||||
1999-06-10 Nick Clifton <nickc@cygnus.com>
|
||||
|
||||
* binutils-all/readelf.wi: Update to match latest output.
|
||||
* binutils-all/readelf.h: Update to match latest output.
|
||||
|
||||
Wed Jun 9 11:59:22 1999 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
|
||||
|
||||
* binutils-all/objdump.exp: Tighten regexp to match `objdump -i'
|
||||
output to avoid massive exponential behaviour.
|
||||
|
||||
1999-05-28 Ian Lance Taylor <ian@zembu.com>
|
||||
|
||||
* binutils-all/readelf.h: Update for changes of 1999-04-08.
|
||||
|
||||
1999-03-12 Nick Clifton <nickc@cygnus.com>
|
||||
|
||||
* binutils-all/readelf.wi: Remove FR30 specific componnts.
|
||||
* binutils-all/readelf.s: Remove RELA specific components.
|
||||
|
||||
1999-02-16 Nick Clifton <nickc@cygnus.com>
|
||||
|
||||
* binutils-all/readelf.s: Do not assume section alignment is 4.
|
||||
* binutils-all/readelf.r: Do not assume rela's are being used.
|
||||
* binutils-all/readelf.exp: disable tests for non ELF based
|
||||
targets.
|
||||
|
||||
1999-02-02 Nick Clifton <nickc@cygnus.com>
|
||||
|
||||
* binutils-all/readelf.wi: Amend to match new readelf output.
|
||||
* binutils-all/readelf.r: Do not assume that RELAs will be used.
|
||||
|
||||
1999-01-29 Nick Clifton <nickc@cygnus.com>
|
||||
|
||||
* config/default.exp: Add definitions of READELF and READELFFLAGS.
|
||||
|
||||
* binutils-all/readelf.exp: New file: Readelf tests
|
||||
* binutils-all/readelf.h: New file: Expected results for 'readelf -h'
|
||||
* binutils-all/readelf.s: New file: Expected results for 'readelf -S'
|
||||
* binutils-all/readelf.ss: New file: Expected results for 'readelf -s'
|
||||
* binutils-all/readelf.r: New file: Expected results for 'readelf -r'
|
||||
* binutils-all/readelf.wi: New file: Expected results for 'readelf -wi'
|
||||
|
||||
Wed Dec 9 19:11:39 1998 Jeffrey A Law (law@cygnus.com)
|
||||
|
||||
* binutils-all/objcopy.exp (copy_executable): Expect comparison
|
||||
failure for mips*-*-elf.
|
||||
|
||||
Fri Oct 16 22:57:12 1998 Felix Lee <flee@cygnus.com>
|
||||
|
||||
* binutils-all/objcopy.exp: fix "no symbols" message.
|
||||
|
||||
Tue Jul 28 15:14:04 1998 Jeffrey A Law (law@cygnus.com)
|
||||
|
||||
* binutils-all/objcopy.exp: Keep "main" and "_main" for strip with
|
||||
saving symbol tests. Look for either "main" or "_main" in the output
|
||||
file. Fix test for "no symbols" in the output file.
|
||||
|
||||
1998-07-22 Vladimir N. Makarov <vmakarov@cygnus.com>
|
||||
|
||||
* binutils-all/objcopy.exp: Polish output about fail for objcopy
|
||||
(simple copy), strip with/without saving a symbol for object file
|
||||
and executable.
|
||||
|
||||
Wed Jul 1 16:27:40 1998 Nick Clifton <nickc@cygnus.com>
|
||||
|
||||
* binutils-all/objcopy.exp: ARM simple objcopy now passes.
|
||||
|
||||
Wed Jun 24 09:20:21 1998 Nick Clifton <nickc@cygnus.com>
|
||||
|
||||
* binutils-all/objdump.exp: Look for '.data' rather than 'data'
|
||||
when parsing output of objdump -h.
|
||||
* binutils-all/size.exp: Look for '.data' rather than 'data' when
|
||||
parsing output of size -A.
|
||||
|
||||
1998-07-20 Vladimir N. Makarov <vmakarov@cygnus.com>
|
||||
|
||||
* objcopy.exp: Two new tests - strip object file with saving a
|
||||
symbol and strip executable file with saving a symbol.
|
||||
|
||||
Fri May 29 14:50:24 1998 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* binutils-all/objcopy.exp: Don't xfail the simple objcopy test
|
||||
when cross compiling.
|
||||
|
||||
Thu Nov 6 14:32:37 1997 Bob Manson <manson@charmed.cygnus.com>
|
||||
|
||||
* lib/utils-lib.exp: Temporary definition of target_assemble and
|
||||
default_target_assemble so that testing can work with older
|
||||
dejagnu versions.
|
||||
|
||||
Wed Sep 24 12:09:15 1997 Bob Manson <manson@charmed.cygnus.com>
|
||||
|
||||
* binutils-all/objcopy.exp(strip_executable): Make a new copy of
|
||||
the executable being tested.
|
||||
|
||||
Mon Sep 15 21:25:20 1997 Bob Manson <manson@charmed.cygnus.com>
|
||||
|
||||
* binutils-all/objcopy.exp: Compile the executables to be tested
|
||||
on the target with a status wrapper (as necessary).
|
||||
|
||||
* binutils-all/ar.exp: If testing on a remote host, don't bother
|
||||
looking on the local host for the program being tested. Use the
|
||||
correct filenames on the remote host.
|
||||
|
||||
* binutils-all/nm.exp: Ditto.
|
||||
|
||||
* binutils-all/size.exp: Ditto.
|
||||
|
||||
* binutils-all/objdump.exp: Ditto.
|
||||
(cpus_expected): Add the target CPU to the regexp of CPUs to be
|
||||
expected, if it's not already there.
|
||||
|
||||
Thu Aug 28 09:57:27 1997 Doug Evans <dje@canuck.cygnus.com>
|
||||
|
||||
* binutils-all/objdump.exp (cpus_expected): Add arc.
|
||||
|
||||
Tue Aug 5 00:03:20 1997 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* config/default.exp: Look for nm-new and strip-new.
|
||||
|
||||
Tue Jun 3 17:12:54 1997 Bob Manson <manson@charmed.cygnus.com>
|
||||
|
||||
* config/default.exp: Remove expect_before statement.
|
||||
|
||||
* binutils-all/objcopy.exp: Don't use global exec_output variable;
|
||||
the output is returned from remote_load instead.
|
||||
|
||||
Mon May 12 22:14:20 1997 Bob Manson <manson@charmed.cygnus.com>
|
||||
|
||||
* binutils-all/objcopy.exp(strip_test): Tests that
|
||||
fail to compile are untested, not unresolved.
|
||||
(copy_setup): Ditto.
|
||||
|
||||
* lib/utils-lib.exp(default_binutils_assemble): Call
|
||||
target_assemble instead of target_compile.
|
||||
|
||||
Wed Apr 30 20:37:51 1997 Bob Manson <manson@charmed.cygnus.com>
|
||||
|
||||
Changes to support multilib and remote hosted testing, along with
|
||||
general cleanups and simplifications.
|
||||
|
||||
* lib/utils-lib.exp(binutil_version): Use remote_exec.
|
||||
(default_binutils_run): Ditto.
|
||||
(default_binutils_assemble): Remove first argument; call
|
||||
target_compile to actually do the assembly.
|
||||
(default_binutils_compile,default_binutils_remove,prune_warnings):
|
||||
Delete.
|
||||
|
||||
* config/default.exp: Remove AS and ASFLAGS.
|
||||
(binutils_compile,binutils_remove): Delete.
|
||||
(binutils_assemble): Remove first argument.
|
||||
|
||||
* binutils-all/ar.exp: See if we're running the tests on
|
||||
a remote host, and download/upload files as appropriate.
|
||||
Replace calls to binutils_remove with remote_file. Replace
|
||||
calls to binutils_compile with target_compile. Remove initial
|
||||
argument to binutils_assemble. Use remote_load to execute
|
||||
programs on the target.
|
||||
* binutils-all/nm.exp: Ditto.
|
||||
* binutils-all/objcopy.exp: Ditto.
|
||||
* binutils-all/objdump.exp: Ditto.
|
||||
* binutils-all/size.exp: Ditto.
|
||||
|
||||
Mon Apr 14 12:36:41 1997 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* binutils-all/ar.exp (long_filenames): Check for a file system
|
||||
with a 14 character file name length limit.
|
||||
|
||||
Tue Apr 1 09:52:15 1997 Jeffrey A Law (law@cygnus.com)
|
||||
|
||||
* binutils-all/objdump.exp: Handle d10v.
|
||||
|
||||
Fri Feb 7 16:45:34 1997 Bob Manson <manson@charmed.cygnus.com>
|
||||
|
||||
* binutils-all/ar.exp: Use prune_warnings instead of
|
||||
prune_system_crud.
|
||||
* binutils-all/objcopy.exp: Ditto.
|
||||
|
||||
Wed Jan 29 00:16:43 1997 Bob Manson <manson@charmed.cygnus.com>
|
||||
|
||||
* binutils-all/nm.exp: Use / between $srcdir and $subdir.
|
||||
* binutils-all/objcopy.exp: Ditto.
|
||||
* binutils-all/objdump.exp: Ditto.
|
||||
* binutils-all/size.exp: Ditto.
|
||||
* binutils-all/hppa/objdump.exp: Ditto.
|
||||
|
||||
|
||||
Wed Oct 16 22:57:59 1996 Jeffrey A Law (law@cygnus.com)
|
||||
|
||||
* binutils-all/objdump.exp: Add mn10200 and mn10300 to expected
|
||||
cpus list.
|
||||
|
||||
Tue Oct 1 15:06:55 1996 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* lib/utils-lib.exp (binutil_version): Fix for current version
|
||||
printing.
|
||||
|
||||
Sun Aug 4 22:25:40 1996 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* binutils-all/objcopy.exp: Fix end of line matching in srec tests
|
||||
to work with TCL 7.5.
|
||||
|
||||
Sat Jun 29 12:51:30 1996 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* binutils-all/objcopy.exp: Simple copy test works for i960 b.out
|
||||
targets.
|
||||
|
||||
Mon Jun 24 14:33:04 1996 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* binutils-all/objcopy.exp: On OSF/1, the simple copy test will
|
||||
succeed with gas, and fail with /bin/as, so mark it as an expected
|
||||
failure only if it fails.
|
||||
|
||||
Tue Mar 26 16:55:08 1996 Jeffrey A Law (law@cygnus.com)
|
||||
|
||||
* binutils-all/objcopy.exp: No longer expect adjust-section-vma
|
||||
test to fail for hppa*-*-proelf*.
|
||||
|
||||
Mon Mar 11 08:25:14 1996 Jeffrey A Law (law@cygnus.com)
|
||||
|
||||
* binutils-all/objdump.exp: Look for "$CODE$", not just "CODE".
|
||||
|
||||
Wed Jan 31 11:55:13 1996 Jeffrey A Law (law@cygnus.com)
|
||||
|
||||
* binutils-all/objcopy.exp: Expect adjust-section-vma tests to
|
||||
fail for hppa*-*-proelf* targets.
|
||||
|
||||
Thu Jan 25 13:53:04 1996 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* binutils-all/objdump.exp: Update for objdump -h format change.
|
||||
* binutils-all/objcopy.exp: Likewise.
|
||||
|
||||
Mon Jan 15 18:14:14 1996 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* binutils-all/objcopy.exp: Use the lma, not the vma, when testing
|
||||
address adjustments.
|
||||
|
||||
Fri Dec 15 16:31:55 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* binutils-all/objdump.exp: Update objdump -i test for current
|
||||
objdump output.
|
||||
|
||||
Mon Nov 27 15:15:09 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* binutils-all/objcopy.exp: Correct fail calls to always use the
|
||||
same string as the pass call.
|
||||
|
||||
Wed Nov 22 13:18:58 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* lib/utils-lib.exp (prune_system_crud): Discard -g -O warnings
|
||||
from native compilers on OSF/1 and SunOS.
|
||||
|
||||
Fri Nov 17 10:36:09 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* lib/utils-lib.exp (default_binutils_compiler: Change error
|
||||
message to say compilation rather than assembly.
|
||||
|
||||
Wed Nov 15 18:34:42 1995 Ken Raeburn <raeburn@cygnus.com>
|
||||
|
||||
* binutils-all/objcopy.exp: Simple copy test does appear to work
|
||||
on i*86-svr4.
|
||||
|
||||
Wed Nov 15 12:19:28 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* binutils-all/objcopy.exp: If assembly fails, call unresolved.
|
||||
Test running objcopy and strip on a final executable.
|
||||
* binutils-all/testprog.c: New file.
|
||||
* config/default.exp (STRIP, STRIPFLAGS): Define.
|
||||
(binutils_compile): New procedure.
|
||||
* lib/utils-lib.exp (default_binutils_compile): New procedure.
|
||||
|
||||
Fri Nov 3 13:22:33 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* lib/utils-lib.exp (default_binutils_run): Don't use verbose
|
||||
-log, reverting part of Oct 2 change.
|
||||
|
||||
Wed Nov 1 15:09:57 1995 Manfred Hollstein KS/EF4A 60/1F/110 #40283 <manfred@lts.sel.alcatel.de>
|
||||
|
||||
* binutils-all/objcopy.exp: Add setup_xfails for
|
||||
m68*-motorola-sysv* and m88*-motorola-sysv*.
|
||||
|
||||
Wed Oct 4 14:38:31 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* binutils-all/nm.exp: Add setup_xfails for XCOFF.
|
||||
|
||||
Mon Oct 2 12:41:48 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* binutils-all/ar.exp: New file.
|
||||
* binutils-all/bintest.s: Make text_symbol and data_symbol global.
|
||||
Add new static symbols static_text_symbol and static_data_symbol.
|
||||
* binutils-all/nm.exp: Adjust accordingly.
|
||||
* config/default.exp (AR): Set if not set.
|
||||
(binutils_remove): New procedure.
|
||||
* lib/utils-lib.exp (default_binutils_run): Call
|
||||
prune_system_crud on program output. Use verbose -log instead of
|
||||
both verbose and send_log.
|
||||
(default_binutils_remove): New procedure.
|
||||
|
||||
* lib/utils-lib.exp (default_binutils_assemble): Call
|
||||
prune_system_crud on assembler output.
|
||||
|
||||
Tue Sep 26 14:07:05 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* binutils-all/objcopy.exp: Add setup_xfails for simple copy test
|
||||
for i386 COFF targets.
|
||||
|
||||
Wed Sep 13 13:20:21 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* lib/utils-lib.exp (prune_system_crud): Define if not defined.
|
||||
* binutils-all/objcopy.exp: Call prune_system_crud on cmp output.
|
||||
|
||||
Sat Aug 19 17:38:06 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* binutils-all/objcopy.exp: Add xfail for i*86-*-aout* for simple
|
||||
copy test.
|
||||
|
||||
Wed Aug 16 16:52:53 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* binutils-all/nm.exp: Add setup_xfail for mips*-sony-bsd* for
|
||||
tests which fail on ECOFF targets.
|
||||
|
||||
* binutils-all/objcopy.exp: Change i*86-*-linux xfail for simple
|
||||
copy test to check for i*86-*-linuxaout* instead.
|
||||
|
||||
Tue Aug 8 17:48:37 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* binutils-all/objcopy.exp: Add setup_xfail for a29k-*-vxworks*
|
||||
for simple copy test.
|
||||
|
||||
Tue Jul 25 11:57:12 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* binutils-all/objcopy.exp: Change setup_xfail for simple copy
|
||||
test from i960-*-vxworks5.1 to i960-*-vxworks*.
|
||||
|
||||
Mon Jul 10 12:25:46 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* binutils-all/objcopy.exp: Add setup_xfail for z8*-*-coff for
|
||||
simple copy test.
|
||||
* binutils-all/objdump.exp (cpus_expected): Add z8001 and z8002.
|
||||
|
||||
Sun May 21 20:32:53 1995 Jeff Law (law@snake.cs.utah.edu)
|
||||
|
||||
* binutils-all/hppa/objdump.exp (addendbug): Handle PA ELF targets
|
||||
too.
|
||||
* binutils-all/objcopy.exp (simple copy): Don't expect PA ELF
|
||||
targets to fail.
|
||||
|
||||
Tue Apr 4 14:52:08 1995 Jeff Law (law@snake.cs.utah.edu)
|
||||
|
||||
* binutils-all/hppa: Renamed from binutils-hppa.
|
||||
|
||||
Wed Mar 29 12:02:43 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* binutils-all/objcopy.exp: Add setup_xfail for simple copy test
|
||||
for h8500-*-hms and h8500-*-coff.
|
||||
|
||||
Tue Mar 28 11:18:28 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* binutils-all/objcopy.exp: Add setup_xfail for simple copy test
|
||||
for m68*-ericsson-ose and m88*-*-coff.
|
||||
|
||||
Mon Mar 27 11:27:31 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* binutils-all/objcopy.exp: Add setup_xfail for simple copy test
|
||||
for m68*-*-vxworks*.
|
||||
|
||||
Fri Mar 24 11:44:25 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* binutils-hppa/objdump.exp: Correct hppa*-*-* check.
|
||||
|
||||
Tue Mar 21 10:48:45 1995 Jeff Law (law@snake.cs.utah.edu)
|
||||
|
||||
* binutils-hppa/addendbug.s: New testcase.
|
||||
* binutils-hppa/objdump.exp: Run it.
|
||||
|
||||
Mon Mar 20 11:31:05 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* lib/utils-lib.exp (default_binutils_run): Quote any dollar signs
|
||||
in progargs before passing it to exec.
|
||||
|
||||
Fri Mar 17 16:39:31 1995 Jeff Law (law@snake.cs.utah.edu)
|
||||
|
||||
* config/hppa.sed: Sed script to transform bintest.s into proper
|
||||
PA assembly code.
|
||||
* binutils-all/nm.exp: Enable these tests on the PA.
|
||||
* binutils-all/objcopy.exp: Enable these tests on the PA. Expect
|
||||
simple copy to fail.
|
||||
* binutils-all/objdump.exp: Enable these tests on the PA. Handle
|
||||
"CODE" as a section name.
|
||||
* binutils-all/size.exp: Enable these tests on the PA.
|
||||
* lib/utils-lib.exp (default_binutils_assemble): For "hppa*-*-*",
|
||||
run the assembly through a sed script before passing it to the
|
||||
assembler.
|
||||
|
||||
Wed Mar 15 16:47:13 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* binutils-all/objdump.exp: Force section sizes to be interpreted
|
||||
in hex. Change objdump -h failure mode to always use the same
|
||||
string.
|
||||
|
||||
Thu Jan 5 13:01:43 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* binutils-all/nm.exp: Just check for irix4*, rather than
|
||||
irix\[0-4\]*, to avoid DejaGnu bug.
|
||||
|
||||
Thu Dec 15 19:35:31 1994 Ken Raeburn <raeburn@cujo.cygnus.com>
|
||||
|
||||
* binutils-all/objcopy.exp: Expect simple-objcopy test to fail
|
||||
for various other targets for which gas doesn't use bfd: sh-hms,
|
||||
m68k-hpux, m68k-sunos, m68k-coff, i386-linux, a29k-udi, a29k-coff,
|
||||
i960-vxworks5.1, i960-coff, h8300-hms, h8300-coff.
|
||||
|
||||
Wed Dec 14 15:54:46 1994 Ken Raeburn <raeburn@cujo.cygnus.com>
|
||||
|
||||
* binutils-all/size.exp: Skip tests requiring bintest.o on hppa,
|
||||
since it (correctly) generates syntax errors on that platform.
|
||||
* binutils-all/objdump.exp: Ditto.
|
||||
* binutils-all/nm.exp: Ditto.
|
||||
* binutils-all/objcopy.exp: Ditto. Also, move setup_xfail for
|
||||
sh-coff to branch where objcopy execution produced no error
|
||||
messages. Expect failure for hp300 also.
|
||||
|
||||
Thu Dec 8 14:36:15 1994 Ken Raeburn <raeburn@cujo.cygnus.com>
|
||||
|
||||
* binutils-all/objdump.exp (cpus_expected): New variable, taken
|
||||
from objdump -i test, added ns32k and powerpc, sorted.
|
||||
(objdump -i, -f tests): Use $cpus_expected.
|
||||
|
||||
* binutils-all/objcopy.exp: For simple-copy test, expect failure
|
||||
for sh-coff.
|
||||
|
||||
Tue Oct 25 16:00:14 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
|
||||
|
||||
* binutils-all/objcopy.exp: Adjust --adjust-section-vma tests for
|
||||
new S-record section handling.
|
||||
|
||||
Tue Oct 18 11:18:21 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
|
||||
|
||||
* binutils-all/nm.exp: nm with no arguments and nm -P do not work
|
||||
as expected on ECOFF targets; add calls to setup_xfail.
|
||||
|
||||
* binutils-all/objcopy.exp: New file.
|
||||
* config/default.exp: Initialize OBJCOPY and OBJCOPYFLAGS.
|
||||
|
||||
Fri Oct 14 14:46:22 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
|
||||
|
||||
Rewrite testsuite.
|
||||
* configure.in, Makefile.in: Remove.
|
||||
* binutils-all/configure.in, binutils-all/Makefile.in: Remove.
|
||||
* binutils-all/bintest.c: Remove.
|
||||
* binutils-all/bintest.s: New file.
|
||||
* binutils-all/nm.exp, binutils-all/objdump.exp: Rewrite.
|
||||
* binutils-all/size.exp: Rewrite.
|
||||
* config/default.exp: Load utils-lib.exp. Set AS and ASFLAGS.
|
||||
Don't go up one directory from $base_dir. Create tmpdir.
|
||||
(binutils_run, binutils-assemble): New procedures.
|
||||
* config/unix.exp: Remove.
|
||||
* config/mt-a29k-udi, config/mt-i386-aout: Remove.
|
||||
* config/mt-i960-nindy, config/mt-lynx, config/mt-m68k: Remove.
|
||||
* config/mt-mips-ecoff, config/mt-slite: Remove.
|
||||
* config/mt-sparc-aout, config/mt-vxworks: Remove.
|
||||
* lib/utils-lib.exp (binutil_version): Don't redirect standard
|
||||
input when getting version. Don't unset errorInfo.
|
||||
(default_binutils_run): New procedure.
|
||||
(default_binutils_assemble): New procedure.
|
||||
|
||||
Thu Sep 29 12:45:39 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
|
||||
|
||||
* VMS does not permit `.' in directory names: renamed binutils.all
|
||||
to binutils-all.
|
||||
* configure.in (configdirs): Change binutils.all to binutils-all.
|
||||
|
||||
Fri Sep 23 16:01:14 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
|
||||
|
||||
* configure.in: Use mt-m68k for m68k*-*-aout* and m68k*-*-coff*,
|
||||
not for m68k-*-*.
|
||||
|
||||
Fri Sep 23 13:54:50 1994 Ken Raeburn <raeburn@cujo.cygnus.com>
|
||||
|
||||
* binutils.all/objdump.exp: Added ARM to list of CPU types.
|
||||
|
||||
Thu Sep 22 11:04:50 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
|
||||
|
||||
* binutils.all/objdump.exp: Update for new usage message.
|
||||
* binutils.all/size.exp: Use a double backslash in the string to
|
||||
get a single backslash to the regexp matcher. Accept $TEXT$,
|
||||
$DATA$ and $BSS$ as well as .text, .data and .bss, for HP/UX.
|
||||
|
||||
Fri Sep 2 12:53:10 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
|
||||
|
||||
* config/unix.exp: If nm.new does not exist, use [transform nm].
|
||||
* config/default.exp: Likewise.
|
||||
|
||||
Wed Aug 24 12:41:37 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
|
||||
|
||||
* configure.in, binutils.all/configure.in: Change i386 to
|
||||
i[345]86.
|
||||
|
||||
Tue Jul 19 15:23:53 1994 Bill Cox (bill@rtl.cygnus.com)
|
||||
|
||||
* config/mt-mips-ecoff: Add -Tidp.ld option.
|
||||
|
||||
Thu Jun 30 12:41:55 1994 J.T. Conklin (jtc@phishhead.cygnus.com)
|
||||
|
||||
* config/default.exp: Use nm.new, not nm, from newly built tree.
|
||||
|
||||
Tue May 17 14:04:05 1994 Bill Cox (bill@rtl.cygnus.com)
|
||||
|
||||
* config/default.exp, config/unix.exp: Replace error
|
||||
proc calls with perror.
|
||||
|
||||
Tue May 10 11:20:54 1994 Stan Shebs (shebs@andros.cygnus.com)
|
||||
|
||||
* configure.in (sparclite): Match on sparclite*-*-*.
|
||||
|
||||
Wed Apr 13 18:25:19 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
|
||||
|
||||
* config/unix.exp: Use nm.new, not nm, from newly built tree.
|
||||
|
||||
* binutils.all/objdump.exp: Add more wildcards to list of
|
||||
single-letter options in pattern for usage message.
|
||||
|
||||
* binutils.all/nm.exp: Deleted debug-symbols test, since it only
|
||||
works for a.out/stabs systems. Fixed regexps to make underscores
|
||||
optional, since some C compilers don't prepend them. Deleted
|
||||
check for foo.o symbol, since again some systems don't generate
|
||||
it.
|
||||
|
||||
Mon Apr 11 10:31:00 1994 Bill Cox (bill@rtl.cygnus.com)
|
||||
|
||||
* Makefile.in (check): Set TCL_LIBRARY for runtest.
|
||||
|
||||
Mon Feb 14 19:34:03 1994 Rob Savoye (rob@darkstar.cygnus.com)
|
||||
|
||||
* Makefile.in: Use new config features of DejaGnu in site.exp
|
||||
file. "Make check" should now work for all crosses.
|
||||
|
||||
Fri Jan 28 18:00:29 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
|
||||
|
||||
* binutils.all/objdump.exp: In usage message, accept
|
||||
"section-name" as well as "section_name".
|
||||
|
||||
Mon Jan 17 16:57:02 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
|
||||
|
||||
* binutils.all/objdump.exp: Trim list of format names expected,
|
||||
and accept any known CPU type.
|
||||
|
||||
Thu Dec 2 20:50:24 1993 Rob Savoye (rob@darkstar.cygnus.com)
|
||||
|
||||
* Makefile.in: Remove some stuff from the site.exp file.
|
||||
* config/unix.exp: Add global before seeing if the variables for
|
||||
nm, objdump, and size exist.
|
||||
|
||||
Wed Nov 3 11:12:32 1993 Rob Savoye (rob@darkstar.cygnus.com)
|
||||
|
||||
* config/udi.exp,unix.exp: Transform tool name.
|
||||
* binutils.all/*.exp: Clear errorInfo after exec.
|
||||
|
||||
Fri Jul 2 12:41:20 1993 Ian Lance Taylor (ian@cygnus.com)
|
||||
|
||||
* binutils.all/*.exp: Use -- for long arguments rather than +.
|
||||
|
||||
Fri Jun 4 10:52:29 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
|
||||
|
||||
* configure.in: change srctrigger to Makefile.in
|
||||
|
||||
Wed May 26 17:27:46 1993 Ian Lance Taylor (ian@cygnus.com)
|
||||
|
||||
* Makefile.in (FLAGS_TO_PASS): Pass down CC and CFLAGS.
|
||||
|
||||
Fri May 7 13:58:44 1993 Ian Lance Taylor (ian@cygnus.com)
|
||||
|
||||
* binutils.all/objdump.exp: Update for new usage message.
|
||||
|
||||
Mon Apr 19 14:08:52 1993 Rob Savoye (rob@darkstar.cygnus.com)
|
||||
|
||||
* binutils.all/*.exp: Use the new util_test proc.
|
||||
* Makefile.in: Create a local site.exp file with config info.
|
||||
|
||||
Thu Mar 25 05:38:47 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com)
|
||||
|
||||
* nm.all/configure.in (srcname): Delete extra quote.
|
||||
|
||||
Mon Feb 22 07:54:03 1993 Mike Werner (mtw@poseidon.cygnus.com)
|
||||
|
||||
* binutils/testsuite: made modifications to testcases, etc., to allow
|
||||
them to work properly given the reorganization of deja-gnu and the
|
||||
relocation of the testcases from deja-gnu to a "tool" subdirectory.
|
||||
|
||||
Sun Feb 21 10:55:55 1993 Mike Werner (mtw@poseidon.cygnus.com)
|
||||
|
||||
* binutils/testsuite: Initial creation of binutils/testsuite.
|
||||
Migrated dejagnu testcases and support files for testing nm to
|
||||
binutils/testsuite from deja-gnu. These files were moved "as is"
|
||||
with no modifications. This migration is part of a major overhaul
|
||||
of dejagnu. The modifications to these testcases, etc., which
|
||||
will allow them to work with the new version of dejagnu will be
|
||||
made in a future update.
|
||||
|
||||
@@ -1,219 +0,0 @@
|
||||
# Copyright (C) 1995, 1997 Free Software Foundation, Inc.
|
||||
|
||||
# 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# Please email any bugs, comments, and/or additions to this file to:
|
||||
# bug-dejagnu@prep.ai.mit.edu
|
||||
|
||||
# Written by Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
if ![is_remote host] {
|
||||
if {[which $AR] == 0} then {
|
||||
perror "$AR does not exist"
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
# send_user "Version [binutil_version $AR]"
|
||||
|
||||
# Test long file name support
|
||||
|
||||
proc long_filenames { } {
|
||||
global AR
|
||||
global host_triplet
|
||||
|
||||
set testname "ar long file names"
|
||||
|
||||
set n1 "abcdefghijklmnopqrstuvwxyz1"
|
||||
set n2 "abcdefghijklmnopqrstuvwxyz2"
|
||||
set file1 tmpdir/$n1
|
||||
set file2 tmpdir/$n2
|
||||
|
||||
remote_file build delete $file1
|
||||
|
||||
# Some file systems truncate file names at 14 characters, which
|
||||
# makes it impossible to run this test. Check for that now.
|
||||
set status [catch "set f [open tmpdir/$n1 w]" errs]
|
||||
if { $status != 0 } {
|
||||
verbose -log "open tmpdir/$n1 returned $errs"
|
||||
unsupported $testname
|
||||
return
|
||||
}
|
||||
puts $f "first"
|
||||
close $f
|
||||
|
||||
|
||||
remote_file build delete $file2
|
||||
|
||||
set status [catch "set f [open tmpdir/$n2 w]" errs]
|
||||
if { $status != 0 } {
|
||||
verbose -log "open tmpdir/$n2 returned $errs"
|
||||
unsupported $testname
|
||||
return
|
||||
}
|
||||
puts $f "second"
|
||||
close $f
|
||||
|
||||
if [is_remote host] {
|
||||
set file1 [remote_download host $file1];
|
||||
set file2 [remote_download host $file2];
|
||||
set dest artest.a
|
||||
} else {
|
||||
set dest tmpdir/artest.a
|
||||
}
|
||||
|
||||
remote_file host delete $dest;
|
||||
|
||||
set got [binutils_run $AR "rc $dest $file1 $file2"]
|
||||
if [is_remote host] {
|
||||
remote_upload host $file1 tmpdir/$n1
|
||||
}
|
||||
|
||||
set f [open tmpdir/$n1 r]
|
||||
gets $f string
|
||||
close $f
|
||||
if ![string match "first" $string] {
|
||||
verbose -log "reading tmpdir/$n1 returned $string"
|
||||
unsupported $testname
|
||||
return
|
||||
}
|
||||
|
||||
remote_file host delete $dest;
|
||||
set got [binutils_run $AR "rc $dest $file1 $file2"]
|
||||
|
||||
if ![string match "" $got] {
|
||||
fail $testname
|
||||
return
|
||||
}
|
||||
|
||||
remote_file build delete tmpdir/$n1
|
||||
remote_file build delete tmpdir/$n2
|
||||
|
||||
set got [binutils_run $AR "t $dest"]
|
||||
regsub "\[\r\n \t\]*$" "$got" "" got;
|
||||
if ![string match "$n1*$n2" $got] {
|
||||
fail $testname
|
||||
return
|
||||
}
|
||||
|
||||
if [is_remote host] {
|
||||
remote_file host delete $file1;
|
||||
remote_file host delete $file2;
|
||||
}
|
||||
|
||||
verbose -log "$AR x $dest"
|
||||
set exec_output [binutils_run $AR "x $dest"]
|
||||
set exec_output [prune_warnings $exec_output]
|
||||
if ![string match "" $exec_output] {
|
||||
verbose -log $exec_output
|
||||
fail $testname
|
||||
return
|
||||
}
|
||||
|
||||
if [is_remote host] {
|
||||
remote_upload host $n1 tmpdir/$n1;
|
||||
remote_upload host $n2 tmpdir/$n2;
|
||||
set file1 tmpdir/$n1
|
||||
set file2 tmpdir/$n2
|
||||
} else {
|
||||
set file1 $n1
|
||||
set file2 $n2
|
||||
}
|
||||
|
||||
if ![file exists $file1] {
|
||||
verbose -log "$file1 does not exist"
|
||||
fail $testname
|
||||
return
|
||||
}
|
||||
if ![file exists $file2] {
|
||||
verbose -log "$file2 does not exist"
|
||||
fail $testname
|
||||
return
|
||||
}
|
||||
|
||||
set f [open $file1 r]
|
||||
if { [gets $f line] == -1 || $line != "first" } {
|
||||
verbose -log "$file1 contents:"
|
||||
verbose -log "$line"
|
||||
close $f
|
||||
fail $testname
|
||||
return
|
||||
}
|
||||
close $f
|
||||
|
||||
set f [open $file2 r]
|
||||
if { [gets $f line] == -1 || $line != "second" } {
|
||||
verbose -log "$file2 contents:"
|
||||
verbose -log "$line"
|
||||
close $f
|
||||
fail $testname
|
||||
return
|
||||
}
|
||||
close $f
|
||||
|
||||
pass $testname
|
||||
}
|
||||
|
||||
# Test building the symbol table.
|
||||
|
||||
proc symbol_table { } {
|
||||
global AR
|
||||
global AS
|
||||
global NM
|
||||
global srcdir
|
||||
global subdir
|
||||
|
||||
set testname "ar symbol table"
|
||||
|
||||
if ![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o] {
|
||||
unresolved $testname
|
||||
return
|
||||
}
|
||||
|
||||
if [is_remote host] {
|
||||
set archive artest.a
|
||||
set objfile [remote_download host tmpdir/bintest.o]
|
||||
remote_file host delete $archive
|
||||
} else {
|
||||
set archive tmpdir/artest.a
|
||||
set objfile tmpdir/bintest.o
|
||||
}
|
||||
|
||||
remote_file build delete tmpdir/artest.a
|
||||
|
||||
set got [binutils_run $AR "rc $archive ${objfile}"]
|
||||
if ![string match "" $got] {
|
||||
fail $testname
|
||||
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] \
|
||||
|| ![string match "*common_symbol in bintest.o*" $got] \
|
||||
|| [string match "*static_text_symbol in bintest.o*" $got] \
|
||||
|| [string match "*static_data_symbol in bintest.o*" $got] \
|
||||
|| [string match "*external_symbol in bintest.o*" $got] } {
|
||||
fail $testname
|
||||
return
|
||||
}
|
||||
|
||||
pass $testname
|
||||
}
|
||||
|
||||
# Run the tests.
|
||||
|
||||
long_filenames
|
||||
symbol_table
|
||||
@@ -1,12 +0,0 @@
|
||||
.globl text_symbol
|
||||
.text
|
||||
text_symbol:
|
||||
static_text_symbol:
|
||||
.long 1
|
||||
.long external_symbol
|
||||
.globl data_symbol
|
||||
.data
|
||||
data_symbol:
|
||||
static_data_symbol:
|
||||
.long 2
|
||||
.comm common_symbol,4
|
||||
@@ -1,23 +0,0 @@
|
||||
.SPACE $PRIVATE$
|
||||
.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
|
||||
.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
|
||||
.SPACE $TEXT$
|
||||
.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
|
||||
.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
|
||||
.IMPORT $global$,DATA
|
||||
.IMPORT $$dyncall,MILLICODE
|
||||
; gcc_compiled.:
|
||||
.SPACE $TEXT$
|
||||
.SUBSPA $CODE$
|
||||
|
||||
.align 4
|
||||
.EXPORT initialize_char_syntax,CODE
|
||||
.EXPORT initialize_char_syntax,ENTRY,PRIV_LEV=3,RTNVAL=GR
|
||||
initialize_char_syntax
|
||||
.PROC
|
||||
.CALLINFO FRAME=64,NO_CALLS,SAVE_SP,ENTRY_GR=3
|
||||
.ENTRY
|
||||
addil L'is_idchar-$global$-32,%r27
|
||||
.EXIT
|
||||
.PROCEND
|
||||
is_idchar .comm 256
|
||||
@@ -1,23 +0,0 @@
|
||||
.LEVEL 2.0
|
||||
.SPACE $PRIVATE$
|
||||
.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
|
||||
.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
|
||||
.SPACE $TEXT$
|
||||
.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
|
||||
.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
|
||||
.IMPORT $global$,DATA
|
||||
.IMPORT $$dyncall,MILLICODE
|
||||
; gcc_compiled.:
|
||||
.SPACE $TEXT$
|
||||
.SUBSPA $CODE$
|
||||
|
||||
.align 4
|
||||
.NSUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
|
||||
.EXPORT main,ENTRY,PRIV_LEV=3,RTNVAL=GR
|
||||
main
|
||||
.PROC
|
||||
.CALLINFO FRAME=64,CALLS,SAVE_RP
|
||||
.ENTRY
|
||||
fmpyfadd,sgl %fr4L,%fr4R,%fr5R,%fr5L
|
||||
.EXIT
|
||||
.PROCEND
|
||||
@@ -1,90 +0,0 @@
|
||||
# Copyright (C) 1993, 1994, 1996, 1997 Free Software Foundation, Inc.
|
||||
|
||||
# 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# Please email any bugs, comments, and/or additions to this file to:
|
||||
# bug-dejagnu@prep.ai.mit.edu
|
||||
|
||||
# This file was written by Rob Savoye <rob@cygnus.com>
|
||||
# and rewritten by Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
if ![istarget hppa*-*-*] then {
|
||||
return
|
||||
}
|
||||
|
||||
# These tests are not suitable for wide mode.
|
||||
if [istarget hppa*w-*-*] then {
|
||||
return
|
||||
}
|
||||
|
||||
if {[which $OBJDUMP] == 0} then {
|
||||
perror "$OBJDUMP does not exist"
|
||||
return
|
||||
}
|
||||
|
||||
send_user "Version [binutil_version $OBJDUMP]"
|
||||
|
||||
if {![binutils_assemble $srcdir/$subdir/addendbug.s tmpdir/addendbug.o]} then {
|
||||
return
|
||||
}
|
||||
|
||||
if [is_remote host] {
|
||||
set objfile [remote_download host tmpdir/addendbug.o]
|
||||
} else {
|
||||
set objfile tmpdir/addendbug.o
|
||||
}
|
||||
|
||||
# Make sure the SOM BFD code sign extends constants in R_DATA_OVERRIDE fixups.
|
||||
|
||||
set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -r $objfile"]
|
||||
|
||||
if [istarget hppa*-*-*elf*] then {
|
||||
set want "00000000 R_PARISC_DPREL21L\[ \]+is_idchar\\+0xffffffe0.*"
|
||||
} else {
|
||||
set want "00000000 R_DP_RELATIVE\[ \]+is_idchar\\+0xffffffe0.*"
|
||||
}
|
||||
|
||||
|
||||
if [regexp $want $got] then {
|
||||
pass "addendbug test"
|
||||
} else {
|
||||
fail "addendbug test"
|
||||
}
|
||||
|
||||
###########################
|
||||
# Set up the test of freg.s
|
||||
###########################
|
||||
|
||||
if {![binutils_assemble $srcdir/$subdir/freg.s tmpdir/freg.o]} then {
|
||||
return
|
||||
}
|
||||
|
||||
if [is_remote host] {
|
||||
set objfile [remote_download host tmpdir/freg.o]
|
||||
} else {
|
||||
set objfile tmpdir/freg.o
|
||||
}
|
||||
|
||||
# Make sure that we get R float regs like we're supposed to
|
||||
|
||||
set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --disassemble $objfile"]
|
||||
|
||||
set want "fmpyfadd,sgl fr4,fr4R,fr5R,fr5"
|
||||
|
||||
if [regexp $want $got] then {
|
||||
pass "freg test"
|
||||
} else {
|
||||
fail "freg test"
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user