mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-11-16 12:34:43 +00:00
Compare commits
14 Commits
users/ARM/
...
gdb-csl-ar
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad35633034 | ||
|
|
aeda20731a | ||
|
|
0e401d36ea | ||
|
|
41b2f620c2 | ||
|
|
03d4a9d669 | ||
|
|
fff8eeb5c9 | ||
|
|
7eec81d6b8 | ||
|
|
a7563e6217 | ||
|
|
9fd8ce56f4 | ||
|
|
b5888f94c7 | ||
|
|
2ba1c45d6d | ||
|
|
0882e1995d | ||
|
|
76818f3b61 | ||
|
|
25cf6930c8 |
258
ChangeLog.csl
Normal file
258
ChangeLog.csl
Normal file
@@ -0,0 +1,258 @@
|
||||
2006-01-26 Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* gdb/regformats/regdat.sh: Include <stdlib.h>.
|
||||
|
||||
2006-01-26 Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
Backport:
|
||||
2006-01-24 Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
PR gdb/1914
|
||||
* fork-child.c (fork_inferior): Don't call
|
||||
solib_create_inferior_hook.
|
||||
* infcmd.c (post_create_inferior): Call solib_add,
|
||||
solib_create_inferior_hook, and re_enable_breakpoints_in_shlibs.
|
||||
(attach_command): Don't call solib_add or
|
||||
re_enable_breakpoints_in_shlibs. Call post_create_inferior
|
||||
instead.
|
||||
* remote.c (remote_open_1): Don't call solib_create_inferior_hook
|
||||
or observer_notify_inferior_created. Call post_create_inferior
|
||||
instead.
|
||||
* corelow.c: Don't include "observer.h".
|
||||
(solib_add_stub): Deleted.
|
||||
(core_open): Don't call observer_notify_inferior_created or
|
||||
solib_add_stub. Call post_create_inferior instead.
|
||||
* inf-ptrace.c: Don't include "observer.h".
|
||||
(inf_ptrace_attach): Don't call observer_notify_inferior_created.
|
||||
* inf-ttrace.c: Don't include "observer.h".
|
||||
(inf_ttrace_attach): Don't call observer_notify_inferior_created.
|
||||
* inferior.h (solib_create_inferior_hook): Remove redundant
|
||||
prototype.
|
||||
* inftarg.c: Don't include "observer.h".
|
||||
(child_attach): Don't call observer_notify_inferior_created.
|
||||
* Makefile.in: Update dependencies.
|
||||
|
||||
2006-01-26 Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
Backport:
|
||||
2006-01-24 Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* infcmd.c: Include "observer.h".
|
||||
(post_create_inferior): New function.
|
||||
(run_command_1): Call it. Also call proceed.
|
||||
* inferior.h (post_create_inferior): New prototype.
|
||||
* Makefile.in (infcmd.o): Update.
|
||||
|
||||
* gnu-nat.c (gnu_create_inferior): Don't call proceed.
|
||||
* go32-nat.c (go32_create_inferior): Likewise.
|
||||
* nto-procfs.c (procfs_create_inferior): Likewise.
|
||||
* procfs.c (procfs_create_inferior): Likewise.
|
||||
* remote-sim.c (gdbsim_create_inferior): Likewise.
|
||||
* remote.c (extended_remote_create_inferior)
|
||||
(extended_remote_async_create_inferior): Likewise.
|
||||
* win32-nat.c (win32_create_inferior): Likewise.
|
||||
* wince.c (child_create_inferior): Likewise.
|
||||
|
||||
* monitor.c (monitor_create_inferior): Don't call proceed.
|
||||
Set the PC manually.
|
||||
* ocd.c (ocd_create_inferior): Likewise.
|
||||
* remote-e7000.c (e7000_create_inferior): Likewise.
|
||||
* remote-m32r-sdi.c (m32r_create_inferior): Likewise.
|
||||
* remote-mips.c (mips_create_inferior): Likewise.
|
||||
* remote-rdi.c (arm_rdi_create_inferior): Likewise.
|
||||
* remote-rdp.c (remote_rdp_create_inferior): Likewise.
|
||||
* remote-sds.c (sds_create_inferior): Likewise.
|
||||
* remote-st.c (st2000_create_inferior): Likewise.
|
||||
|
||||
* inf-ptrace.c (inf_ptrace_create_inferior): Don't call
|
||||
proceed or observer_notify_inferior_created.
|
||||
* inf-ttrace.c (inf_ttrace_create_inferior): Likewise.
|
||||
* inftarg.c (child_create_inferior): Likewise.
|
||||
|
||||
2006-01-24 Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* gdb/gdbserver/linux-arm-low.c: Move #include below ELF_GREGSET_T
|
||||
definition.
|
||||
|
||||
2005-10-20 Julian Brown <julian@codesourcery.com>
|
||||
|
||||
* gdb/arm-tdep.c (thumb2_modify_constant): Silence compiler warning.
|
||||
(thumb_scan_prologue): Fix typo.
|
||||
|
||||
2005-10-20 Julian Brown <julian@codesourcery.com>
|
||||
|
||||
* gdb/arm-tdep.c (bitcount): Move function higher up in file.
|
||||
(thumb2_it_block): New function. Find the next instruction to be
|
||||
executed in an IT block.
|
||||
(thumb_get_next_pc): Handle 16- and 32-bit Thumb-2 instructions.
|
||||
|
||||
2005-10-20 Julian Brown <julian@codesourcery.com>
|
||||
|
||||
* gdb/arm-tdep.c (submask, bit, bits, sbits): Move macro definitions.
|
||||
(thumb_skip_prologue): Don't require frame pointer. Handle Thumb-2
|
||||
prologue instructions.
|
||||
(thumb_get_insn): New function. Read a Thumb or Thumb-2 instruction
|
||||
from memory.
|
||||
(arm_skip_prologue): Change comment to include Thumb-2.
|
||||
(thumb2_modify_constant): New function. Perform the Thumb-2 12-bit
|
||||
immediate transformation.
|
||||
(thumb_scan_prologue): Handle Thumb-2 prologue instructions.
|
||||
|
||||
2005-10-20 Paul Brook <paul@codesourcery.com>
|
||||
|
||||
* arm-tdep.c (arm_iwmmxt_type): New.
|
||||
(arm_build_iwmmxt_type): New function.
|
||||
(arm_register_type): Use it.
|
||||
|
||||
2005-03-30 Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* gdb/Makefile.in (arm-linux-nat.o): Update dependencies.
|
||||
* gdb/arm-linux-nat.c: Include "gdb_assert.h".
|
||||
(PTRACE_GETWMMXREGS, PTRACE_SETWMMXREGS): Define.
|
||||
(arm_linux_has_wmmx_registers): New flag.
|
||||
(GET_THREAD_ID): Remove stray punctuation.
|
||||
(IWMMXT_REGS_SIZE): Define.
|
||||
(fetch_wmmx_regs, store_wmmx_regs): New functions.
|
||||
(fetch_inferior_registers, store_inferior_registers): Call them.
|
||||
(arm_linux_available_registers): New function.
|
||||
* gdb/inftarg.c (child_xfer_partial): Handle
|
||||
TARGET_OBJECT_AVAILABLE_REGISTERS.
|
||||
* gdb/config/arm/nm-linux.h (arm_linux_available_registers): Add
|
||||
prototype.
|
||||
(NATIVE_XFER_AVAILABLE_REGISTERS): Define.
|
||||
|
||||
* gdb/gdbserver/linux-arm-low.c (arm_fill_wmmxregset)
|
||||
(arm_store_wmmxregset): Remove stray text.
|
||||
(arm_available_registers): Remove debugging output. Use hex.
|
||||
* gdb/gdbserver/regcache.c (num_registers): Make global.
|
||||
* gdb/gdbserver/server.c (handle_p_packet, handle_P_packet): Check
|
||||
the value of regnum.
|
||||
|
||||
2005-03-28 Paul Brook <paul@codesourcery.com>
|
||||
Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* gdb/Makefile.in: arm-tdep.o depends on $(observer_h).
|
||||
* gdb/arm-linux-nat.c (fetch_fpregister, fetch_fpregs,
|
||||
store_fpregister, store_fpregs): Rename...
|
||||
(fetch_fpa_register, fetch_fpa_regs, store_fpa_register,
|
||||
store_fpa_regs): ... to this.
|
||||
* gdb/arm-linux-tdep.c (arm_linux_init_abi): Provide ABI specific
|
||||
overrides.
|
||||
* gdb/arm-tdep.c: Include opserver.h.
|
||||
(struct gdbarch_tdep_info): Add.
|
||||
(arm_push_dummy_call): Handle doubleword alignment.
|
||||
(arm_register_type): Handle iWMMXt and VFP regs.
|
||||
(arm_register_byte): Ditto.
|
||||
(arm_pseudo_register_read): New function.
|
||||
(arm_pseudo_register_write): New function.
|
||||
(arm_dwarf_reg_to_regnum): New function.
|
||||
(arm_register_sim_regno): Handle iWMMXT regs.
|
||||
(arm_register_remote_regno): New function.
|
||||
(arm_extract_return_value): Use new macro names.
|
||||
(arm_register_name): Handle iWMMXt and VFP registers.
|
||||
(arm_sim_available_registers): New function.
|
||||
(arm_update_architecture): New function.
|
||||
(arm_gdbarch_init): Handle optional register sets. Register new
|
||||
hooks. Fix misleading error message.
|
||||
(_initialize_arm_tdep): Call observer_attach_inferior_created.
|
||||
* gdb/arm-tdep.h (ARM_NUM_FP_ARG_REGS, ARM_LAST_FP_ARG_REGNUM,
|
||||
FP_REGISTER_SIZE, NUM_FREGS): Rename ...
|
||||
(ARM_NUM_FPA_ARG_REGS, ARM_LAST_FPA_ARG_REGNUM, FPA_REGISTER_SIZE,
|
||||
NUM_FPA_REGS): ... to this.
|
||||
(NUM_IWMMXT_COP0REGS, NUM_IWMMXT_COP1REGS, NUM_IWMMXT_REGS,
|
||||
IWMMXT_COP0_REGSIZE, IWMMXT_COP1_REGSIZE, NUM_VFP_XREGS,
|
||||
VFP_XREG_SIZE, NUM_VFP_SREGS, VFP_SREG_SIZE, NUM_VFP_PSEUDOS): Define.
|
||||
(struct gdbarch_tdep): Add target_has_iwmmxt_regs,
|
||||
target_has_vfp_regs, first_iwmmxt_regnum, target_iwmmxt_regnum,
|
||||
first_vfp_regnum, first_vfp_pseudo and target_vfp_regnum.
|
||||
* gdb/gdbarch.c (struct gdbarch): Add remote_num_g_packet_regs,
|
||||
sim_available_registers and register_remote_regno.
|
||||
(startup_gdbarch, verify_gdbarch): Ditto.
|
||||
(gdbarch_dump): Dump new fields.
|
||||
(gdbarch_remote_num_g_packet_regs_p, gdbarch_remote_num_g_packet_regs,
|
||||
set_gdbarch_remote_num_g_packet_regs,
|
||||
gdbarch_sim_available_registers_p, gdbarch_sim_available_registers,
|
||||
set_gdbarch_sim_available_registers, gdbarch_register_remote_regno_p,
|
||||
gdbarch_register_remote_regno, set_gdbarch_register_remote_regno):
|
||||
New functions.
|
||||
* gdb/gdbarch.h: Add prototypes.
|
||||
* gdb/gdbarch.sh: Add new fields.
|
||||
(deprecated_current_gdbarch_select_hack): Call flush_cached_frames.
|
||||
* gdb/remote-sim.h (gdbsim_create_inferior): Call
|
||||
observer_notify_inferior_created.
|
||||
(gdbsim_xfer_partial): New function.
|
||||
(init_gdbsim_ops): Use it.
|
||||
* gdb/remote.c (struct remote_state): Add num_g_regs.
|
||||
(init_remote_state): Only consider hard regs. Allow target to provide
|
||||
register mapping.
|
||||
(packet_reg_from_regnum): Don't check pseudo regs.
|
||||
(packet_reg_from_pnum): Ditto.
|
||||
(remote_protocol_qPart_availableRegisters): Add.
|
||||
(set_remote_protocol_qPart_availableRegisters_packet_cmd,
|
||||
show_remote_protocol_qPart_availableRegisters_packet_cmd): New
|
||||
functions.
|
||||
(fetch_register_using_p, store_register_using_P): Handle arbitrary
|
||||
register mappings.
|
||||
(fetch_registers_using_g): New function.
|
||||
(remote_fetch_registers): Use it.
|
||||
(store_registers_using_G): New function.
|
||||
(remote_store_registers): Use it.
|
||||
(remote_xfer_partial): Handle TARGET_OBJECT_AVAILABLE_REGISTERS.
|
||||
(show_remote_cmd): Display availableRegisters.
|
||||
(_initialize_remote): Register qPart_availableRegisters.
|
||||
* gdb/target.h (enum target_object): Add
|
||||
TARGET_OBJECT_AVAILABLE_REGISTERS.
|
||||
* gdb/gdbserver/configure.srv (arm*-*-linux*): set
|
||||
srv_linux_regsets=yes.
|
||||
* gdb/gdbserver/linux-arm-low.c (PTRACE_GETWMMXREGS,
|
||||
PTRACE_SETWMMXREGS): Define.
|
||||
(arm_fill_gregset, arm_store_gregset, arm_fill_wmmxregset,
|
||||
arm_store_wmmxregset, arm_available_registers): New functions.
|
||||
(target_regsets): Add.
|
||||
(the_low_target): Use arm_available_registers.
|
||||
* gdb/gdbserver/linux-low.c (linux_available_registers): New function.
|
||||
(linux_target_op): Use it.
|
||||
* gdb/gdbserver/linux-low.h (gdbserver/linux-low.h): Add
|
||||
available_registers.
|
||||
(use_regsets_p): Declare.
|
||||
* gdb/gdbserver/regcache.c (g_register_bytes): Add.
|
||||
(regcache_invalidate, registers_to_string, registers_from_string):
|
||||
Use it.
|
||||
(set_register_cache): Set g_register_bytes.
|
||||
(supply_register_as_string): New function.
|
||||
* gdb/gdbserver/regcache.h (supply_register_as_string): Add prototype.
|
||||
* gdb/gdbserver/server.c (handle_query): Handle
|
||||
qPart:availableRegisters.
|
||||
(handle_p_packet, handle_P_packet): New functions.
|
||||
(main): Handle 'p' and 'P' packets.
|
||||
* gdb/gdbserver/target.h (struct target_ops): Add available_registers.
|
||||
* gdb/regformats/reg-arm.dat: Add last_g_reg and iWMMXT regs.
|
||||
* gdb/regformats/regdat.sh: Handle last_g_reg.
|
||||
* gdb/regformats/regdef.h (set_register_cache): Update prototype.
|
||||
|
||||
2005-04-29 Paul Brook <paul@codesourcery.com>
|
||||
|
||||
* gdb/remote-sim.c (SIGTRAP): Provide default defnition.
|
||||
* gdb/signals/signals.c (SIGRAP): Ditto.
|
||||
|
||||
2005-04-25 Paul Brook <paul@codesourcery.com>
|
||||
|
||||
* gdb/configure.tgt: Don't build rdi-share library.
|
||||
* gdb/config/arm/embed.mt: Ditto.
|
||||
|
||||
2005-03-25 Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* gdb/Makefile.in (arm-linux-nat.o): Update dependencies.
|
||||
* gdb/arm-linux-nat.c: Include "gdb_proc_service.h".
|
||||
(PTRACE_GET_THREAD_AREA): Define.
|
||||
(ps_get_thread_area): New function.
|
||||
|
||||
* gdb/gdbserver/Makefile.in (linux-arm-low.o): Update dependencies.
|
||||
* gdb/gdbserver/linux-arm-low.c: Include "../gdb_proc_service.h".
|
||||
(PTRACE_GET_THREAD_AREA): Define.
|
||||
(ps_get_thread_area): New function.
|
||||
|
||||
2005-03-25 Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* gdb/elfread.c (elf_symtab_read): Skip symbols which BFD considers
|
||||
special.
|
||||
@@ -1,33 +0,0 @@
|
||||
Please keep the following tables alphabetical.
|
||||
|
||||
Organization Tag Organization Name
|
||||
---------------- -----------------
|
||||
csl CodeSourcery, LLC
|
||||
|
||||
This table lists branches created by particular organizations. Please
|
||||
include the branch name, and a description of the branch. The branch
|
||||
description should name the owner of the branch (i.e., the person to
|
||||
contact regarding the branch) and a description of the commit policy
|
||||
for the branch (e.g., "no commits without permission of X or Y").
|
||||
|
||||
Organization Branches Description
|
||||
--------------------- -----------
|
||||
binutils-csl-arm-2005q1-branch
|
||||
CodeSourcery 2005-Q1 ARM toolchain release branch.
|
||||
Please do not commit to this branch without
|
||||
permission from a CodeSourcery developer.
|
||||
|
||||
binutils-csl-gxxpro-3_4-branch
|
||||
CodeSourcery branded GNU Toolchain release branch.
|
||||
Please do not commit to this branch without
|
||||
permission from a CodeSourcery developer.
|
||||
|
||||
Release Branches
|
||||
----------------
|
||||
binutils-2_10-branch
|
||||
binutils-2_11-branch
|
||||
binutils-2_12-branch
|
||||
binutils-2_13-branch
|
||||
binutils-2_14-branch
|
||||
binutils-2_15-branch
|
||||
binutils-2_16-branch
|
||||
2029
binutils/ChangeLog
2029
binutils/ChangeLog
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,246 +0,0 @@
|
||||
========= Binutils Maintainers =========
|
||||
|
||||
This is the list of individuals responsible for maintenance and update
|
||||
of the GNU Binary Utilities project. This includes the linker (ld),
|
||||
the assembler (gas), the profiler (gprof), a whole suite of other
|
||||
programs (binutils) and the libraries that they use (bfd and
|
||||
opcodes). This project shares a common set of header files with the
|
||||
GCC and GDB projects (include), so maintainership of those files is
|
||||
shared amoungst the projects.
|
||||
|
||||
The home page for binutils is:
|
||||
|
||||
http://www.gnu.org/software/binutils/binutils.html
|
||||
|
||||
and patches should be sent to:
|
||||
|
||||
bug-binutils@gnu.org or binutils@sources.redhat.com
|
||||
|
||||
with "[Patch]" as part of the subject line. Note - patches to the
|
||||
top level config.guess and config.sub scripts should be sent to:
|
||||
|
||||
config-patches@gnu.org
|
||||
|
||||
and not to the binutils lists. Patches to the other top level
|
||||
configure files (configure, configure.in, config-ml.in) should
|
||||
be sent to the binutils lists, and copied to the gcc and gdb
|
||||
lists as well (gcc-patches@gcc.gnu.org and
|
||||
gdb-patches@sources.redhat.com).
|
||||
|
||||
--------- Blanket Write Privs ---------
|
||||
|
||||
The following people have permission to check patches into the
|
||||
repository without obtaining approval first:
|
||||
|
||||
Nick Clifton <nickc@redhat.com> (head maintainer)
|
||||
Richard Henderson <rth@redhat.com>
|
||||
Ian Lance Taylor <ian@airs.com>
|
||||
Jeff Law <law@redhat.com>
|
||||
Jim Wilson <wilson@specifixinc.com>
|
||||
DJ Delorie <dj@redhat.com>
|
||||
Alan Modra <amodra@bigpond.net.au>
|
||||
Michael Meissner <gnu@the-meissners.org>
|
||||
Daniel Jacobowitz <dan@debian.org>
|
||||
|
||||
--------- Maintainers ---------
|
||||
|
||||
Maintainers are individuals who are responsible for, and have
|
||||
permission to check in changes in, certain subsets of the code. Note
|
||||
that maintainers still need approval to check in changes outside of
|
||||
the immediate domain that they maintain.
|
||||
|
||||
If there is no maintainer for a given domain then the responsibility
|
||||
falls to the head maintainer (above). If there are several
|
||||
maintainers for a given domain then responsibility falls to the first
|
||||
maintainer. The first maintainer is free to devolve that
|
||||
responsibility among the other maintainers.
|
||||
|
||||
ALPHA Richard Henderson <rth@redhat.com>
|
||||
ARM Nick Clifton <nickc@redhat.com>
|
||||
ARM Richard Earnshaw <rearnsha@arm.com>
|
||||
ARM (Symbian) Paul Brook <paul@codesourcery.com>
|
||||
ARM (Symbian) Mark Mitchell <mark@codesourcery.com>
|
||||
AVR Denis Chertykov <denisc@overta.ru>
|
||||
AVR Marek Michalkiewicz <marekm@amelek.gda.pl>
|
||||
BFIN Jie Zhang <jie.zhang@analog.com>
|
||||
BUILD SYSTEM Ben Elliston <bje@gnu.org>
|
||||
BUILD SYSTEM Daniel Jacobowitz <dan@debian.org>
|
||||
CRIS Hans-Peter Nilsson <hp@axis.com>
|
||||
CRX Tomer Levi <Tomer.Levi@nsc.com>
|
||||
DWARF2 Jason Merrill <jason@redhat.com>
|
||||
FR30 Dave Brolley <brolley@redhat.com>
|
||||
FRV Dave Brolley <brolley@redhat.com>
|
||||
FRV Alexandre Oliva <aoliva@redhat.com>
|
||||
H8300 Anil Paranjpe <anilp1@kpitcummins.com>
|
||||
HPPA Dave Anglin <dave.anglin@nrc.ca>
|
||||
HPPA elf32 Alan Modra <amodra@bigpond.net.au>
|
||||
HPPA elf64 Jeff Law <law@redhat.com> [Basic maintainance only]
|
||||
IA-64 Jim Wilson <wilson@specifixinc.com>
|
||||
IQ2000 Stan Cox <scox@redhat.com>
|
||||
i860 Jason Eckhardt <jle@rice.edu>
|
||||
ix86 Alan Modra <amodra@bigpond.net.au>
|
||||
ix86 PE Christopher Faylor <cgf@redhat.com>
|
||||
ix86 COFF DJ Delorie <dj@redhat.com>
|
||||
ix86 H.J.Lu <hjl@gnu.org>
|
||||
ix86 INTEL MODE Jan Beulich <jbeulich@novell.com>
|
||||
M68HC11 M68HC12 Stephane Carrez <stcarrez@nerim.fr>
|
||||
M68k Ben Elliston <bje@gnu.org>
|
||||
M88k Mark Kettenis <kettenis@gnu.org>
|
||||
MAXQ Inderpreet Singh <inderpreetb@noida.hcltech.com>
|
||||
MIPS Eric Christopher <echristo@apple.com>
|
||||
MIPS Thiemo Seufer <ths@networkno.de>
|
||||
MMIX Hans-Peter Nilsson <hp@bitrange.com>
|
||||
MN10300 Eric Christopher <echristo@apple.com>
|
||||
MN10300 Alexandre Oliva <aoliva@redhat.com>
|
||||
MSP430 Dmitry Diky <diwil@spec.ru>
|
||||
PPC Geoff Keating <geoffk@geoffk.org>
|
||||
PPC vector ext Aldy Hernandez <aldyh@redhat.com>
|
||||
s390, s390x Martin Schwidefsky <schwidefsky@de.ibm.com>
|
||||
SH J<>rn Rennecke <joern.rennecke@superh.com>
|
||||
SH Alexandre Oliva <aoliva@redhat.com>
|
||||
SH Kaz Kojima <kkojima@rr.iij4u.or.jp>
|
||||
SPARC Jakub Jelinek <jakub@redhat.com>
|
||||
TESTSUITES Ben Elliston <bje@gnu.org>
|
||||
TIC4X Svein Seldal <svein@dev.seldal.com>
|
||||
TIC54X Timothy Wall <twall@alum.mit.edu>
|
||||
VAX Jason R Thorpe <thorpej@netbsd.org>
|
||||
x86_64 Jan Hubicka <jh@suse.cz>
|
||||
x86_64 Andreas Jaeger <aj@suse.de>
|
||||
Xtensa Bob Wilson <bob.wilson@acm.org>
|
||||
z8k Christian Groessler <chris@groessler.org>
|
||||
|
||||
|
||||
--------- CGEN Maintainers -------------
|
||||
|
||||
CGEN is a tool for building, amongst other things, assemblers,
|
||||
disassemblers and simulators from a single description of a CPU.
|
||||
It creates files in several of the binutils directories, but it
|
||||
is mentioned here since there is a single group that maintains
|
||||
CGEN and the files that it creates.
|
||||
|
||||
If you have CGEN related problems you can send email to;
|
||||
|
||||
cgen@sources.redhat.com
|
||||
|
||||
The current CGEN maintainers are:
|
||||
|
||||
Doug Evans, Ben Elliston, Frank Eigler
|
||||
|
||||
--------- Write After Approval ---------
|
||||
|
||||
Individuals with "write after approval" have the ability to check in
|
||||
changes, but they must get approval for each change from someone in
|
||||
one of the above lists (blanket write or maintainers).
|
||||
|
||||
[It's a huge list, folks. You know who you are. If you have the
|
||||
*ability* to do binutils checkins, you're in this group. Just
|
||||
remember to get approval before checking anything in.]
|
||||
|
||||
------------- Obvious Fixes -------------
|
||||
|
||||
Fixes for obvious mistakes do not need approval, and can be checked in
|
||||
right away, but the patch should still be sent to the binutils list.
|
||||
The definition of obvious is a bit hazy, and if you are not sure, then
|
||||
you should seek approval first. Obvious fixes include fixes for
|
||||
spelling mistakes, blatantly incorrect code (where the correct code is
|
||||
also blatantly obvious), and so on. Obvious fixes should always be
|
||||
small, the larger they are, the more likely it is that they contain
|
||||
some un-obvious side effect or consequence.
|
||||
|
||||
--------- Branch Checkins ---------
|
||||
|
||||
If a patch is approved for check in to the mainline sources, it can
|
||||
also be checked into the current release branch. Normally however
|
||||
only bug fixes should be applied to the branch. New features, new
|
||||
ports, etc, should be restricted to the mainline. (Otherwise the
|
||||
burden of maintaining the branch in sync with the mainline becomes too
|
||||
great). If you are uncertain as to whether a patch is appropriate for
|
||||
the branch, ask the branch maintainer. This is:
|
||||
|
||||
Daniel Jacobowitz <dan@debian.org>
|
||||
|
||||
-------- Testsuites ---------------
|
||||
|
||||
In general patches to any of the binutils testsuites should be
|
||||
considered generic and sent to the binutils mailing list for
|
||||
approval. Patches to target specific tests are the responsibility the
|
||||
relevent port maintainer(s), and can be approved/checked in by them.
|
||||
Other testsuite patches need the approval of a blanket-write-priveleges
|
||||
person.
|
||||
|
||||
-------- Configure patches ----------
|
||||
|
||||
Patches to the top level configure files (config.sub & config.guess)
|
||||
are not the domain of the binutils project and they cannot be approved
|
||||
by the binutils group. Instead they should be submitted to the config
|
||||
maintainer at:
|
||||
|
||||
config-patches@gnu.org
|
||||
|
||||
--------- Creating Branches ---------
|
||||
|
||||
Anyone with at least write-after-approval access may create a branch
|
||||
to use for their own development purposes. In keeping with FSF
|
||||
policies, all patches applied to such a branch must come from people
|
||||
with appropriate copyright assignments on file. All legal
|
||||
requirements that would apply to any other contribution apply equally
|
||||
to contributions on a branch.
|
||||
|
||||
Before creating the branch, you should select a name for the branch of
|
||||
the form:
|
||||
|
||||
binutils-<org>-<name>
|
||||
|
||||
where "org" is the initials of your organization, or your own initials
|
||||
if you are acting as an individual. For example, for a branch created
|
||||
by The GNUDist Company, "tgc" would be an appropriate choice for
|
||||
"org". It's up to each organization to select an appropriate choice
|
||||
for "name"; some organizations may use more structure than others, so
|
||||
"name" may contain additional hyphens.
|
||||
|
||||
Suppose that The GNUDist Company was creating a branch to develop a
|
||||
port of Binutils to the FullMonty processor. Then, an appropriate
|
||||
choice of branch name would be:
|
||||
|
||||
binutils-tgc-fm
|
||||
|
||||
A data stamp is not required as part of the name field, but some
|
||||
organizations like to have one. If you do include the date, you
|
||||
should follow these rules:
|
||||
|
||||
1. The date should be the date that the branch was created.
|
||||
|
||||
2. The date should be numerical and in the form YYYYMMDD.
|
||||
|
||||
For example:
|
||||
|
||||
binutils-tgc-fm_20050101
|
||||
|
||||
would be appropriate if the branch was created on January 1st, 2005.
|
||||
|
||||
Having selected the branch name, create the branch as follows:
|
||||
|
||||
1. Check out binutils, so that you have a CVS checkout corresponding
|
||||
to the initial state of your branch.
|
||||
|
||||
2. Create a tag:
|
||||
|
||||
cvs tag binutils-<org>-<name>-branchpoint
|
||||
|
||||
That tag will allow you, and others, to easily determine what's
|
||||
changed on the branch relative to the initial state.
|
||||
|
||||
3. Create the branch:
|
||||
|
||||
cvs rtag -b -r binutils-<org>-<name>-branchpoint \
|
||||
binutils-<org>-<name>-branch
|
||||
|
||||
4. Document the branch:
|
||||
|
||||
Add a description of the branch to binutils/BRANCHES, and check
|
||||
that file in. All branch descriptions should be added to the
|
||||
HEAD revision of the file; it doesn't help to modify
|
||||
binutils/BRANCHES on a branch!
|
||||
|
||||
Please do not commit any patches to a branch you did not create
|
||||
without the explicit permission of the person who created the branch.
|
||||
@@ -1,609 +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 = doc 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@
|
||||
NO_WERROR = @NO_WERROR@
|
||||
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)
|
||||
|
||||
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 objdump
|
||||
|
||||
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="\"$(datadir)/locale\"" \
|
||||
-Dbin_dummy_emulation=$(EMULATION_VECTOR)
|
||||
|
||||
HFILES = \
|
||||
arsup.h binemul.h bucomm.h budbg.h budemang.h \
|
||||
coffgrok.h debug.h dlltool.h nlmconv.h \
|
||||
windres.h winduni.h
|
||||
|
||||
GENERATED_HFILES = arparse.h sysroff.h sysinfo.h defparse.h rcparse.h
|
||||
|
||||
CFILES = \
|
||||
addr2line.c ar.c arsup.c binemul.c bucomm.c budemang.c \
|
||||
coffdump.c coffgrok.c cxxfilt.c \
|
||||
dwarf.c debug.c dlltool.c dllwrap.c \
|
||||
emul_aix.c emul_vanilla.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 readelf.c rename.c \
|
||||
resbin.c rescoff.c resrc.c resres.c \
|
||||
size.c srconv.c stabs.c strings.c sysdump.c version.c \
|
||||
windres.c winduni.c wrstabs.c
|
||||
|
||||
GENERATED_CFILES = \
|
||||
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 f in $(POTFILES); do echo $$f; done | LC_COLLATE= sort > tmp \
|
||||
&& mv tmp $(srcdir)/po/POTFILES.in
|
||||
|
||||
EXPECT = expect
|
||||
RUNTEST = runtest
|
||||
|
||||
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; \
|
||||
runtest=$(RUNTEST); \
|
||||
if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
|
||||
CC_FOR_TARGET="$(CC_FOR_TARGET)" CFLAGS_FOR_TARGET="$(CFLAGS)" \
|
||||
$$runtest --tool $(DEJATOOL) --srcdir $${srcdir}/testsuite \
|
||||
$(RUNTESTFLAGS); \
|
||||
else echo "WARNING: could not find \`runtest'" 1>&2; :;\
|
||||
fi
|
||||
|
||||
installcheck:
|
||||
/bin/sh $(srcdir)/sanity.sh $(bindir)
|
||||
|
||||
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 unwind-ia64.c dwarf.c
|
||||
readelf_LDADD = $(INTLLIBS) $(LIBIBERTY)
|
||||
|
||||
strip_new_SOURCES = objcopy.c is-strip.c rename.c $(WRITE_DEBUG_SRCS) $(BULIBS)
|
||||
|
||||
nm_new_SOURCES = nm.c budemang.c $(BULIBS)
|
||||
|
||||
objdump_SOURCES = objdump.c dwarf.c budemang.c prdbg.c $(DEBUG_SRCS) $(BULIBS)
|
||||
objdump_LDADD = $(OPCODES) $(BFDLIB) $(LIBIBERTY) $(INTLLIBS)
|
||||
|
||||
objdump.o:objdump.c
|
||||
$(COMPILE) -c $(OBJDUMP_DEFS) $(srcdir)/objdump.c
|
||||
|
||||
cxxfilt_SOURCES = cxxfilt.c $(BULIBS)
|
||||
|
||||
ar_SOURCES = arparse.y arlex.l ar.c not-ranlib.c arsup.c rename.c binemul.c \
|
||||
emul_$(EMULATION).c $(BULIBS)
|
||||
ar_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS)
|
||||
|
||||
ranlib_SOURCES = ar.c is-ranlib.c arparse.y arlex.l arsup.c rename.c \
|
||||
binemul.c emul_$(EMULATION).c $(BULIBS)
|
||||
ranlib_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS)
|
||||
|
||||
addr2line_SOURCES = addr2line.c budemang.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:
|
||||
if [ -r syslex.c ]; then \
|
||||
$(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS) syslex.c -Wno-error ; \
|
||||
else \
|
||||
$(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS) $(srcdir)/syslex.c -Wno-error ;\
|
||||
fi
|
||||
|
||||
sysinfo.o:
|
||||
if [ -r sysinfo.c ]; then \
|
||||
$(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS) sysinfo.c -Wno-error ; \
|
||||
else \
|
||||
$(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS) $(srcdir)/sysinfo.c -Wno-error ; \
|
||||
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
|
||||
|
||||
# Disable -Werror, if it has been enabled, since old versions of bison/
|
||||
# yacc will produce working code which contain compile time warnings.
|
||||
arparse.o:
|
||||
$(COMPILE) -c $< $(NO_WERROR)
|
||||
arlex.o:
|
||||
$(COMPILE) -c $< $(NO_WERROR)
|
||||
sysroff.o:
|
||||
$(COMPILE) -c $< $(NO_WERROR)
|
||||
defparse.o:
|
||||
$(COMPILE) -c $< $(NO_WERROR)
|
||||
deflex.o:
|
||||
$(COMPILE) -c $< $(NO_WERROR)
|
||||
nlmheader.o:
|
||||
$(COMPILE) -c $< $(NO_WERROR)
|
||||
rcparse.o:
|
||||
$(COMPILE) -c $< $(NO_WERROR)
|
||||
rclex.o:
|
||||
$(COMPILE) -c $< $(NO_WERROR)
|
||||
|
||||
srconv_SOURCES = srconv.c coffgrok.c $(BULIBS)
|
||||
|
||||
dlltool_SOURCES = dlltool.c defparse.y deflex.l $(BULIBS)
|
||||
dlltool_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS)
|
||||
|
||||
dlltool.o:
|
||||
$(COMPILE) -c $(DLLTOOL_DEFS) $(srcdir)/dlltool.c
|
||||
|
||||
rescoff.o:
|
||||
$(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 version.c
|
||||
dllwrap_LDADD = $(LIBIBERTY) $(INTLLIBS)
|
||||
|
||||
|
||||
EXTRA_DIST = 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: $(EXTRA_DIST) info
|
||||
all: info
|
||||
|
||||
DISTCLEANFILES = sysinfo sysroff.c sysroff.h \
|
||||
site.exp site.bak
|
||||
|
||||
Makefile: $(BFDDIR)/configure.in
|
||||
|
||||
# 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 > DEPA
|
||||
echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> DEPA
|
||||
if grep ' /' DEPA > /dev/null 2> /dev/null; then \
|
||||
echo 'make DEP failed!'; exit 1; \
|
||||
else \
|
||||
mv -f DEPA $@; \
|
||||
fi
|
||||
|
||||
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}!" \
|
||||
-e 's!@TOPDIR@!'`echo $(srcdir) | sed -e s,/binutils$$,,`'!'
|
||||
|
||||
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
|
||||
|
||||
###
|
||||
|
||||
MOSTLYCLEANFILES = sysinfo binutils.log binutils.sum abcdefgh*
|
||||
mostlyclean-local:
|
||||
-rm -rf tmpdir
|
||||
|
||||
CLEANFILES = dep.sed DEP DEPA 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 $(DESTDIR)$(bindir)/`echo $$p|sed -e 's/$(EXEEXT)$$//' -e 's/-new//' -e 's/cxxfilt/$(DEMANGLER_NAME)/'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
|
||||
else :; fi; \
|
||||
done
|
||||
$(mkinstalldirs) $(DESTDIR)$(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" != "$(tooldir)/bin/$$j" ]; then \
|
||||
rm -f $(DESTDIR)$(tooldir)/bin/$$j$(EXEEXT); \
|
||||
ln $(DESTDIR)$(bindir)/$$k$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$$j$(EXEEXT) >/dev/null 2>/dev/null \
|
||||
|| $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$i$(EXEEXT) $(DESTDIR)$(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 ./config.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h $(INCDIR)/getopt.h $(INCDIR)/libiberty.h \
|
||||
$(INCDIR)/ansidecl.h $(INCDIR)/demangle.h $(INCDIR)/libiberty.h \
|
||||
bucomm.h $(INCDIR)/ansidecl.h $(INCDIR)/bin-bugs.h \
|
||||
$(INCDIR)/fopen-same.h budemang.h
|
||||
ar.o: ar.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
|
||||
$(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h $(INCDIR)/progress.h \
|
||||
bucomm.h $(INCDIR)/ansidecl.h ./config.h $(INCDIR)/bin-bugs.h \
|
||||
$(INCDIR)/fopen-same.h $(INCDIR)/aout/ar.h $(BFDDIR)/libbfd.h \
|
||||
$(INCDIR)/hashtab.h arsup.h $(INCDIR)/filenames.h binemul.h
|
||||
arsup.o: arsup.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h arsup.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
|
||||
bucomm.h $(INCDIR)/ansidecl.h ./config.h $(INCDIR)/bin-bugs.h \
|
||||
$(INCDIR)/fopen-same.h $(INCDIR)/filenames.h
|
||||
binemul.o: binemul.c binemul.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ./config.h \
|
||||
$(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h
|
||||
bucomm.o: bucomm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h ../bfd/bfdver.h $(INCDIR)/libiberty.h \
|
||||
$(INCDIR)/ansidecl.h bucomm.h $(INCDIR)/ansidecl.h \
|
||||
./config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
|
||||
$(INCDIR)/filenames.h $(BFDDIR)/libbfd.h $(INCDIR)/hashtab.h
|
||||
budemang.o: budemang.c ./config.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/demangle.h $(INCDIR)/libiberty.h budemang.h
|
||||
coffdump.o: coffdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
|
||||
coffgrok.h bucomm.h $(INCDIR)/ansidecl.h ./config.h \
|
||||
$(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h
|
||||
coffgrok.o: coffgrok.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
|
||||
bucomm.h $(INCDIR)/ansidecl.h ./config.h $(INCDIR)/bin-bugs.h \
|
||||
$(INCDIR)/fopen-same.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \
|
||||
$(INCDIR)/bfdlink.h coffgrok.h
|
||||
cxxfilt.o: cxxfilt.c ./config.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h $(INCDIR)/bin-bugs.h \
|
||||
$(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/demangle.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h
|
||||
dwarf.o: dwarf.c dwarf.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h $(INCDIR)/elf/dwarf2.h bucomm.h \
|
||||
$(INCDIR)/ansidecl.h ./config.h $(INCDIR)/bin-bugs.h \
|
||||
$(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h
|
||||
debug.o: debug.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ./config.h \
|
||||
$(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
|
||||
$(INCDIR)/ansidecl.h debug.h
|
||||
dlltool.o: dlltool.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
|
||||
bucomm.h $(INCDIR)/ansidecl.h ./config.h $(INCDIR)/bin-bugs.h \
|
||||
$(INCDIR)/fopen-same.h $(INCDIR)/demangle.h $(INCDIR)/libiberty.h \
|
||||
$(INCDIR)/dyn-string.h dlltool.h $(INCDIR)/safe-ctype.h
|
||||
dllwrap.o: dllwrap.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
|
||||
bucomm.h $(INCDIR)/ansidecl.h ./config.h $(INCDIR)/bin-bugs.h \
|
||||
$(INCDIR)/fopen-same.h $(INCDIR)/dyn-string.h
|
||||
emul_aix.o: emul_aix.c binemul.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ./config.h \
|
||||
$(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \
|
||||
$(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h $(BFDDIR)/libcoff.h \
|
||||
$(INCDIR)/bfdlink.h $(BFDDIR)/libxcoff.h
|
||||
emul_vanilla.o: emul_vanilla.c binemul.h ../bfd/bfd.h \
|
||||
$(INCDIR)/ansidecl.h $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h \
|
||||
./config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h
|
||||
filemode.o: filemode.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ./config.h \
|
||||
$(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h
|
||||
ieee.o: ieee.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
|
||||
$(INCDIR)/ieee.h bucomm.h $(INCDIR)/ansidecl.h ./config.h \
|
||||
$(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
|
||||
$(INCDIR)/ansidecl.h debug.h budbg.h $(INCDIR)/filenames.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)/symcat.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
|
||||
bucomm.h $(INCDIR)/ansidecl.h ./config.h $(INCDIR)/bin-bugs.h \
|
||||
$(INCDIR)/fopen-same.h $(INCDIR)/safe-ctype.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)/symcat.h \
|
||||
$(INCDIR)/progress.h bucomm.h $(INCDIR)/ansidecl.h \
|
||||
./config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
|
||||
budemang.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
|
||||
$(INCDIR)/aout/ranlib.h $(INCDIR)/demangle.h $(INCDIR)/libiberty.h \
|
||||
$(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h $(BFDDIR)/elf-bfd.h \
|
||||
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
|
||||
$(INCDIR)/bfdlink.h $(INCDIR)/elf/common.h
|
||||
not-ranlib.o: not-ranlib.c
|
||||
not-strip.o: not-strip.c
|
||||
objcopy.o: objcopy.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h $(INCDIR)/progress.h bucomm.h $(INCDIR)/ansidecl.h \
|
||||
./config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
|
||||
$(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h budbg.h \
|
||||
$(INCDIR)/filenames.h $(INCDIR)/fnmatch.h $(BFDDIR)/elf-bfd.h \
|
||||
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
|
||||
$(INCDIR)/bfdlink.h
|
||||
objdump.o: objdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h ../bfd/bfdver.h $(INCDIR)/progress.h \
|
||||
bucomm.h $(INCDIR)/ansidecl.h ./config.h $(INCDIR)/bin-bugs.h \
|
||||
$(INCDIR)/fopen-same.h dwarf.h $(INCDIR)/elf/dwarf2.h \
|
||||
budemang.h $(INCDIR)/safe-ctype.h $(INCDIR)/dis-asm.h \
|
||||
../bfd/bfd.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/demangle.h $(INCDIR)/libiberty.h debug.h \
|
||||
budbg.h $(INCDIR)/aout/aout64.h
|
||||
prdbg.o: prdbg.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ./config.h \
|
||||
$(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
|
||||
$(INCDIR)/ansidecl.h debug.h budbg.h
|
||||
rdcoff.o: rdcoff.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h $(INCDIR)/coff/internal.h bucomm.h \
|
||||
$(INCDIR)/ansidecl.h ./config.h $(INCDIR)/bin-bugs.h \
|
||||
$(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
|
||||
debug.h budbg.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h
|
||||
rddbg.o: rddbg.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ./config.h \
|
||||
$(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
|
||||
$(INCDIR)/ansidecl.h debug.h budbg.h
|
||||
readelf.o: readelf.c dwarf.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h $(INCDIR)/elf/dwarf2.h $(INCDIR)/elf/common.h \
|
||||
$(INCDIR)/elf/external.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/alpha.h \
|
||||
$(INCDIR)/elf/reloc-macros.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/arm.h \
|
||||
$(INCDIR)/elf/avr.h $(INCDIR)/elf/bfin.h $(INCDIR)/elf/cris.h \
|
||||
$(INCDIR)/elf/d10v.h $(INCDIR)/elf/d30v.h $(INCDIR)/elf/dlx.h \
|
||||
$(INCDIR)/elf/fr30.h $(INCDIR)/elf/frv.h $(INCDIR)/elf/h8.h \
|
||||
$(INCDIR)/elf/hppa.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/i370.h \
|
||||
$(INCDIR)/elf/i860.h $(INCDIR)/elf/i960.h $(INCDIR)/elf/ia64.h \
|
||||
$(INCDIR)/elf/ip2k.h $(INCDIR)/elf/m32c.h $(INCDIR)/elf/m32r.h \
|
||||
$(INCDIR)/elf/m68k.h $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/mcore.h \
|
||||
$(INCDIR)/elf/mips.h $(INCDIR)/elf/mmix.h $(INCDIR)/elf/mn10200.h \
|
||||
$(INCDIR)/elf/mn10300.h $(INCDIR)/elf/ms1.h $(INCDIR)/elf/msp430.h \
|
||||
$(INCDIR)/elf/or32.h $(INCDIR)/elf/pj.h $(INCDIR)/elf/ppc.h \
|
||||
$(INCDIR)/elf/ppc64.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/sh.h \
|
||||
$(INCDIR)/elf/sparc.h $(INCDIR)/elf/v850.h $(INCDIR)/elf/vax.h \
|
||||
$(INCDIR)/elf/x86-64.h $(INCDIR)/elf/xstormy16.h $(INCDIR)/elf/crx.h \
|
||||
$(INCDIR)/elf/iq2000.h $(INCDIR)/elf/xtensa.h $(INCDIR)/aout/ar.h \
|
||||
bucomm.h $(INCDIR)/ansidecl.h ./config.h $(INCDIR)/bin-bugs.h \
|
||||
$(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
|
||||
unwind-ia64.h
|
||||
rename.o: rename.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ./config.h \
|
||||
$(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h
|
||||
resbin.o: resbin.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ./config.h \
|
||||
$(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
|
||||
$(INCDIR)/ansidecl.h windres.h winduni.h
|
||||
rescoff.o: rescoff.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ./config.h \
|
||||
$(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
|
||||
$(INCDIR)/ansidecl.h windres.h winduni.h $(INCDIR)/coff/internal.h \
|
||||
$(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h
|
||||
resrc.o: resrc.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ./config.h \
|
||||
$(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
|
||||
$(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h windres.h \
|
||||
winduni.h
|
||||
resres.o: resres.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ./config.h \
|
||||
$(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
|
||||
$(INCDIR)/ansidecl.h windres.h winduni.h
|
||||
size.o: size.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
|
||||
bucomm.h $(INCDIR)/ansidecl.h ./config.h $(INCDIR)/bin-bugs.h \
|
||||
$(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h
|
||||
srconv.o: srconv.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ./config.h \
|
||||
$(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h ./sysroff.h \
|
||||
coffgrok.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
|
||||
./sysroff.c
|
||||
stabs.o: stabs.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ./config.h \
|
||||
$(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
|
||||
$(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h $(INCDIR)/demangle.h \
|
||||
$(INCDIR)/libiberty.h debug.h budbg.h $(INCDIR)/filenames.h \
|
||||
$(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def
|
||||
strings.o: strings.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h $(INCDIR)/getopt.h bucomm.h $(INCDIR)/ansidecl.h \
|
||||
./config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
|
||||
$(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h
|
||||
sysdump.o: sysdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ./config.h \
|
||||
$(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/safe-ctype.h \
|
||||
$(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h ./sysroff.h \
|
||||
./sysroff.c $(INCDIR)/ansidecl.h
|
||||
version.o: version.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h ../bfd/bfdver.h bucomm.h $(INCDIR)/ansidecl.h \
|
||||
./config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h
|
||||
windres.o: windres.c ./config.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h $(INCDIR)/bin-bugs.h \
|
||||
$(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h windres.h \
|
||||
winduni.h
|
||||
winduni.o: winduni.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ./config.h \
|
||||
$(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h winduni.h \
|
||||
$(INCDIR)/safe-ctype.h
|
||||
wrstabs.o: wrstabs.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ./config.h \
|
||||
$(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
|
||||
$(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h debug.h \
|
||||
budbg.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
|
||||
$(INCDIR)/aout/stab.def
|
||||
arparse.o: arparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ./config.h \
|
||||
$(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h arsup.h
|
||||
arlex.o: arlex.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
|
||||
$(INCDIR)/ansidecl.h arparse.h
|
||||
sysroff.o: sysroff.c
|
||||
sysinfo.o: sysinfo.c
|
||||
syslex.o: syslex.c config.h sysinfo.h
|
||||
defparse.o: defparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.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 $(INCDIR)/ansidecl.h
|
||||
nlmheader.o: nlmheader.c $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h \
|
||||
../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
|
||||
bucomm.h $(INCDIR)/ansidecl.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 \
|
||||
$(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ./config.h \
|
||||
$(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
|
||||
$(INCDIR)/ansidecl.h windres.h winduni.h $(INCDIR)/safe-ctype.h
|
||||
rclex.o: rclex.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ./config.h \
|
||||
$(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
|
||||
$(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h windres.h \
|
||||
winduni.h rcparse.h
|
||||
# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
|
||||
1355
binutils/Makefile.in
1355
binutils/Makefile.in
File diff suppressed because it is too large
Load Diff
332
binutils/NEWS
332
binutils/NEWS
@@ -1,332 +0,0 @@
|
||||
-*- text -*-
|
||||
|
||||
* Add -i and -t switches to cxxfilt. -i disables the display of implementation
|
||||
specific extra demangling information (if any) and -t disables the demangling
|
||||
of types.
|
||||
|
||||
* Add support for the "@<file>" syntax to the command lines of all tools, so
|
||||
that extra switches can be read from <file>.
|
||||
|
||||
* Add "-W/--dwarf" to objdump to display the contents of the DWARF
|
||||
debug sections.
|
||||
|
||||
* Add "-t/--section-details" to readelf to display section details.
|
||||
"-N/--full-section-name" is deprecated.
|
||||
|
||||
* powerpc-linux ld now supports a variant form of PLT and GOT for the security
|
||||
conscious. This form will automatically be chosen when ld detects that all
|
||||
code in regular object files was generated by gcc -msecure-plt. The old PLT
|
||||
and GOT may be forced by a new ld option, --bss-plt.
|
||||
|
||||
* Add "-i/--inlines" to addr2line to print enclosing scope information
|
||||
for inlined function chains, back to first non-inlined function.
|
||||
|
||||
* Add "-N/--full-section-name" to readelf to display full section name.
|
||||
|
||||
* Add "-M entry:<addr>" switch to objdump to specify a function entry address
|
||||
when disassembling VAX binaries.
|
||||
|
||||
* Add "--globalize-symbol <name>" and "--globalize-symbols <filename>" switches
|
||||
to objcopy to convert local symbols into global symbols.
|
||||
|
||||
Changes in 2.16:
|
||||
|
||||
* Add "-g/--section-groups" to readelf to display section groups.
|
||||
|
||||
* objcopy recognizes two new options --strip-unneeded-symbol and
|
||||
--strip-unneeded-symbols, namely for use together with the wildcard
|
||||
matching the original --strip-symbol/--strip-symbols provided, but
|
||||
retaining any symbols matching but needed by relocations.
|
||||
|
||||
* readelf can now display address ranges from .debug_range sections. This
|
||||
happens automatically when a DW_AT_range attribute is encountered. The
|
||||
command line switch --debug-dump=Ranges (or -wR) can also be used to display
|
||||
the contents of the .debug_range section.
|
||||
|
||||
* nm and objdump now have a switch "--special-syms" to enable the displaying of
|
||||
symbols which the target considers to be special. By default these symbols
|
||||
are no longer displayed. Currently the only special symbols are the Mapping
|
||||
symbols used by the ARM port to mark transitions between text and data and
|
||||
between ARM and THUMB code.
|
||||
|
||||
* dlltool has a switch "--ext-prefix-alias <prefix>" to generate additional
|
||||
import and export symbols with <preifx> prepended to them.
|
||||
|
||||
Changes in 2.15:
|
||||
|
||||
* objcopy for MIPS targets now accepts "-M no-aliases" as an option to the
|
||||
disassembler to print the "raw" mips instruction mnemonic instead of some
|
||||
pseudo instruction name. I.E. print "daddu" or "or" instead of "move",
|
||||
"sll" instead of "nop", etc.
|
||||
|
||||
* objcopy and strip can now take wildcard patterns in symbol names specified on
|
||||
the command line provided that the --wildcard switch is used to enable them.
|
||||
|
||||
* readelf can now parse archives.
|
||||
|
||||
* objdump now accepts --debugging-tags to print the debug information in a
|
||||
format compatible with ctags tool.
|
||||
|
||||
* objcopy and strip now accept --only-keep-debug to create a file containing
|
||||
those sections that would be stripped out by --strip-debug. The idea is that
|
||||
this can be used in conjunction with the --add-gnu-debuglink switch to create
|
||||
a two part program distribution - one a stripped executable and the other the
|
||||
debugging info.
|
||||
|
||||
* objcopy now accepts --add-gnu-debuglink=<file> to insert a .gnu_debuglink
|
||||
section into a (presumably stripped) executable. This allows the debug
|
||||
information for the file to be held in a separate file.
|
||||
|
||||
* BFD marks the sections .comment and .note as 'n' in the BSD/POSIX
|
||||
single-character representation. This can be checked by running nm
|
||||
with the -a switch.
|
||||
|
||||
Changes in 2.14:
|
||||
|
||||
* Added --info switch to objcopy and strip.
|
||||
|
||||
* Support for Vitesse IQ2000 added by Red Hat.
|
||||
|
||||
* Added 'S' encoding to strings to allow the display of 8-bit characters.
|
||||
|
||||
* Added --prefix-symbols=<text>, --prefix-sections=<text> and
|
||||
--prefix-alloc-sections=<text> to objcopy.
|
||||
|
||||
* readelf can handle the extensions to the DWARF2 spec used by the Unified
|
||||
Parallel C compiler.
|
||||
|
||||
* BFD no longer declares a "boolean" type, to avoid clashes with other
|
||||
headers that declare the same. Users of BFD should replace boolean,
|
||||
false and true, with int, 0 and 1, or define their own boolean type.
|
||||
|
||||
* Support for IP2K added by Denis Chertykov.
|
||||
|
||||
Changes in 2.13:
|
||||
|
||||
* Support for the Fujitsu FRV architecture added by Red Hat. Models for FR400
|
||||
and FR500 included.
|
||||
|
||||
Changes in version 2.12:
|
||||
|
||||
* Support for Don Knuth's MMIX, by Hans-Peter Nilsson.
|
||||
|
||||
* size: Add --totals to display summary of sizes (Berkeley format only).
|
||||
|
||||
* readelf: Add --wide option to not break section header or segment listing
|
||||
lines to fit into 80 columns.
|
||||
|
||||
* strings: Add --encoding to display wide character strings. By Markus Kuhn.
|
||||
|
||||
* objcopy: Add --rename-section to change section names.
|
||||
|
||||
* readelf: Support added for DWARF 2.1 extensions. Support added for
|
||||
displaying the contents of .debug.macinfo sections.
|
||||
|
||||
* New command line switches added to objcopy to allow symbols to be kept as
|
||||
global symbols, and also to specify files containing lists of such symbols.
|
||||
by Honda Hiroki.
|
||||
|
||||
* Support for OpenRISC by Johan Rydberg.
|
||||
|
||||
* New command line switch to objcopy --alt-machine-code which creates a binary
|
||||
with an alternate machine code if one is defined in the architecture
|
||||
description. Only supported for ELF targets. By Alexandre Oliva.
|
||||
|
||||
* New command line switch to objcopy -B (or --binary-architecture) which sets
|
||||
the architecture of the output file to the given argument. This option only
|
||||
makes sense, if the input target is binary. Otherwise it is ignored.
|
||||
By Stefan Geuken.
|
||||
|
||||
* Support for PDP-11 by Lars Brinkhoff.
|
||||
|
||||
Changes in binutils 2.11:
|
||||
|
||||
* Add support for ARM v5t and v5te architectures and Intel's XScale ARM
|
||||
extenstions.
|
||||
|
||||
* Add --srec-len and --srec-forceS3 command line switch to objcopy.
|
||||
By Luciano Gemme.
|
||||
|
||||
* Support for the MIPS32, by Anders Norlander.
|
||||
|
||||
* Support for the i860, by Jason Eckhardt.
|
||||
|
||||
* Support for CRIS (Axis Communications ETRAX series).
|
||||
|
||||
Changes in binutils 2.10:
|
||||
|
||||
* Support for 64-bit ELF on HPPA.
|
||||
|
||||
* 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 relocatable 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:
|
||||
273
binutils/README
273
binutils/README
@@ -1,273 +0,0 @@
|
||||
README for BINUTILS
|
||||
|
||||
These are the GNU binutils. These are utilities of use when dealing
|
||||
with binary files, either object files or executables. These tools
|
||||
consist of the linker (ld), the assembler (gas), and the profiler
|
||||
(gprof) each of which have their own sub-directory named after them.
|
||||
There is also a collection of other binary tools, including the
|
||||
disassembler (objdump) in this directory. These tools make use of a
|
||||
pair of libraries (bfd and opcodes) and a common set of header files
|
||||
(include).
|
||||
|
||||
There are README and NEWS files in most of the program sub-directories
|
||||
which give more information about those specific programs.
|
||||
|
||||
|
||||
Unpacking and Installation -- quick overview
|
||||
============================================
|
||||
|
||||
When you unpack the binutils archive file, you will get a directory
|
||||
called something like `binutils-XXX', where XXX is the number of the
|
||||
release. (Probably 2.13 or higher). This directory contains
|
||||
various files and sub-directories. Most of the files in the top
|
||||
directory are for information and for configuration. The actual
|
||||
source code is in sub-directories.
|
||||
|
||||
To build binutils, you can just do:
|
||||
|
||||
cd binutils-XXX
|
||||
./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-XXX/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, eg:
|
||||
|
||||
./configure --target=foo-elf
|
||||
|
||||
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:
|
||||
|
||||
./configure --enable-targets=all
|
||||
|
||||
On 32-bit hosts though, this support will be restricted to 32-bit
|
||||
target unless the --enable-64-bit-bfd option is also used:
|
||||
|
||||
./configure --enable-64-bit-bfd --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 run-time 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.
|
||||
|
||||
|
||||
Native Language Support
|
||||
=======================
|
||||
|
||||
By default Native Language Support will be enabled for binutils. On
|
||||
some systems however this support is not present and can lead to error
|
||||
messages such as "undefined reference to `libintl_gettext'" when
|
||||
building there tools. If that happens the NLS support can be disabled
|
||||
by adding the --disable-nls switch to the configure line like this:
|
||||
|
||||
../binutils-XXX/configure --disable-nls
|
||||
|
||||
|
||||
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 ../libiberty/*.o `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.13 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-5.x) may also be of help.
|
||||
|
||||
Reporting bugs
|
||||
==============
|
||||
|
||||
Send bug reports and patches to:
|
||||
|
||||
bug-binutils@gnu.org.
|
||||
|
||||
Please include the following in bug reports:
|
||||
|
||||
- A description of exactly what went wrong, and exactly what should have
|
||||
happened instead.
|
||||
|
||||
- The configuration name(s) given to the "configure" script. The
|
||||
"config.status" file should have this information. This is assuming
|
||||
you built binutils yourself. If you didn't build binutils youself,
|
||||
then we need information regarding your machine and operating system,
|
||||
and it may be more appropriate to report bugs to wherever you obtained
|
||||
binutils.
|
||||
|
||||
- The options given to the tool (gas, objcopy, ld etc.) at run time.
|
||||
|
||||
- The actual input file that caused the problem.
|
||||
|
||||
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, particularly so
|
||||
when the bug report is against an old version. If you are able, please
|
||||
consider building the latest tools from CVS to check that your bug has
|
||||
not already been fixed.
|
||||
|
||||
When reporting problems about gas and ld, it's useful to provide a
|
||||
testcase that triggers the problem. In the case of a gas problem, we
|
||||
want input files to gas and command line switches used. The inputs to
|
||||
gas are _NOT_ .c or .i files, but rather .s files. If your original
|
||||
source was a C program, you can generate the .s file and see the command
|
||||
line options by passing -v -save-temps to gcc in addition to all the
|
||||
usual options you use. The reason we don't want C files is that we
|
||||
might not have a C compiler around for the target you use. While it
|
||||
might be possible to build a compiler, that takes considerable time and
|
||||
disk space, and we might not end up with exactly the same compiler you
|
||||
use.
|
||||
|
||||
In the case of a ld problem, the input files are .o, .a and .so files,
|
||||
and possibly a linker script specified with -T. Again, when using gcc
|
||||
to link, you can see these files by adding options to the gcc command
|
||||
line. Use -v -save-temps -Wl,-t, except that on targets that use gcc's
|
||||
collect2, you would add -v -save-temps -Wl,-t,-debug. The -t option
|
||||
tells ld to print all files and libraries used, so that, for example,
|
||||
you can associate -lc on the ld command line with the actual libc used.
|
||||
Note that your simple two line C program to trigger a problem typically
|
||||
expands into several megabytes of objects by the time you include
|
||||
libraries.
|
||||
|
||||
It is antisocial to post megabyte sized attachments to mailing lists, so
|
||||
please put large testcases somewhere on an ftp or web site so that only
|
||||
interested developers need to download them, or offer to email them on
|
||||
request. Better still, try to reduce the testcase, for example, try to
|
||||
develop a ld testcase that doesn't use system libraries. However,
|
||||
please be sure it is a complete testcase and that it really does
|
||||
demonstrate the problem. Also, don't bother paring it down if that will
|
||||
cause large delays in filing the bug report.
|
||||
|
||||
If you expect to be contributing a large number of test cases, it would
|
||||
be helpful if you would look at the test suite included in the release
|
||||
(based on the Deja Gnu testing framework, available from the usual ftp
|
||||
sites) and write test cases to fit into that framework. This is
|
||||
certainly not required.
|
||||
|
||||
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 device 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 satisfied 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)
|
||||
913
binutils/aclocal.m4
vendored
913
binutils/aclocal.m4
vendored
@@ -1,913 +0,0 @@
|
||||
# generated automatically by aclocal 1.9.5 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
# 2005 Free Software Foundation, Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_AUTOMAKE_VERSION(VERSION)
|
||||
# ----------------------------
|
||||
# Automake X.Y traces this macro to ensure aclocal.m4 has been
|
||||
# generated from the m4 files accompanying Automake X.Y.
|
||||
AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
|
||||
|
||||
# AM_SET_CURRENT_AUTOMAKE_VERSION
|
||||
# -------------------------------
|
||||
# Call AM_AUTOMAKE_VERSION so it can be traced.
|
||||
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
|
||||
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
|
||||
[AM_AUTOMAKE_VERSION([1.9.5])])
|
||||
|
||||
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
|
||||
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
|
||||
# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
|
||||
#
|
||||
# Of course, Automake must honor this variable whenever it calls a
|
||||
# tool from the auxiliary directory. The problem is that $srcdir (and
|
||||
# therefore $ac_aux_dir as well) can be either absolute or relative,
|
||||
# depending on how configure is run. This is pretty annoying, since
|
||||
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
|
||||
# source directory, any form will work fine, but in subdirectories a
|
||||
# relative path needs to be adjusted first.
|
||||
#
|
||||
# $ac_aux_dir/missing
|
||||
# fails when called from a subdirectory if $ac_aux_dir is relative
|
||||
# $top_srcdir/$ac_aux_dir/missing
|
||||
# fails if $ac_aux_dir is absolute,
|
||||
# fails when called from a subdirectory in a VPATH build with
|
||||
# a relative $ac_aux_dir
|
||||
#
|
||||
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
|
||||
# are both prefixed by $srcdir. In an in-source build this is usually
|
||||
# harmless because $srcdir is `.', but things will broke when you
|
||||
# start a VPATH build or use an absolute $srcdir.
|
||||
#
|
||||
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
|
||||
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
|
||||
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
|
||||
# and then we would define $MISSING as
|
||||
# MISSING="\${SHELL} $am_aux_dir/missing"
|
||||
# This will work as long as MISSING is not called from configure, because
|
||||
# unfortunately $(top_srcdir) has no meaning in configure.
|
||||
# However there are other variables, like CC, which are often used in
|
||||
# configure, and could therefore not use this "fixed" $ac_aux_dir.
|
||||
#
|
||||
# Another solution, used here, is to always expand $ac_aux_dir to an
|
||||
# absolute PATH. The drawback is that using absolute paths prevent a
|
||||
# configured tree to be moved without reconfiguration.
|
||||
|
||||
AC_DEFUN([AM_AUX_DIR_EXPAND],
|
||||
[dnl Rely on autoconf to set up CDPATH properly.
|
||||
AC_PREREQ([2.50])dnl
|
||||
# expand $ac_aux_dir to an absolute path
|
||||
am_aux_dir=`cd $ac_aux_dir && pwd`
|
||||
])
|
||||
|
||||
# AM_CONDITIONAL -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 7
|
||||
|
||||
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
|
||||
# -------------------------------------
|
||||
# Define a conditional.
|
||||
AC_DEFUN([AM_CONDITIONAL],
|
||||
[AC_PREREQ(2.52)dnl
|
||||
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
|
||||
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
|
||||
AC_SUBST([$1_TRUE])
|
||||
AC_SUBST([$1_FALSE])
|
||||
if $2; then
|
||||
$1_TRUE=
|
||||
$1_FALSE='#'
|
||||
else
|
||||
$1_TRUE='#'
|
||||
$1_FALSE=
|
||||
fi
|
||||
AC_CONFIG_COMMANDS_PRE(
|
||||
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
|
||||
AC_MSG_ERROR([[conditional "$1" was never defined.
|
||||
Usually this means the macro was only invoked conditionally.]])
|
||||
fi])])
|
||||
|
||||
|
||||
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 8
|
||||
|
||||
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
|
||||
# written in clear, in which case automake, when reading aclocal.m4,
|
||||
# will think it sees a *use*, and therefore will trigger all it's
|
||||
# C support machinery. Also note that it means that autoscan, seeing
|
||||
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
|
||||
|
||||
|
||||
# _AM_DEPENDENCIES(NAME)
|
||||
# ----------------------
|
||||
# See how the compiler implements dependency checking.
|
||||
# NAME is "CC", "CXX", "GCJ", or "OBJC".
|
||||
# We try a few techniques and use that to set a single cache variable.
|
||||
#
|
||||
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
|
||||
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
|
||||
# dependency, and given that the user is not expected to run this macro,
|
||||
# just rely on AC_PROG_CC.
|
||||
AC_DEFUN([_AM_DEPENDENCIES],
|
||||
[AC_REQUIRE([AM_SET_DEPDIR])dnl
|
||||
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
|
||||
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
|
||||
AC_REQUIRE([AM_DEP_TRACK])dnl
|
||||
|
||||
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
|
||||
[$1], CXX, [depcc="$CXX" am_compiler_list=],
|
||||
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
|
||||
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
|
||||
[depcc="$$1" am_compiler_list=])
|
||||
|
||||
AC_CACHE_CHECK([dependency style of $depcc],
|
||||
[am_cv_$1_dependencies_compiler_type],
|
||||
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
|
||||
# We make a subdir and do the tests there. Otherwise we can end up
|
||||
# making bogus files that we don't know about and never remove. For
|
||||
# instance it was reported that on HP-UX the gcc test will end up
|
||||
# making a dummy file named `D' -- because `-MD' means `put the output
|
||||
# in D'.
|
||||
mkdir conftest.dir
|
||||
# Copy depcomp to subdir because otherwise we won't find it if we're
|
||||
# using a relative directory.
|
||||
cp "$am_depcomp" conftest.dir
|
||||
cd conftest.dir
|
||||
# We will build objects and dependencies in a subdirectory because
|
||||
# it helps to detect inapplicable dependency modes. For instance
|
||||
# both Tru64's cc and ICC support -MD to output dependencies as a
|
||||
# side effect of compilation, but ICC will put the dependencies in
|
||||
# the current directory while Tru64 will put them in the object
|
||||
# directory.
|
||||
mkdir sub
|
||||
|
||||
am_cv_$1_dependencies_compiler_type=none
|
||||
if test "$am_compiler_list" = ""; then
|
||||
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
|
||||
fi
|
||||
for depmode in $am_compiler_list; do
|
||||
# Setup a source with many dependencies, because some compilers
|
||||
# like to wrap large dependency lists on column 80 (with \), and
|
||||
# we should not choose a depcomp mode which is confused by this.
|
||||
#
|
||||
# We need to recreate these files for each test, as the compiler may
|
||||
# overwrite some of them when testing with obscure command lines.
|
||||
# This happens at least with the AIX C compiler.
|
||||
: > sub/conftest.c
|
||||
for i in 1 2 3 4 5 6; do
|
||||
echo '#include "conftst'$i'.h"' >> sub/conftest.c
|
||||
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
|
||||
# Solaris 8's {/usr,}/bin/sh.
|
||||
touch sub/conftst$i.h
|
||||
done
|
||||
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
|
||||
|
||||
case $depmode in
|
||||
nosideeffect)
|
||||
# after this tag, mechanisms are not by side-effect, so they'll
|
||||
# only be used when explicitly requested
|
||||
if test "x$enable_dependency_tracking" = xyes; then
|
||||
continue
|
||||
else
|
||||
break
|
||||
fi
|
||||
;;
|
||||
none) break ;;
|
||||
esac
|
||||
# We check with `-c' and `-o' for the sake of the "dashmstdout"
|
||||
# mode. It turns out that the SunPro C++ compiler does not properly
|
||||
# handle `-M -o', and we need to detect this.
|
||||
if depmode=$depmode \
|
||||
source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
|
||||
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
|
||||
$SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
|
||||
>/dev/null 2>conftest.err &&
|
||||
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
|
||||
grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
|
||||
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
|
||||
# icc doesn't choke on unknown options, it will just issue warnings
|
||||
# or remarks (even with -Werror). So we grep stderr for any message
|
||||
# that says an option was ignored or not supported.
|
||||
# When given -MP, icc 7.0 and 7.1 complain thusly:
|
||||
# icc: Command line warning: ignoring option '-M'; no argument required
|
||||
# The diagnosis changed in icc 8.0:
|
||||
# icc: Command line remark: option '-MP' not supported
|
||||
if (grep 'ignoring option' conftest.err ||
|
||||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
|
||||
am_cv_$1_dependencies_compiler_type=$depmode
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
cd ..
|
||||
rm -rf conftest.dir
|
||||
else
|
||||
am_cv_$1_dependencies_compiler_type=none
|
||||
fi
|
||||
])
|
||||
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
|
||||
AM_CONDITIONAL([am__fastdep$1], [
|
||||
test "x$enable_dependency_tracking" != xno \
|
||||
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
|
||||
])
|
||||
|
||||
|
||||
# AM_SET_DEPDIR
|
||||
# -------------
|
||||
# Choose a directory name for dependency files.
|
||||
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
|
||||
AC_DEFUN([AM_SET_DEPDIR],
|
||||
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
|
||||
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
|
||||
])
|
||||
|
||||
|
||||
# AM_DEP_TRACK
|
||||
# ------------
|
||||
AC_DEFUN([AM_DEP_TRACK],
|
||||
[AC_ARG_ENABLE(dependency-tracking,
|
||||
[ --disable-dependency-tracking speeds up one-time build
|
||||
--enable-dependency-tracking do not reject slow dependency extractors])
|
||||
if test "x$enable_dependency_tracking" != xno; then
|
||||
am_depcomp="$ac_aux_dir/depcomp"
|
||||
AMDEPBACKSLASH='\'
|
||||
fi
|
||||
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
|
||||
AC_SUBST([AMDEPBACKSLASH])
|
||||
])
|
||||
|
||||
# Generate code to set up dependency tracking. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
#serial 3
|
||||
|
||||
# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
# ------------------------------
|
||||
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[for mf in $CONFIG_FILES; do
|
||||
# Strip MF so we end up with the name of the file.
|
||||
mf=`echo "$mf" | sed -e 's/:.*$//'`
|
||||
# Check whether this is an Automake generated Makefile or not.
|
||||
# We used to match only the files named `Makefile.in', but
|
||||
# some people rename them; so instead we look at the file content.
|
||||
# Grep'ing the first line is not enough: some people post-process
|
||||
# each Makefile.in and add a new line on top of each file to say so.
|
||||
# So let's grep whole file.
|
||||
if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
|
||||
dirpart=`AS_DIRNAME("$mf")`
|
||||
else
|
||||
continue
|
||||
fi
|
||||
# Extract the definition of DEPDIR, am__include, and am__quote
|
||||
# from the Makefile without running `make'.
|
||||
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
|
||||
test -z "$DEPDIR" && continue
|
||||
am__include=`sed -n 's/^am__include = //p' < "$mf"`
|
||||
test -z "am__include" && continue
|
||||
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
|
||||
# When using ansi2knr, U may be empty or an underscore; expand it
|
||||
U=`sed -n 's/^U = //p' < "$mf"`
|
||||
# Find all dependency output files, they are included files with
|
||||
# $(DEPDIR) in their names. We invoke sed twice because it is the
|
||||
# simplest approach to changing $(DEPDIR) to its actual value in the
|
||||
# expansion.
|
||||
for file in `sed -n "
|
||||
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
|
||||
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
|
||||
# Make sure the directory exists.
|
||||
test -f "$dirpart/$file" && continue
|
||||
fdir=`AS_DIRNAME(["$file"])`
|
||||
AS_MKDIR_P([$dirpart/$fdir])
|
||||
# echo "creating $dirpart/$file"
|
||||
echo '# dummy' > "$dirpart/$file"
|
||||
done
|
||||
done
|
||||
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
|
||||
|
||||
# AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
# -----------------------------
|
||||
# This macro should only be invoked once -- use via AC_REQUIRE.
|
||||
#
|
||||
# This code is only required when automatic dependency tracking
|
||||
# is enabled. FIXME. This creates each `.P' file that we will
|
||||
# need in order to bootstrap the dependency handling code.
|
||||
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[AC_CONFIG_COMMANDS([depfiles],
|
||||
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
|
||||
])
|
||||
|
||||
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 8
|
||||
|
||||
# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS.
|
||||
AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
|
||||
|
||||
# Do all the work for Automake. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 12
|
||||
|
||||
# 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.
|
||||
|
||||
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
|
||||
# AM_INIT_AUTOMAKE([OPTIONS])
|
||||
# -----------------------------------------------
|
||||
# The call with PACKAGE and VERSION arguments is the old style
|
||||
# call (pre autoconf-2.50), which is being phased out. PACKAGE
|
||||
# and VERSION should now be passed to AC_INIT and removed from
|
||||
# the call to AM_INIT_AUTOMAKE.
|
||||
# We support both call styles for the transition. After
|
||||
# the next Automake release, Autoconf can make the AC_INIT
|
||||
# arguments mandatory, and then we can depend on a new Autoconf
|
||||
# release and drop the old call support.
|
||||
AC_DEFUN([AM_INIT_AUTOMAKE],
|
||||
[AC_PREREQ([2.58])dnl
|
||||
dnl Autoconf wants to disallow AM_ names. We explicitly allow
|
||||
dnl the ones we care about.
|
||||
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
|
||||
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
|
||||
AC_REQUIRE([AC_PROG_INSTALL])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
|
||||
|
||||
# test whether we have cygpath
|
||||
if test -z "$CYGPATH_W"; then
|
||||
if (cygpath --version) >/dev/null 2>/dev/null; then
|
||||
CYGPATH_W='cygpath -w'
|
||||
else
|
||||
CYGPATH_W=echo
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([CYGPATH_W])
|
||||
|
||||
# Define the identity of the package.
|
||||
dnl Distinguish between old-style and new-style calls.
|
||||
m4_ifval([$2],
|
||||
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
|
||||
AC_SUBST([PACKAGE], [$1])dnl
|
||||
AC_SUBST([VERSION], [$2])],
|
||||
[_AM_SET_OPTIONS([$1])dnl
|
||||
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
|
||||
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
|
||||
|
||||
_AM_IF_OPTION([no-define],,
|
||||
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
|
||||
|
||||
# Some tools Automake needs.
|
||||
AC_REQUIRE([AM_SANITY_CHECK])dnl
|
||||
AC_REQUIRE([AC_ARG_PROGRAM])dnl
|
||||
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
|
||||
AM_MISSING_PROG(AUTOCONF, autoconf)
|
||||
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
|
||||
AM_MISSING_PROG(AUTOHEADER, autoheader)
|
||||
AM_MISSING_PROG(MAKEINFO, makeinfo)
|
||||
AM_PROG_INSTALL_SH
|
||||
AM_PROG_INSTALL_STRIP
|
||||
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
|
||||
# We need awk for the "check" target. The system "awk" is bad on
|
||||
# some platforms.
|
||||
AC_REQUIRE([AC_PROG_AWK])dnl
|
||||
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
|
||||
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
|
||||
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
|
||||
[_AM_PROG_TAR([v7])])])
|
||||
_AM_IF_OPTION([no-dependencies],,
|
||||
[AC_PROVIDE_IFELSE([AC_PROG_CC],
|
||||
[_AM_DEPENDENCIES(CC)],
|
||||
[define([AC_PROG_CC],
|
||||
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
|
||||
AC_PROVIDE_IFELSE([AC_PROG_CXX],
|
||||
[_AM_DEPENDENCIES(CXX)],
|
||||
[define([AC_PROG_CXX],
|
||||
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
|
||||
])
|
||||
])
|
||||
|
||||
|
||||
# When config.status generates a header, we must update the stamp-h file.
|
||||
# This file resides in the same directory as the config header
|
||||
# that is generated. The stamp files are numbered to have different names.
|
||||
|
||||
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
|
||||
# loop where config.status creates the headers, so we can generate
|
||||
# our stamp files there.
|
||||
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
|
||||
[# Compute $1's index in $config_headers.
|
||||
_am_stamp_count=1
|
||||
for _am_header in $config_headers :; do
|
||||
case $_am_header in
|
||||
$1 | $1:* )
|
||||
break ;;
|
||||
* )
|
||||
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
|
||||
esac
|
||||
done
|
||||
echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_PROG_INSTALL_SH
|
||||
# ------------------
|
||||
# Define $install_sh.
|
||||
AC_DEFUN([AM_PROG_INSTALL_SH],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
install_sh=${install_sh-"$am_aux_dir/install-sh"}
|
||||
AC_SUBST(install_sh)])
|
||||
|
||||
# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 2
|
||||
|
||||
# Check whether the underlying file-system supports filenames
|
||||
# with a leading dot. For instance MS-DOS doesn't.
|
||||
AC_DEFUN([AM_SET_LEADING_DOT],
|
||||
[rm -rf .tst 2>/dev/null
|
||||
mkdir .tst 2>/dev/null
|
||||
if test -d .tst; then
|
||||
am__leading_dot=.
|
||||
else
|
||||
am__leading_dot=_
|
||||
fi
|
||||
rmdir .tst 2>/dev/null
|
||||
AC_SUBST([am__leading_dot])])
|
||||
|
||||
# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 5
|
||||
|
||||
# AM_PROG_LEX
|
||||
# -----------
|
||||
# Autoconf leaves LEX=: if lex or flex can't be found. Change that to a
|
||||
# "missing" invocation, for better error output.
|
||||
AC_DEFUN([AM_PROG_LEX],
|
||||
[AC_PREREQ(2.50)dnl
|
||||
AC_REQUIRE([AM_MISSING_HAS_RUN])dnl
|
||||
AC_REQUIRE([AC_PROG_LEX])dnl
|
||||
if test "$LEX" = :; then
|
||||
LEX=${am_missing_run}flex
|
||||
fi])
|
||||
|
||||
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
|
||||
# From Jim Meyering
|
||||
|
||||
# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 4
|
||||
|
||||
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
|
||||
]
|
||||
)
|
||||
|
||||
AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
|
||||
|
||||
# Check to see how 'make' treats includes. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 3
|
||||
|
||||
# AM_MAKE_INCLUDE()
|
||||
# -----------------
|
||||
# Check to see how make treats includes.
|
||||
AC_DEFUN([AM_MAKE_INCLUDE],
|
||||
[am_make=${MAKE-make}
|
||||
cat > confinc << 'END'
|
||||
am__doit:
|
||||
@echo done
|
||||
.PHONY: am__doit
|
||||
END
|
||||
# If we don't find an include directive, just comment out the code.
|
||||
AC_MSG_CHECKING([for style of include used by $am_make])
|
||||
am__include="#"
|
||||
am__quote=
|
||||
_am_result=none
|
||||
# First try GNU make style include.
|
||||
echo "include confinc" > confmf
|
||||
# We grep out `Entering directory' and `Leaving directory'
|
||||
# messages which can occur if `w' ends up in MAKEFLAGS.
|
||||
# In particular we don't look at `^make:' because GNU make might
|
||||
# be invoked under some other name (usually "gmake"), in which
|
||||
# case it prints its new name instead of `make'.
|
||||
if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
|
||||
am__include=include
|
||||
am__quote=
|
||||
_am_result=GNU
|
||||
fi
|
||||
# Now try BSD make style include.
|
||||
if test "$am__include" = "#"; then
|
||||
echo '.include "confinc"' > confmf
|
||||
if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
|
||||
am__include=.include
|
||||
am__quote="\""
|
||||
_am_result=BSD
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([am__include])
|
||||
AC_SUBST([am__quote])
|
||||
AC_MSG_RESULT([$_am_result])
|
||||
rm -f confinc confmf
|
||||
])
|
||||
|
||||
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 4
|
||||
|
||||
# AM_MISSING_PROG(NAME, PROGRAM)
|
||||
# ------------------------------
|
||||
AC_DEFUN([AM_MISSING_PROG],
|
||||
[AC_REQUIRE([AM_MISSING_HAS_RUN])
|
||||
$1=${$1-"${am_missing_run}$2"}
|
||||
AC_SUBST($1)])
|
||||
|
||||
|
||||
# AM_MISSING_HAS_RUN
|
||||
# ------------------
|
||||
# Define MISSING if not defined so far and test if it supports --run.
|
||||
# If it does, set am_missing_run to use it, otherwise, to nothing.
|
||||
AC_DEFUN([AM_MISSING_HAS_RUN],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
|
||||
# Use eval to expand $SHELL
|
||||
if eval "$MISSING --run true"; then
|
||||
am_missing_run="$MISSING --run "
|
||||
else
|
||||
am_missing_run=
|
||||
AC_MSG_WARN([`missing' script is too old or missing])
|
||||
fi
|
||||
])
|
||||
|
||||
# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_PROG_MKDIR_P
|
||||
# ---------------
|
||||
# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
|
||||
#
|
||||
# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
|
||||
# created by `make install' are always world readable, even if the
|
||||
# installer happens to have an overly restrictive umask (e.g. 077).
|
||||
# This was a mistake. There are at least two reasons why we must not
|
||||
# use `-m 0755':
|
||||
# - it causes special bits like SGID to be ignored,
|
||||
# - it may be too restrictive (some setups expect 775 directories).
|
||||
#
|
||||
# Do not use -m 0755 and let people choose whatever they expect by
|
||||
# setting umask.
|
||||
#
|
||||
# We cannot accept any implementation of `mkdir' that recognizes `-p'.
|
||||
# Some implementations (such as Solaris 8's) are not thread-safe: if a
|
||||
# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
|
||||
# concurrently, both version can detect that a/ is missing, but only
|
||||
# one can create it and the other will error out. Consequently we
|
||||
# restrict ourselves to GNU make (using the --version option ensures
|
||||
# this.)
|
||||
AC_DEFUN([AM_PROG_MKDIR_P],
|
||||
[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
|
||||
# We used to keeping the `.' as first argument, in order to
|
||||
# allow $(mkdir_p) to be used without argument. As in
|
||||
# $(mkdir_p) $(somedir)
|
||||
# where $(somedir) is conditionally defined. However this is wrong
|
||||
# for two reasons:
|
||||
# 1. if the package is installed by a user who cannot write `.'
|
||||
# make install will fail,
|
||||
# 2. the above comment should most certainly read
|
||||
# $(mkdir_p) $(DESTDIR)$(somedir)
|
||||
# so it does not work when $(somedir) is undefined and
|
||||
# $(DESTDIR) is not.
|
||||
# To support the latter case, we have to write
|
||||
# test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
|
||||
# so the `.' trick is pointless.
|
||||
mkdir_p='mkdir -p --'
|
||||
else
|
||||
# On NextStep and OpenStep, the `mkdir' command does not
|
||||
# recognize any option. It will interpret all options as
|
||||
# directories to create, and then abort because `.' already
|
||||
# exists.
|
||||
for d in ./-p ./--version;
|
||||
do
|
||||
test -d $d && rmdir $d
|
||||
done
|
||||
# $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
|
||||
if test -f "$ac_aux_dir/mkinstalldirs"; then
|
||||
mkdir_p='$(mkinstalldirs)'
|
||||
else
|
||||
mkdir_p='$(install_sh) -d'
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([mkdir_p])])
|
||||
|
||||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 3
|
||||
|
||||
# _AM_MANGLE_OPTION(NAME)
|
||||
# -----------------------
|
||||
AC_DEFUN([_AM_MANGLE_OPTION],
|
||||
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
|
||||
|
||||
# _AM_SET_OPTION(NAME)
|
||||
# ------------------------------
|
||||
# Set option NAME. Presently that only means defining a flag for this option.
|
||||
AC_DEFUN([_AM_SET_OPTION],
|
||||
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
|
||||
|
||||
# _AM_SET_OPTIONS(OPTIONS)
|
||||
# ----------------------------------
|
||||
# OPTIONS is a space-separated list of Automake options.
|
||||
AC_DEFUN([_AM_SET_OPTIONS],
|
||||
[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
|
||||
|
||||
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
|
||||
# -------------------------------------------
|
||||
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
|
||||
AC_DEFUN([_AM_IF_OPTION],
|
||||
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
|
||||
|
||||
# Check to make sure that the build environment is sane. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 4
|
||||
|
||||
# AM_SANITY_CHECK
|
||||
# ---------------
|
||||
AC_DEFUN([AM_SANITY_CHECK],
|
||||
[AC_MSG_CHECKING([whether build environment is sane])
|
||||
# Just in case
|
||||
sleep 1
|
||||
echo timestamp > conftest.file
|
||||
# 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 conftest.file 2> /dev/null`
|
||||
if test "$[*]" = "X"; then
|
||||
# -L didn't work.
|
||||
set X `ls -t $srcdir/configure conftest.file`
|
||||
fi
|
||||
rm -f conftest.file
|
||||
if test "$[*]" != "X $srcdir/configure conftest.file" \
|
||||
&& test "$[*]" != "X conftest.file $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]" = conftest.file
|
||||
)
|
||||
then
|
||||
# Ok.
|
||||
:
|
||||
else
|
||||
AC_MSG_ERROR([newly created file is older than distributed files!
|
||||
Check your system clock])
|
||||
fi
|
||||
AC_MSG_RESULT(yes)])
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_PROG_INSTALL_STRIP
|
||||
# ---------------------
|
||||
# One issue with vendor `install' (even GNU) is that you can't
|
||||
# specify the program used to strip binaries. This is especially
|
||||
# annoying in cross-compiling environments, where the build's strip
|
||||
# is unlikely to handle the host's binaries.
|
||||
# Fortunately install-sh will honor a STRIPPROG variable, so we
|
||||
# always use install-sh in `make install-strip', and initialize
|
||||
# STRIPPROG with the value of the STRIP variable (set by the user).
|
||||
AC_DEFUN([AM_PROG_INSTALL_STRIP],
|
||||
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
|
||||
# Installed binaries are usually stripped using `strip' when the user
|
||||
# run `make install-strip'. However `strip' might not be the right
|
||||
# tool to use in cross-compilation environments, therefore Automake
|
||||
# will honor the `STRIP' environment variable to overrule this program.
|
||||
dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
|
||||
if test "$cross_compiling" != no; then
|
||||
AC_CHECK_TOOL([STRIP], [strip], :)
|
||||
fi
|
||||
INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
|
||||
AC_SUBST([INSTALL_STRIP_PROGRAM])])
|
||||
|
||||
# Check how to create a tarball. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 2
|
||||
|
||||
# _AM_PROG_TAR(FORMAT)
|
||||
# --------------------
|
||||
# Check how to create a tarball in format FORMAT.
|
||||
# FORMAT should be one of `v7', `ustar', or `pax'.
|
||||
#
|
||||
# Substitute a variable $(am__tar) that is a command
|
||||
# writing to stdout a FORMAT-tarball containing the directory
|
||||
# $tardir.
|
||||
# tardir=directory && $(am__tar) > result.tar
|
||||
#
|
||||
# Substitute a variable $(am__untar) that extract such
|
||||
# a tarball read from stdin.
|
||||
# $(am__untar) < result.tar
|
||||
AC_DEFUN([_AM_PROG_TAR],
|
||||
[# Always define AMTAR for backward compatibility.
|
||||
AM_MISSING_PROG([AMTAR], [tar])
|
||||
m4_if([$1], [v7],
|
||||
[am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
|
||||
[m4_case([$1], [ustar],, [pax],,
|
||||
[m4_fatal([Unknown tar format])])
|
||||
AC_MSG_CHECKING([how to create a $1 tar archive])
|
||||
# Loop over all known methods to create a tar archive until one works.
|
||||
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
|
||||
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
|
||||
# Do not fold the above two line into one, because Tru64 sh and
|
||||
# Solaris sh will not grok spaces in the rhs of `-'.
|
||||
for _am_tool in $_am_tools
|
||||
do
|
||||
case $_am_tool in
|
||||
gnutar)
|
||||
for _am_tar in tar gnutar gtar;
|
||||
do
|
||||
AM_RUN_LOG([$_am_tar --version]) && break
|
||||
done
|
||||
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
|
||||
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
|
||||
am__untar="$_am_tar -xf -"
|
||||
;;
|
||||
plaintar)
|
||||
# Must skip GNU tar: if it does not support --format= it doesn't create
|
||||
# ustar tarball either.
|
||||
(tar --version) >/dev/null 2>&1 && continue
|
||||
am__tar='tar chf - "$$tardir"'
|
||||
am__tar_='tar chf - "$tardir"'
|
||||
am__untar='tar xf -'
|
||||
;;
|
||||
pax)
|
||||
am__tar='pax -L -x $1 -w "$$tardir"'
|
||||
am__tar_='pax -L -x $1 -w "$tardir"'
|
||||
am__untar='pax -r'
|
||||
;;
|
||||
cpio)
|
||||
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
|
||||
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
|
||||
am__untar='cpio -i -H $1 -d'
|
||||
;;
|
||||
none)
|
||||
am__tar=false
|
||||
am__tar_=false
|
||||
am__untar=false
|
||||
;;
|
||||
esac
|
||||
|
||||
# If the value was cached, stop now. We just wanted to have am__tar
|
||||
# and am__untar set.
|
||||
test -n "${am_cv_prog_tar_$1}" && break
|
||||
|
||||
# tar/untar a dummy directory, and stop if the command works
|
||||
rm -rf conftest.dir
|
||||
mkdir conftest.dir
|
||||
echo GrepMe > conftest.dir/file
|
||||
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
|
||||
rm -rf conftest.dir
|
||||
if test -s conftest.tar; then
|
||||
AM_RUN_LOG([$am__untar <conftest.tar])
|
||||
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
|
||||
fi
|
||||
done
|
||||
rm -rf conftest.dir
|
||||
|
||||
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
|
||||
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
|
||||
AC_SUBST([am__tar])
|
||||
AC_SUBST([am__untar])
|
||||
]) # _AM_PROG_TAR
|
||||
|
||||
m4_include([acinclude.m4])
|
||||
@@ -1,366 +0,0 @@
|
||||
/* addr2line.c -- convert addresses to line number and function name
|
||||
Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
|
||||
Free Software Foundation, Inc.
|
||||
Contributed by Ulrich Lauther <Ulrich.Lauther@mchp.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, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Derived from objdump.c and nm.c by Ulrich.Lauther@mchp.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 "config.h"
|
||||
#include <string.h>
|
||||
|
||||
#include "bfd.h"
|
||||
#include "getopt.h"
|
||||
#include "libiberty.h"
|
||||
#include "demangle.h"
|
||||
#include "bucomm.h"
|
||||
#include "budemang.h"
|
||||
|
||||
static bfd_boolean unwind_inlines; /* -i, unwind inlined functions. */
|
||||
static bfd_boolean with_functions; /* -f, show function names. */
|
||||
static bfd_boolean do_demangle; /* -C, demangle names. */
|
||||
static bfd_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", optional_argument, NULL, 'C'},
|
||||
{"exe", required_argument, NULL, 'e'},
|
||||
{"functions", no_argument, NULL, 'f'},
|
||||
{"inlines", no_argument, NULL, 'i'},
|
||||
{"target", required_argument, NULL, 'b'},
|
||||
{"help", no_argument, NULL, 'H'},
|
||||
{"version", no_argument, NULL, 'V'},
|
||||
{0, no_argument, 0, 0}
|
||||
};
|
||||
|
||||
static void usage (FILE *, int);
|
||||
static void slurp_symtab (bfd *);
|
||||
static void find_address_in_section (bfd *, asection *, void *);
|
||||
static void translate_addresses (bfd *);
|
||||
static void process_file (const char *, const char *);
|
||||
|
||||
/* Print a usage message to STREAM and exit with STATUS. */
|
||||
|
||||
static void
|
||||
usage (FILE *stream, int status)
|
||||
{
|
||||
fprintf (stream, _("Usage: %s [option(s)] [addr(s)]\n"), program_name);
|
||||
fprintf (stream, _(" Convert addresses into line number/file name pairs.\n"));
|
||||
fprintf (stream, _(" If no addresses are specified on the command line, they will be read from stdin\n"));
|
||||
fprintf (stream, _(" The options are:\n\
|
||||
@<file> Read options from <file>\n\
|
||||
-b --target=<bfdname> Set the binary file format\n\
|
||||
-e --exe=<executable> Set the input file name (default is a.out)\n\
|
||||
-i --inlines Unwind inlined functions\n\
|
||||
-s --basenames Strip directory names\n\
|
||||
-f --functions Show function names\n\
|
||||
-C --demangle[=style] Demangle function names\n\
|
||||
-h --help Display this information\n\
|
||||
-v --version Display the program's version\n\
|
||||
\n"));
|
||||
|
||||
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 (bfd *abfd)
|
||||
{
|
||||
long symcount;
|
||||
unsigned int size;
|
||||
|
||||
if ((bfd_get_file_flags (abfd) & HAS_SYMS) == 0)
|
||||
return;
|
||||
|
||||
symcount = bfd_read_minisymbols (abfd, FALSE, (void *) &syms, &size);
|
||||
if (symcount == 0)
|
||||
symcount = bfd_read_minisymbols (abfd, TRUE /* dynamic */, (void *) &syms, &size);
|
||||
|
||||
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 bfd_boolean found;
|
||||
|
||||
/* Look for an address in a section. This is called via
|
||||
bfd_map_over_sections. */
|
||||
|
||||
static void
|
||||
find_address_in_section (bfd *abfd, asection *section,
|
||||
void *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 (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 (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, NULL);
|
||||
|
||||
if (! found)
|
||||
{
|
||||
if (with_functions)
|
||||
printf ("??\n");
|
||||
printf ("??:0\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
do {
|
||||
if (with_functions)
|
||||
{
|
||||
const char *name;
|
||||
char *alloc = NULL;
|
||||
|
||||
name = functionname;
|
||||
if (name == NULL || *name == '\0')
|
||||
name = "??";
|
||||
else if (do_demangle)
|
||||
{
|
||||
alloc = demangle (abfd, name);
|
||||
name = alloc;
|
||||
}
|
||||
|
||||
printf ("%s\n", name);
|
||||
|
||||
if (alloc != NULL)
|
||||
free (alloc);
|
||||
}
|
||||
|
||||
if (base_names && filename != NULL)
|
||||
{
|
||||
char *h;
|
||||
|
||||
h = strrchr (filename, '/');
|
||||
if (h != NULL)
|
||||
filename = h + 1;
|
||||
}
|
||||
|
||||
printf ("%s:%u\n", filename ? filename : "??", line);
|
||||
if (!unwind_inlines)
|
||||
found = FALSE;
|
||||
else
|
||||
found = bfd_find_inliner_info (abfd, &filename, &functionname, &line);
|
||||
} while (found);
|
||||
|
||||
}
|
||||
|
||||
/* 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 (const char *file_name, const char *target)
|
||||
{
|
||||
bfd *abfd;
|
||||
char **matching;
|
||||
|
||||
if (get_file_size (file_name) < 1)
|
||||
return;
|
||||
|
||||
abfd = bfd_openr (file_name, target);
|
||||
if (abfd == NULL)
|
||||
bfd_fatal (file_name);
|
||||
|
||||
if (bfd_check_format (abfd, bfd_archive))
|
||||
fatal (_("%s: can not get addresses from archive"), file_name);
|
||||
|
||||
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 (int, char **);
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
const char *file_name;
|
||||
char *target;
|
||||
int c;
|
||||
|
||||
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
|
||||
setlocale (LC_MESSAGES, "");
|
||||
#endif
|
||||
#if defined (HAVE_SETLOCALE)
|
||||
setlocale (LC_CTYPE, "");
|
||||
#endif
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
program_name = *argv;
|
||||
xmalloc_set_program_name (program_name);
|
||||
|
||||
expandargv (&argc, &argv);
|
||||
|
||||
bfd_init ();
|
||||
set_default_bfd_target ();
|
||||
|
||||
file_name = NULL;
|
||||
target = NULL;
|
||||
while ((c = getopt_long (argc, argv, "b:Ce:sfHhiVv", 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;
|
||||
if (optarg != NULL)
|
||||
{
|
||||
enum demangling_styles style;
|
||||
|
||||
style = cplus_demangle_name_to_style (optarg);
|
||||
if (style == unknown_demangling)
|
||||
fatal (_("unknown demangling style `%s'"),
|
||||
optarg);
|
||||
|
||||
cplus_demangle_set_style (style);
|
||||
}
|
||||
break;
|
||||
case 'e':
|
||||
file_name = optarg;
|
||||
break;
|
||||
case 's':
|
||||
base_names = TRUE;
|
||||
break;
|
||||
case 'f':
|
||||
with_functions = TRUE;
|
||||
break;
|
||||
case 'v':
|
||||
case 'V':
|
||||
print_version ("addr2line");
|
||||
break;
|
||||
case 'h':
|
||||
case 'H':
|
||||
usage (stdout, 0);
|
||||
break;
|
||||
case 'i':
|
||||
unwind_inlines = TRUE;
|
||||
break;
|
||||
default:
|
||||
usage (stderr, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (file_name == NULL)
|
||||
file_name = "a.out";
|
||||
|
||||
addr = argv + optind;
|
||||
naddr = argc - optind;
|
||||
|
||||
process_file (file_name, target);
|
||||
|
||||
return 0;
|
||||
}
|
||||
1263
binutils/ar.c
1263
binutils/ar.c
File diff suppressed because it is too large
Load Diff
@@ -1,90 +0,0 @@
|
||||
%{
|
||||
/* arlex.l - Strange script language lexer */
|
||||
|
||||
/* Copyright 1992, 1997, 2000, 2001, 2002, 2003, 2004
|
||||
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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
|
||||
/* Contributed by Steve Chamberlain <sac@cygnus.com>. */
|
||||
|
||||
#define DONTDECLARE_MALLOC
|
||||
#include "ansidecl.h"
|
||||
#include "libiberty.h"
|
||||
#include "arparse.h"
|
||||
|
||||
#define YY_NO_UNPUT
|
||||
|
||||
extern int yylex (void);
|
||||
|
||||
int linenumber;
|
||||
%}
|
||||
|
||||
%a 10000
|
||||
%o 25000
|
||||
|
||||
%%
|
||||
|
||||
"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(void) { return 1; }
|
||||
#endif
|
||||
@@ -1,203 +0,0 @@
|
||||
%{
|
||||
/* arparse.y - Stange script language parser */
|
||||
|
||||
/* Copyright 1992, 1993, 1995, 1997, 1999, 2002, 2003
|
||||
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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, 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 (void);
|
||||
static int yyerror (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 (const char *x ATTRIBUTE_UNUSED)
|
||||
{
|
||||
extern int linenumber;
|
||||
|
||||
printf (_("Syntax error in archive script, line %d\n"), linenumber + 1);
|
||||
return 0;
|
||||
}
|
||||
478
binutils/arsup.c
478
binutils/arsup.c
@@ -1,478 +0,0 @@
|
||||
/* arsup.c - Archive support for MRI compatibility
|
||||
Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003,
|
||||
2004 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, 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"
|
||||
#include "filenames.h"
|
||||
|
||||
static void map_over_list
|
||||
(bfd *, void (*function) (bfd *, bfd *), struct list *);
|
||||
static void ar_directory_doer (bfd *, bfd *);
|
||||
static void ar_addlib_doer (bfd *, bfd *);
|
||||
|
||||
extern int verbose;
|
||||
|
||||
static bfd *obfd;
|
||||
static char *real_name;
|
||||
static FILE *outfile;
|
||||
|
||||
static void
|
||||
map_over_list (bfd *arch, void (*function) (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)
|
||||
{
|
||||
bfd_boolean found = FALSE;
|
||||
bfd *prev = arch;
|
||||
|
||||
for (head = arch->next; head; head = head->next)
|
||||
{
|
||||
if (head->filename != NULL
|
||||
&& FILENAME_CMP (ptr->name, head->filename) == 0)
|
||||
{
|
||||
found = TRUE;
|
||||
function (head, prev);
|
||||
}
|
||||
prev = head;
|
||||
}
|
||||
if (! found)
|
||||
fprintf (stderr, _("No entry %s in archive.\n"), ptr->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
ar_directory_doer (bfd *abfd, bfd *ignore ATTRIBUTE_UNUSED)
|
||||
{
|
||||
print_arelt_descr(outfile, abfd, verbose);
|
||||
}
|
||||
|
||||
void
|
||||
ar_directory (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
|
||||
prompt (void)
|
||||
{
|
||||
extern int interactive;
|
||||
|
||||
if (interactive)
|
||||
{
|
||||
printf ("AR >");
|
||||
fflush (stdout);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
maybequit (void)
|
||||
{
|
||||
if (! interactive)
|
||||
xexit (9);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ar_open (char *name, int t)
|
||||
{
|
||||
char *tname = (char *) xmalloc (strlen (name) + 10);
|
||||
const char *bname = lbasename (name);
|
||||
real_name = name;
|
||||
|
||||
/* Prepend tmp- to the beginning, to avoid file-name clashes after
|
||||
truncation on filesystems with limited namespaces (DOS). */
|
||||
sprintf (tname, "%.*stmp-%s", (int) (bname - name), name, bname);
|
||||
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))
|
||||
{
|
||||
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 (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 (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 disappear. */
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ar_addmod (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
|
||||
ar_clear (void)
|
||||
{
|
||||
if (obfd)
|
||||
obfd->archive_head = 0;
|
||||
}
|
||||
|
||||
void
|
||||
ar_delete (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 (FILENAME_CMP(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
|
||||
ar_save (void)
|
||||
{
|
||||
if (!obfd)
|
||||
{
|
||||
fprintf (stderr, _("%s: no open output archive\n"), program_name);
|
||||
maybequit ();
|
||||
}
|
||||
else
|
||||
{
|
||||
char *ofilename = xstrdup (bfd_get_filename (obfd));
|
||||
|
||||
bfd_close (obfd);
|
||||
|
||||
smart_rename (ofilename, real_name, 0);
|
||||
obfd = 0;
|
||||
free (ofilename);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ar_replace (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 (FILENAME_CMP (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
|
||||
ar_list (void)
|
||||
{
|
||||
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
|
||||
ar_end (void)
|
||||
{
|
||||
if (obfd)
|
||||
{
|
||||
bfd_cache_close (obfd);
|
||||
unlink (bfd_get_filename (obfd));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ar_extract (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 (FILENAME_CMP (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,62 +0,0 @@
|
||||
/* arsup.h - archive support header file
|
||||
Copyright 1992, 1993, 1994, 1996, 2001, 2002, 2003
|
||||
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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
struct list {
|
||||
char *name;
|
||||
struct list *next;
|
||||
};
|
||||
|
||||
void maybequit (void);
|
||||
|
||||
void prompt (void);
|
||||
|
||||
void ar_clear (void);
|
||||
|
||||
void ar_replace (struct list *);
|
||||
|
||||
void ar_delete (struct list *);
|
||||
|
||||
void ar_save (void);
|
||||
|
||||
void ar_list (void);
|
||||
|
||||
void ar_open (char *, int);
|
||||
|
||||
void ar_directory (char *, struct list *, char *);
|
||||
|
||||
void ar_addmod (struct list *);
|
||||
|
||||
void ar_addlib (char *, struct list *);
|
||||
|
||||
void ar_end (void);
|
||||
|
||||
void ar_extract (struct list *);
|
||||
|
||||
bfd *open_inarch (const char *archive_filename, const char *);
|
||||
|
||||
extern int yylex (void);
|
||||
|
||||
int yyparse (void);
|
||||
|
||||
/* Functions from ar.c */
|
||||
|
||||
void extract_file (bfd * abfd);
|
||||
|
||||
extern int interactive;
|
||||
@@ -1,105 +0,0 @@
|
||||
/* Binutils emulation layer.
|
||||
Copyright 2002, 2003 Free Software Foundation, Inc.
|
||||
Written by Tom Rix, Red Hat 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include "binemul.h"
|
||||
|
||||
extern bin_emulation_xfer_type bin_dummy_emulation;
|
||||
|
||||
void
|
||||
ar_emul_usage (FILE *fp)
|
||||
{
|
||||
if (bin_dummy_emulation.ar_usage)
|
||||
bin_dummy_emulation.ar_usage (fp);
|
||||
}
|
||||
|
||||
void
|
||||
ar_emul_default_usage (FILE *fp)
|
||||
{
|
||||
AR_EMUL_USAGE_PRINT_OPTION_HEADER (fp);
|
||||
/* xgettext:c-format */
|
||||
fprintf (fp, _(" No emulation specific options\n"));
|
||||
}
|
||||
|
||||
bfd_boolean
|
||||
ar_emul_append (bfd **after_bfd, char *file_name, bfd_boolean verbose)
|
||||
{
|
||||
if (bin_dummy_emulation.ar_append)
|
||||
return bin_dummy_emulation.ar_append (after_bfd, file_name, verbose);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bfd_boolean
|
||||
ar_emul_default_append (bfd **after_bfd, char *file_name,
|
||||
bfd_boolean verbose)
|
||||
{
|
||||
bfd *temp;
|
||||
|
||||
temp = *after_bfd;
|
||||
*after_bfd = bfd_openr (file_name, NULL);
|
||||
|
||||
AR_EMUL_ELEMENT_CHECK (*after_bfd, file_name);
|
||||
AR_EMUL_APPEND_PRINT_VERBOSE (verbose, file_name);
|
||||
|
||||
(*after_bfd)->next = temp;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bfd_boolean
|
||||
ar_emul_replace (bfd **after_bfd, char *file_name, bfd_boolean verbose)
|
||||
{
|
||||
if (bin_dummy_emulation.ar_replace)
|
||||
return bin_dummy_emulation.ar_replace (after_bfd, file_name, verbose);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bfd_boolean
|
||||
ar_emul_default_replace (bfd **after_bfd, char *file_name,
|
||||
bfd_boolean verbose)
|
||||
{
|
||||
bfd *temp;
|
||||
|
||||
temp = *after_bfd;
|
||||
*after_bfd = bfd_openr (file_name, NULL);
|
||||
|
||||
AR_EMUL_ELEMENT_CHECK (*after_bfd, file_name);
|
||||
AR_EMUL_REPLACE_PRINT_VERBOSE (verbose, file_name);
|
||||
|
||||
(*after_bfd)->next = temp;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bfd_boolean
|
||||
ar_emul_parse_arg (char *arg)
|
||||
{
|
||||
if (bin_dummy_emulation.ar_parse_arg)
|
||||
return bin_dummy_emulation.ar_parse_arg (arg);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bfd_boolean
|
||||
ar_emul_default_parse_arg (char *arg ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
/* Binutils emulation layer.
|
||||
Copyright 2002, 2003 Free Software Foundation, Inc.
|
||||
Written by Tom Rix, Red Hat 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef BINEMUL_H
|
||||
#define BINEMUL_H
|
||||
|
||||
#include "bfd.h"
|
||||
#include "bucomm.h"
|
||||
|
||||
extern void ar_emul_usage (FILE *);
|
||||
extern void ar_emul_default_usage (FILE *);
|
||||
extern bfd_boolean ar_emul_append (bfd **, char *, bfd_boolean);
|
||||
extern bfd_boolean ar_emul_default_append (bfd **, char *, bfd_boolean);
|
||||
extern bfd_boolean ar_emul_replace (bfd **, char *, bfd_boolean);
|
||||
extern bfd_boolean ar_emul_default_replace (bfd **, char *, bfd_boolean);
|
||||
extern bfd_boolean ar_emul_parse_arg (char *);
|
||||
extern bfd_boolean ar_emul_default_parse_arg (char *);
|
||||
|
||||
/* Macros for common output. */
|
||||
|
||||
#define AR_EMUL_USAGE_PRINT_OPTION_HEADER(fp) \
|
||||
/* xgettext:c-format */ \
|
||||
fprintf (fp, _(" emulation options: \n"))
|
||||
|
||||
#define AR_EMUL_ELEMENT_CHECK(abfd, file_name) \
|
||||
do { if ((abfd) == NULL) bfd_fatal (file_name); } while (0)
|
||||
|
||||
#define AR_EMUL_APPEND_PRINT_VERBOSE(verbose, file_name) \
|
||||
do { if (verbose) printf ("a - %s\n", file_name); } while (0)
|
||||
|
||||
#define AR_EMUL_REPLACE_PRINT_VERBOSE(verbose, file_name) \
|
||||
do { if (verbose) printf ("r - %s\n", file_name); } while (0)
|
||||
|
||||
typedef struct bin_emulation_xfer_struct
|
||||
{
|
||||
/* Print out the extra options. */
|
||||
void (* ar_usage) (FILE *fp);
|
||||
bfd_boolean (* ar_append) (bfd **, char *, bfd_boolean);
|
||||
bfd_boolean (* ar_replace) (bfd **, char *, bfd_boolean);
|
||||
bfd_boolean (* ar_parse_arg) (char *);
|
||||
}
|
||||
bin_emulation_xfer_type;
|
||||
|
||||
#endif
|
||||
@@ -1,513 +0,0 @@
|
||||
/* bucomm.c -- Bin Utils COMmon code.
|
||||
Copyright 1991, 1992, 1993, 1994, 1995, 1997, 1998, 2000, 2001, 2002, 2003
|
||||
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., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
02110-1301, 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 "bfdver.h"
|
||||
#include "libiberty.h"
|
||||
#include "bucomm.h"
|
||||
#include "filenames.h"
|
||||
#include "libbfd.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <time.h> /* ctime, maybe time_t */
|
||||
#include <assert.h>
|
||||
|
||||
#ifndef HAVE_TIME_T_IN_TIME_H
|
||||
#ifndef HAVE_TIME_T_IN_TYPES_H
|
||||
typedef long time_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static const char * endian_string (enum bfd_endian);
|
||||
static int display_target_list (void);
|
||||
static int display_info_table (int, int);
|
||||
static int display_target_tables (void);
|
||||
|
||||
/* Error reporting. */
|
||||
|
||||
char *program_name;
|
||||
|
||||
void
|
||||
bfd_nonfatal (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 (const char *string)
|
||||
{
|
||||
bfd_nonfatal (string);
|
||||
xexit (1);
|
||||
}
|
||||
|
||||
void
|
||||
report (const char * format, va_list args)
|
||||
{
|
||||
fprintf (stderr, "%s: ", program_name);
|
||||
vfprintf (stderr, format, args);
|
||||
putc ('\n', stderr);
|
||||
}
|
||||
|
||||
void
|
||||
fatal VPARAMS ((const char *format, ...))
|
||||
{
|
||||
VA_OPEN (args, format);
|
||||
VA_FIXEDARG (args, const char *, format);
|
||||
|
||||
report (format, args);
|
||||
VA_CLOSE (args);
|
||||
xexit (1);
|
||||
}
|
||||
|
||||
void
|
||||
non_fatal VPARAMS ((const char *format, ...))
|
||||
{
|
||||
VA_OPEN (args, format);
|
||||
VA_FIXEDARG (args, const char *, format);
|
||||
|
||||
report (format, args);
|
||||
VA_CLOSE (args);
|
||||
}
|
||||
|
||||
/* 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 (void)
|
||||
{
|
||||
/* 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 (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 (const char *name, FILE *f)
|
||||
{
|
||||
int t;
|
||||
const char **targ_names = bfd_target_list ();
|
||||
|
||||
if (name == NULL)
|
||||
fprintf (f, _("Supported targets:"));
|
||||
else
|
||||
fprintf (f, _("%s: supported targets:"), name);
|
||||
|
||||
for (t = 0; targ_names[t] != NULL; t++)
|
||||
fprintf (f, " %s", targ_names[t]);
|
||||
fprintf (f, "\n");
|
||||
free (targ_names);
|
||||
}
|
||||
|
||||
/* List the supported architectures. */
|
||||
|
||||
void
|
||||
list_supported_architectures (const char *name, FILE *f)
|
||||
{
|
||||
const char **arch;
|
||||
|
||||
if (name == NULL)
|
||||
fprintf (f, _("Supported architectures:"));
|
||||
else
|
||||
fprintf (f, _("%s: supported architectures:"), name);
|
||||
|
||||
for (arch = bfd_arch_list (); *arch; arch++)
|
||||
fprintf (f, " %s", *arch);
|
||||
fprintf (f, "\n");
|
||||
}
|
||||
|
||||
/* The length of the longest architecture name + 1. */
|
||||
#define LONGEST_ARCH sizeof ("powerpc:common")
|
||||
|
||||
static const char *
|
||||
endian_string (enum bfd_endian endian)
|
||||
{
|
||||
switch (endian)
|
||||
{
|
||||
case BFD_ENDIAN_BIG: return "big endian";
|
||||
case BFD_ENDIAN_LITTLE: return "little endian";
|
||||
default: return "endianness unknown";
|
||||
}
|
||||
}
|
||||
|
||||
/* List the targets that BFD is configured to support, each followed
|
||||
by its endianness and the architectures it supports. */
|
||||
|
||||
static int
|
||||
display_target_list (void)
|
||||
{
|
||||
char *dummy_name;
|
||||
int t;
|
||||
int ret = 1;
|
||||
|
||||
dummy_name = make_temp_file (NULL);
|
||||
for (t = 0; bfd_target_vector[t]; t++)
|
||||
{
|
||||
const bfd_target *p = bfd_target_vector[t];
|
||||
bfd *abfd = bfd_openw (dummy_name, p->name);
|
||||
int a;
|
||||
|
||||
printf ("%s\n (header %s, data %s)\n", p->name,
|
||||
endian_string (p->header_byteorder),
|
||||
endian_string (p->byteorder));
|
||||
|
||||
if (abfd == NULL)
|
||||
{
|
||||
bfd_nonfatal (dummy_name);
|
||||
ret = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! bfd_set_format (abfd, bfd_object))
|
||||
{
|
||||
if (bfd_get_error () != bfd_error_invalid_operation)
|
||||
{
|
||||
bfd_nonfatal (p->name);
|
||||
ret = 0;
|
||||
}
|
||||
bfd_close_all_done (abfd);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (a = (int) bfd_arch_obscure + 1; a < (int) bfd_arch_last; a++)
|
||||
if (bfd_set_arch_mach (abfd, (enum bfd_architecture) a, 0))
|
||||
printf (" %s\n",
|
||||
bfd_printable_arch_mach ((enum bfd_architecture) a, 0));
|
||||
bfd_close_all_done (abfd);
|
||||
}
|
||||
unlink (dummy_name);
|
||||
free (dummy_name);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Print a table showing which architectures are supported for entries
|
||||
FIRST through LAST-1 of bfd_target_vector (targets across,
|
||||
architectures down). */
|
||||
|
||||
static int
|
||||
display_info_table (int first, int last)
|
||||
{
|
||||
int t;
|
||||
int a;
|
||||
int ret = 1;
|
||||
char *dummy_name;
|
||||
|
||||
/* Print heading of target names. */
|
||||
printf ("\n%*s", (int) LONGEST_ARCH, " ");
|
||||
for (t = first; t < last && bfd_target_vector[t]; t++)
|
||||
printf ("%s ", bfd_target_vector[t]->name);
|
||||
putchar ('\n');
|
||||
|
||||
dummy_name = make_temp_file (NULL);
|
||||
for (a = (int) bfd_arch_obscure + 1; a < (int) bfd_arch_last; a++)
|
||||
if (strcmp (bfd_printable_arch_mach (a, 0), "UNKNOWN!") != 0)
|
||||
{
|
||||
printf ("%*s ", (int) LONGEST_ARCH - 1,
|
||||
bfd_printable_arch_mach (a, 0));
|
||||
for (t = first; t < last && bfd_target_vector[t]; t++)
|
||||
{
|
||||
const bfd_target *p = bfd_target_vector[t];
|
||||
bfd_boolean ok = TRUE;
|
||||
bfd *abfd = bfd_openw (dummy_name, p->name);
|
||||
|
||||
if (abfd == NULL)
|
||||
{
|
||||
bfd_nonfatal (p->name);
|
||||
ret = 0;
|
||||
ok = FALSE;
|
||||
}
|
||||
|
||||
if (ok)
|
||||
{
|
||||
if (! bfd_set_format (abfd, bfd_object))
|
||||
{
|
||||
if (bfd_get_error () != bfd_error_invalid_operation)
|
||||
{
|
||||
bfd_nonfatal (p->name);
|
||||
ret = 0;
|
||||
}
|
||||
ok = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (ok)
|
||||
{
|
||||
if (! bfd_set_arch_mach (abfd, a, 0))
|
||||
ok = FALSE;
|
||||
}
|
||||
|
||||
if (ok)
|
||||
printf ("%s ", p->name);
|
||||
else
|
||||
{
|
||||
int l = strlen (p->name);
|
||||
while (l--)
|
||||
putchar ('-');
|
||||
putchar (' ');
|
||||
}
|
||||
if (abfd != NULL)
|
||||
bfd_close_all_done (abfd);
|
||||
}
|
||||
putchar ('\n');
|
||||
}
|
||||
unlink (dummy_name);
|
||||
free (dummy_name);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Print tables of all the target-architecture combinations that
|
||||
BFD has been configured to support. */
|
||||
|
||||
static int
|
||||
display_target_tables (void)
|
||||
{
|
||||
int t;
|
||||
int columns;
|
||||
int ret = 1;
|
||||
char *colum;
|
||||
|
||||
columns = 0;
|
||||
colum = getenv ("COLUMNS");
|
||||
if (colum != NULL)
|
||||
columns = atoi (colum);
|
||||
if (columns == 0)
|
||||
columns = 80;
|
||||
|
||||
t = 0;
|
||||
while (bfd_target_vector[t] != NULL)
|
||||
{
|
||||
int oldt = t, wid;
|
||||
|
||||
wid = LONGEST_ARCH + strlen (bfd_target_vector[t]->name) + 1;
|
||||
++t;
|
||||
while (wid < columns && bfd_target_vector[t] != NULL)
|
||||
{
|
||||
int newwid;
|
||||
|
||||
newwid = wid + strlen (bfd_target_vector[t]->name) + 1;
|
||||
if (newwid >= columns)
|
||||
break;
|
||||
wid = newwid;
|
||||
++t;
|
||||
}
|
||||
if (! display_info_table (oldt, t))
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
display_info (void)
|
||||
{
|
||||
printf (_("BFD header file version %s\n"), BFD_VERSION_STRING);
|
||||
if (! display_target_list () || ! display_target_tables ())
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 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 *file, bfd *abfd, bfd_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 (char *filename)
|
||||
{
|
||||
static char template[] = "stXXXXXX";
|
||||
char *tmpname;
|
||||
char *slash = strrchr (filename, '/');
|
||||
|
||||
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
|
||||
{
|
||||
/* We could have foo/bar\\baz, or foo\\bar, or d:bar. */
|
||||
char *bslash = strrchr (filename, '\\');
|
||||
if (slash == NULL || (bslash != NULL && bslash > slash))
|
||||
slash = bslash;
|
||||
if (slash == NULL && filename[0] != '\0' && filename[1] == ':')
|
||||
slash = filename + 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (slash != (char *) NULL)
|
||||
{
|
||||
char c;
|
||||
|
||||
c = *slash;
|
||||
*slash = 0;
|
||||
tmpname = xmalloc (strlen (filename) + sizeof (template) + 2);
|
||||
strcpy (tmpname, filename);
|
||||
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
|
||||
/* If tmpname is "X:", appending a slash will make it a root
|
||||
directory on drive X, which is NOT the same as the current
|
||||
directory on drive X. */
|
||||
if (tmpname[1] == ':' && tmpname[2] == '\0')
|
||||
strcat (tmpname, ".");
|
||||
#endif
|
||||
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 (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;
|
||||
}
|
||||
|
||||
/* Returns the size of the named file. If the file does not
|
||||
exist, or if it is not a real file, then a suitable non-fatal
|
||||
error message is printed and zero is returned. */
|
||||
|
||||
off_t
|
||||
get_file_size (const char * file_name)
|
||||
{
|
||||
struct stat statbuf;
|
||||
|
||||
if (stat (file_name, &statbuf) < 0)
|
||||
{
|
||||
if (errno == ENOENT)
|
||||
non_fatal (_("'%s': No such file"), file_name);
|
||||
else
|
||||
non_fatal (_("Warning: could not locate '%s'. reason: %s"),
|
||||
file_name, strerror (errno));
|
||||
}
|
||||
else if (! S_ISREG (statbuf.st_mode))
|
||||
non_fatal (_("Warning: '%s' is not an ordinary file"), file_name);
|
||||
else
|
||||
return statbuf.st_size;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Return the filename in a static buffer. */
|
||||
|
||||
const char *
|
||||
bfd_get_archive_filename (bfd *abfd)
|
||||
{
|
||||
static size_t curr = 0;
|
||||
static char *buf;
|
||||
size_t needed;
|
||||
|
||||
assert (abfd != NULL);
|
||||
|
||||
if (!abfd->my_archive)
|
||||
return bfd_get_filename (abfd);
|
||||
|
||||
needed = (strlen (bfd_get_filename (abfd->my_archive))
|
||||
+ strlen (bfd_get_filename (abfd)) + 3);
|
||||
if (needed > curr)
|
||||
{
|
||||
if (curr)
|
||||
free (buf);
|
||||
curr = needed + (needed >> 1);
|
||||
buf = bfd_malloc (curr);
|
||||
/* If we can't malloc, fail safe by returning just the file name.
|
||||
This function is only used when building error messages. */
|
||||
if (!buf)
|
||||
{
|
||||
curr = 0;
|
||||
return bfd_get_filename (abfd);
|
||||
}
|
||||
}
|
||||
sprintf (buf, "%s(%s)", bfd_get_filename (abfd->my_archive),
|
||||
bfd_get_filename (abfd));
|
||||
return buf;
|
||||
}
|
||||
@@ -1,214 +0,0 @@
|
||||
/* bucomm.h -- binutils common include file.
|
||||
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||
2001, 2002, 2003, 2005 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef _BUCOMM_H
|
||||
#define _BUCOMM_H
|
||||
|
||||
#include "ansidecl.h"
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "bin-bugs.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#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
|
||||
|
||||
#if !HAVE_DECL_STPCPY
|
||||
extern char *stpcpy (char *, const char *);
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_STRSTR
|
||||
extern char *strstr ();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SBRK
|
||||
#if !HAVE_DECL_SBRK
|
||||
extern char *sbrk ();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_GETENV
|
||||
extern char *getenv ();
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_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
|
||||
# ifndef ENABLE_NLS
|
||||
/* The Solaris version of locale.h always includes libintl.h. If we have
|
||||
been configured with --disable-nls then ENABLE_NLS will not be defined
|
||||
and the dummy definitions of bindtextdomain (et al) below will conflict
|
||||
with the defintions in libintl.h. So we define these values to prevent
|
||||
the bogus inclusion of libintl.h. */
|
||||
# define _LIBINTL_H
|
||||
# define _LIBGETTEXT_H
|
||||
# endif
|
||||
# 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
|
||||
# define gettext(Msgid) (Msgid)
|
||||
# define dgettext(Domainname, Msgid) (Msgid)
|
||||
# define dcgettext(Domainname, Msgid, Category) (Msgid)
|
||||
# define textdomain(Domainname) while (0) /* nothing */
|
||||
# define bindtextdomain(Domainname, Dirname) while (0) /* nothing */
|
||||
# define _(String) (String)
|
||||
# define N_(String) (String)
|
||||
#endif
|
||||
|
||||
/* Used by ar.c and objcopy.c. */
|
||||
#define BUFSIZE 8192
|
||||
|
||||
/* bucomm.c */
|
||||
|
||||
/* Return the filename in a static buffer. */
|
||||
const char *bfd_get_archive_filename (bfd *);
|
||||
|
||||
void bfd_nonfatal (const char *);
|
||||
|
||||
void bfd_fatal (const char *) ATTRIBUTE_NORETURN;
|
||||
|
||||
void report (const char *, va_list) ATTRIBUTE_PRINTF(1,0);
|
||||
|
||||
void fatal (const char *, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
|
||||
|
||||
void non_fatal (const char *, ...) ATTRIBUTE_PRINTF_1;
|
||||
|
||||
void set_default_bfd_target (void);
|
||||
|
||||
void list_matching_formats (char **);
|
||||
|
||||
void list_supported_targets (const char *, FILE *);
|
||||
|
||||
void list_supported_architectures (const char *, FILE *);
|
||||
|
||||
int display_info (void);
|
||||
|
||||
void print_arelt_descr (FILE *, bfd *, bfd_boolean);
|
||||
|
||||
char *make_tempname (char *);
|
||||
|
||||
bfd_vma parse_vma (const char *, const char *);
|
||||
|
||||
off_t get_file_size (const char *);
|
||||
|
||||
extern char *program_name;
|
||||
|
||||
/* filemode.c */
|
||||
void mode_string (unsigned long, char *);
|
||||
|
||||
/* version.c */
|
||||
extern void print_version (const char *);
|
||||
|
||||
/* rename.c */
|
||||
extern void set_times (const char *, const struct stat *);
|
||||
|
||||
extern int smart_rename (const char *, const char *, int);
|
||||
|
||||
/* libiberty. */
|
||||
void *xmalloc (size_t);
|
||||
|
||||
void *xrealloc (void *, size_t);
|
||||
|
||||
#endif /* _BUCOMM_H */
|
||||
@@ -1,58 +0,0 @@
|
||||
/* budbg.c -- Interfaces to the generic debugging information routines.
|
||||
Copyright 1995, 1996, 2002, 2003 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., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
02110-1301, USA. */
|
||||
|
||||
#ifndef BUDBG_H
|
||||
#define BUDBG_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* Routine used to read generic debugging information. */
|
||||
|
||||
extern void *read_debugging_info (bfd *, asymbol **, long);
|
||||
|
||||
/* Routine used to print generic debugging information. */
|
||||
|
||||
extern bfd_boolean print_debugging_info
|
||||
(FILE *, void *, bfd *, asymbol **, void *, bfd_boolean);
|
||||
|
||||
/* Routines used to read and write stabs information. */
|
||||
|
||||
extern void *start_stab (void *, bfd *, bfd_boolean, asymbol **, long);
|
||||
|
||||
extern bfd_boolean finish_stab (void *, void *);
|
||||
|
||||
extern bfd_boolean parse_stab
|
||||
(void *, void *, int, int, bfd_vma, const char *);
|
||||
|
||||
extern bfd_boolean write_stabs_in_sections_debugging_info
|
||||
(bfd *, void *, bfd_byte **, bfd_size_type *, bfd_byte **, bfd_size_type *);
|
||||
|
||||
/* Routines used to read and write IEEE debugging information. */
|
||||
|
||||
extern bfd_boolean parse_ieee (void *, bfd *, const bfd_byte *, bfd_size_type);
|
||||
|
||||
extern bfd_boolean write_ieee_debugging_info (bfd *, void *);
|
||||
|
||||
/* Routine used to read COFF debugging information. */
|
||||
|
||||
extern bfd_boolean parse_coff (bfd *, asymbol **, long, void *);
|
||||
|
||||
#endif
|
||||
@@ -1,100 +0,0 @@
|
||||
/* demangle.c -- A wrapper calling libiberty cplus_demangle
|
||||
Copyright 2002, 2003, 2004 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., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
02110-1301, USA. */
|
||||
|
||||
#include "config.h"
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#else
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
#endif
|
||||
#include "bfd.h"
|
||||
#include "libiberty.h"
|
||||
#include "demangle.h"
|
||||
#include "budemang.h"
|
||||
|
||||
/* Wrapper around cplus_demangle. Strips leading underscores and
|
||||
other such chars that would otherwise confuse the demangler. */
|
||||
|
||||
char *
|
||||
demangle (bfd *abfd, const char *name)
|
||||
{
|
||||
char *res, *alloc;
|
||||
const char *pre, *suf;
|
||||
size_t pre_len;
|
||||
|
||||
if (abfd != NULL && bfd_get_symbol_leading_char (abfd) == name[0])
|
||||
++name;
|
||||
|
||||
/* This is a hack for better error reporting on XCOFF, PowerPC64-ELF
|
||||
or the MS PE format. These formats have a number of leading '.'s
|
||||
on at least some symbols, so we remove all dots to avoid
|
||||
confusing the demangler. */
|
||||
pre = name;
|
||||
while (*name == '.')
|
||||
++name;
|
||||
pre_len = name - pre;
|
||||
|
||||
alloc = NULL;
|
||||
suf = strchr (name, '@');
|
||||
if (suf != NULL)
|
||||
{
|
||||
alloc = xmalloc (suf - name + 1);
|
||||
memcpy (alloc, name, suf - name);
|
||||
alloc[suf - name] = '\0';
|
||||
name = alloc;
|
||||
}
|
||||
|
||||
res = cplus_demangle (name, DMGL_ANSI | DMGL_PARAMS);
|
||||
if (res != NULL)
|
||||
{
|
||||
/* Now put back any suffix, or stripped dots. */
|
||||
if (pre_len != 0 || suf != NULL)
|
||||
{
|
||||
size_t len;
|
||||
size_t suf_len;
|
||||
char *final;
|
||||
|
||||
if (alloc != NULL)
|
||||
free (alloc);
|
||||
|
||||
len = strlen (res);
|
||||
if (suf == NULL)
|
||||
suf = res + len;
|
||||
suf_len = strlen (suf) + 1;
|
||||
final = xmalloc (pre_len + len + suf_len);
|
||||
|
||||
memcpy (final, pre, pre_len);
|
||||
memcpy (final + pre_len, res, len);
|
||||
memcpy (final + pre_len + len, suf, suf_len);
|
||||
free (res);
|
||||
res = final;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
if (alloc != NULL)
|
||||
free (alloc);
|
||||
|
||||
return xstrdup (pre);
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/* demangle.h -- A wrapper calling libiberty cplus_demangle
|
||||
Copyright 2002, 2003 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., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
02110-1301, USA. */
|
||||
#ifndef BUDEMANG_H
|
||||
#define BUDEMANG_H
|
||||
|
||||
char *demangle (bfd *, const char *);
|
||||
|
||||
#endif
|
||||
@@ -1,553 +0,0 @@
|
||||
/* Coff file dumper.
|
||||
Copyright 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003
|
||||
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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, 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 "libiberty.h"
|
||||
|
||||
#include "coffgrok.h"
|
||||
#include "bucomm.h"
|
||||
#include "getopt.h"
|
||||
|
||||
static int atnl;
|
||||
|
||||
static void tab (int);
|
||||
static void nl (void);
|
||||
static void dump_coff_lines (struct coff_line *);
|
||||
static void dump_coff_type (struct coff_type *);
|
||||
static void dump_coff_where (struct coff_where *);
|
||||
static void dump_coff_visible (struct coff_visible *);
|
||||
static void dump_coff_scope (struct coff_scope *);
|
||||
static void dump_coff_sfile (struct coff_sfile *);
|
||||
static void dump_coff_section (struct coff_section *);
|
||||
static void show_usage (FILE *, int);
|
||||
extern int main (int, char **);
|
||||
|
||||
static void
|
||||
tab (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 (void)
|
||||
{
|
||||
atnl = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
dump_coff_lines (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 (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 (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 (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);
|
||||
}
|
||||
|
||||
static void
|
||||
dump_coff_symbol (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 (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 (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 (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);
|
||||
}
|
||||
|
||||
static void
|
||||
coff_dump (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 *file, int status)
|
||||
{
|
||||
fprintf (file, _("Usage: %s [option(s)] in-file\n"), program_name);
|
||||
fprintf (file, _(" Print a human readable interpretation of a SYSROFF object file\n"));
|
||||
fprintf (file, _(" The options are:\n\
|
||||
@<file> Read options from <file>\n\
|
||||
-h --help Display this information\n\
|
||||
-v --version Display the program's version\n\
|
||||
\n"));
|
||||
|
||||
if (status == 0)
|
||||
fprintf (file, _("Report bugs to %s\n"), REPORT_BUGS_TO);
|
||||
|
||||
exit (status);
|
||||
}
|
||||
|
||||
int
|
||||
main (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
|
||||
#if defined (HAVE_SETLOCALE)
|
||||
setlocale (LC_CTYPE, "");
|
||||
#endif
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
program_name = av[0];
|
||||
xmalloc_set_program_name (program_name);
|
||||
|
||||
expandargv (&ac, &av);
|
||||
|
||||
while ((opt = getopt_long (ac, av, "HhVv", long_options,
|
||||
(int *) NULL))
|
||||
!= EOF)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
case 'H':
|
||||
case 'h':
|
||||
show_usage (stdout, 0);
|
||||
break;
|
||||
case 'v':
|
||||
case 'V':
|
||||
print_version ("coffdump");
|
||||
exit (0);
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
show_usage (stderr, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
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,741 +0,0 @@
|
||||
/* coffgrok.c
|
||||
Copyright 1994, 1995, 1997, 1998, 2000, 2001, 2002, 2003, 2004
|
||||
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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, 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 "libiberty.h"
|
||||
#include "bucomm.h"
|
||||
|
||||
#include "coff/internal.h"
|
||||
#include "../bfd/libcoff.h"
|
||||
#include "coffgrok.h"
|
||||
static int lofile = 1;
|
||||
static struct coff_scope *top_scope;
|
||||
static struct coff_scope *file_scope;
|
||||
static struct coff_ofile *ofile;
|
||||
|
||||
static struct coff_symbol *last_function_symbol;
|
||||
static struct coff_type *last_function_type;
|
||||
static struct coff_type *last_struct;
|
||||
static struct coff_type *last_enum;
|
||||
static 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;
|
||||
|
||||
#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 (void);
|
||||
static struct coff_symbol *empty_symbol (void);
|
||||
static void push_scope (int);
|
||||
static void pop_scope (void);
|
||||
static void do_sections_p1 (struct coff_ofile *);
|
||||
static void do_sections_p2 (struct coff_ofile *);
|
||||
static struct coff_where *do_where (int);
|
||||
static struct coff_line *do_lines (int, char *);
|
||||
static struct coff_type *do_type (int);
|
||||
static struct coff_visible *do_visible (int);
|
||||
static int do_define (int, struct coff_scope *);
|
||||
static struct coff_ofile *doit (void);
|
||||
|
||||
static struct coff_scope *
|
||||
empty_scope (void)
|
||||
{
|
||||
struct coff_scope *l;
|
||||
l = (struct coff_scope *) (xcalloc (sizeof (struct coff_scope), 1));
|
||||
return l;
|
||||
}
|
||||
|
||||
static struct coff_symbol *
|
||||
empty_symbol (void)
|
||||
{
|
||||
return (struct coff_symbol *) (xcalloc (sizeof (struct coff_symbol), 1));
|
||||
}
|
||||
|
||||
/*int l;*/
|
||||
static void
|
||||
push_scope (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 (void)
|
||||
{
|
||||
top_scope = top_scope->parent;
|
||||
}
|
||||
|
||||
static void
|
||||
do_sections_p1 (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 = bfd_get_section_size (section);
|
||||
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 (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 (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 (int i, char *name ATTRIBUTE_UNUSED)
|
||||
{
|
||||
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 (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)
|
||||
{
|
||||
/* Referring 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 anonymous */
|
||||
res->type = coff_structref_type;
|
||||
res->u.astructref.ref = 0;
|
||||
res->size = 0;
|
||||
}
|
||||
break;
|
||||
case T_ENUM:
|
||||
if (aux->x_sym.x_tagndx.p)
|
||||
{
|
||||
/* Referring 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 (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 (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 (void)
|
||||
{
|
||||
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 (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,225 +0,0 @@
|
||||
/* coffgrok.h
|
||||
Copyright 2001, 2002, 2003 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#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 bfd_section *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 PARAMS ((bfd *));
|
||||
@@ -1,259 +0,0 @@
|
||||
/* config.in. Generated from configure.in by autoheader. */
|
||||
|
||||
/* 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 to 1 if using `alloca.c'. */
|
||||
#undef C_ALLOCA
|
||||
|
||||
/* Define to 1 if NLS is requested */
|
||||
#undef ENABLE_NLS
|
||||
|
||||
/* Suffix used for executables, if any. */
|
||||
#undef EXECUTABLE_SUFFIX
|
||||
|
||||
/* Define to 1 if you have `alloca', as a function or macro. */
|
||||
#undef HAVE_ALLOCA
|
||||
|
||||
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
|
||||
*/
|
||||
#undef HAVE_ALLOCA_H
|
||||
|
||||
/* Define to 1 if you have the <argz.h> header file. */
|
||||
#undef HAVE_ARGZ_H
|
||||
|
||||
/* Define to 1 if you have the `dcgettext' function. */
|
||||
#undef HAVE_DCGETTEXT
|
||||
|
||||
/* Define to 1 if you have the declaration of `environ', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_ENVIRON
|
||||
|
||||
/* Define to 1 if you have the declaration of `fprintf', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_FPRINTF
|
||||
|
||||
/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_GETC_UNLOCKED
|
||||
|
||||
/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't.
|
||||
*/
|
||||
#undef HAVE_DECL_GETENV
|
||||
|
||||
/* Is the prototype for getopt in <unistd.h> in the expected format? */
|
||||
#undef HAVE_DECL_GETOPT
|
||||
|
||||
/* Define to 1 if you have the declaration of `sbrk', and to 0 if you don't.
|
||||
*/
|
||||
#undef HAVE_DECL_SBRK
|
||||
|
||||
/* Define to 1 if you have the declaration of `stpcpy', and to 0 if you don't.
|
||||
*/
|
||||
#undef HAVE_DECL_STPCPY
|
||||
|
||||
/* Define to 1 if you have the declaration of `strstr', and to 0 if you don't.
|
||||
*/
|
||||
#undef HAVE_DECL_STRSTR
|
||||
|
||||
/* Does the platform use an executable suffix? */
|
||||
#undef HAVE_EXECUTABLE_SUFFIX
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Is fopen64 available? */
|
||||
#undef HAVE_FOPEN64
|
||||
|
||||
/* Define to 1 if you have the `getcwd' function. */
|
||||
#undef HAVE_GETCWD
|
||||
|
||||
/* Define to 1 if you have the `getc_unlocked' function. */
|
||||
#undef HAVE_GETC_UNLOCKED
|
||||
|
||||
/* Define to 1 if you have the `getpagesize' function. */
|
||||
#undef HAVE_GETPAGESIZE
|
||||
|
||||
/* Define as 1 if you have gettext and don't want to use GNU gettext. */
|
||||
#undef HAVE_GETTEXT
|
||||
|
||||
/* Does <utime.h> define struct utimbuf? */
|
||||
#undef HAVE_GOOD_UTIME_H
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define if your locale.h file contains LC_MESSAGES. */
|
||||
#undef HAVE_LC_MESSAGES
|
||||
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#undef HAVE_LIMITS_H
|
||||
|
||||
/* Define to 1 if you have the <locale.h> header file. */
|
||||
#undef HAVE_LOCALE_H
|
||||
|
||||
/* Define to 1 if you have the <malloc.h> header file. */
|
||||
#undef HAVE_MALLOC_H
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have a working `mmap' system call. */
|
||||
#undef HAVE_MMAP
|
||||
|
||||
/* Define to 1 if you have the `munmap' function. */
|
||||
#undef HAVE_MUNMAP
|
||||
|
||||
/* Define to 1 if you have the <nl_types.h> header file. */
|
||||
#undef HAVE_NL_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the `putenv' function. */
|
||||
#undef HAVE_PUTENV
|
||||
|
||||
/* Define to 1 if you have the `sbrk' function. */
|
||||
#undef HAVE_SBRK
|
||||
|
||||
/* Define to 1 if you have the `setenv' function. */
|
||||
#undef HAVE_SETENV
|
||||
|
||||
/* Define to 1 if you have the `setlocale' function. */
|
||||
#undef HAVE_SETLOCALE
|
||||
|
||||
/* Define to 1 if you have the `setmode' function. */
|
||||
#undef HAVE_SETMODE
|
||||
|
||||
/* Is stat64 available? */
|
||||
#undef HAVE_STAT64
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define if you have the stpcpy function */
|
||||
#undef HAVE_STPCPY
|
||||
|
||||
/* Define to 1 if you have the `strcasecmp' function. */
|
||||
#undef HAVE_STRCASECMP
|
||||
|
||||
/* Define to 1 if you have the `strchr' function. */
|
||||
#undef HAVE_STRCHR
|
||||
|
||||
/* Define to 1 if you have the `strcoll' function. */
|
||||
#undef HAVE_STRCOLL
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the <sys/file.h> header file. */
|
||||
#undef HAVE_SYS_FILE_H
|
||||
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||
#undef HAVE_SYS_WAIT_H
|
||||
|
||||
/* 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
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the `utimes' function. */
|
||||
#undef HAVE_UTIMES
|
||||
|
||||
/* Define to 1 if you have the <values.h> header file. */
|
||||
#undef HAVE_VALUES_H
|
||||
|
||||
/* Define to 1 if you have the `__argz_count' function. */
|
||||
#undef HAVE___ARGZ_COUNT
|
||||
|
||||
/* Define to 1 if you have the `__argz_next' function. */
|
||||
#undef HAVE___ARGZ_NEXT
|
||||
|
||||
/* Define to 1 if you have the `__argz_stringify' function. */
|
||||
#undef HAVE___ARGZ_STRINGIFY
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* 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 to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Configured target name. */
|
||||
#undef TARGET
|
||||
|
||||
/* Define to 1 if user symbol names have a leading underscore, 0 if not. */
|
||||
#undef TARGET_PREPENDS_UNDERSCORE
|
||||
|
||||
/* Use b modifier when opening binary files? */
|
||||
#undef USE_BINARY_FOPEN
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
|
||||
`char[]'. */
|
||||
#undef YYTEXT_POINTER
|
||||
|
||||
/* Enable GNU extensions on systems that have them. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# undef _GNU_SOURCE
|
||||
#endif
|
||||
|
||||
/* Enable LFS */
|
||||
#undef _LARGEFILE64_SOURCE
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
#undef inline
|
||||
#endif
|
||||
|
||||
/* Define to `long' if <sys/types.h> does not define. */
|
||||
#undef off_t
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
||||
12042
binutils/configure
vendored
12042
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,356 +0,0 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl
|
||||
AC_PREREQ(2.57)
|
||||
AC_INIT(ar.c)
|
||||
|
||||
AC_CANONICAL_SYSTEM
|
||||
AC_ISC_POSIX
|
||||
|
||||
changequote(,)dnl
|
||||
BFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[ ]*\([^ ]*\)[ ]*).*/\1/p' < ${srcdir}/../bfd/configure.in`
|
||||
changequote([,])dnl
|
||||
AM_INIT_AUTOMAKE(binutils, ${BFD_VERSION})
|
||||
|
||||
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
|
||||
|
||||
AM_BINUTILS_WARNINGS
|
||||
|
||||
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_GNU_SOURCE
|
||||
|
||||
AC_PROG_YACC
|
||||
AM_PROG_LEX
|
||||
|
||||
ALL_LINGUAS="fr tr ja es sv da zh_CN ru ro rw zh_TW"
|
||||
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 setmode getc_unlocked strcoll)
|
||||
|
||||
# Check whether fopen64 is available and whether _LARGEFILE64_SOURCE
|
||||
# needs to be defined for it
|
||||
AC_MSG_CHECKING([for fopen64])
|
||||
AC_CACHE_VAL(bu_cv_have_fopen64,
|
||||
[AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");],
|
||||
bu_cv_have_fopen64=yes,
|
||||
[saved_CPPFLAGS=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
|
||||
AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");],
|
||||
bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE",
|
||||
bu_cv_have_fopen64=no)
|
||||
CPPFLAGS=$saved_CPPFLAGS])])
|
||||
AC_MSG_RESULT($bu_cv_have_fopen64)
|
||||
if test "$bu_cv_have_fopen64" != no; then
|
||||
AC_DEFINE([HAVE_FOPEN64], 1,
|
||||
[Is fopen64 available?])
|
||||
fi
|
||||
AC_MSG_CHECKING([for stat64])
|
||||
AC_CACHE_VAL(bu_cv_have_stat64,
|
||||
[AC_TRY_LINK([#include <sys/stat.h>], [struct stat64 st; stat64 ("/tmp/foo", &st);],
|
||||
bu_cv_have_stat64=yes,
|
||||
[saved_CPPFLAGS=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
|
||||
AC_TRY_LINK([#include <sys/stat.h>], [struct stat64 st; stat64 ("/tmp/foo", &st);],
|
||||
bu_cv_have_stat64="need -D_LARGEFILE64_SOURCE",
|
||||
bu_cv_have_stat64=no)
|
||||
CPPFLAGS=$saved_CPPFLAGS])])
|
||||
AC_MSG_RESULT($bu_cv_have_stat64)
|
||||
if test "$bu_cv_have_stat64" != no; then
|
||||
AC_DEFINE([HAVE_STAT64], 1,
|
||||
[Is stat64 available?])
|
||||
fi
|
||||
if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE" \
|
||||
|| test "$bu_cv_have_stat64" = "need -D_LARGEFILE64_SOURCE"; then
|
||||
AC_DEFINE([_LARGEFILE64_SOURCE], 1,
|
||||
[Enable LFS])
|
||||
CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
|
||||
fi
|
||||
|
||||
# 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
|
||||
|
||||
AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
|
||||
AC_CACHE_VAL(bu_cv_decl_getopt_unistd_h,
|
||||
[AC_TRY_COMPILE([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);],
|
||||
bu_cv_decl_getopt_unistd_h=yes, bu_cv_decl_getopt_unistd_h=no)])
|
||||
AC_MSG_RESULT($bu_cv_decl_getopt_unistd_h)
|
||||
if test $bu_cv_decl_getopt_unistd_h = yes; then
|
||||
AC_DEFINE([HAVE_DECL_GETOPT], 1,
|
||||
[Is the prototype for getopt in <unistd.h> in the expected format?])
|
||||
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
|
||||
|
||||
AC_CHECK_DECLS([fprintf, stpcpy, strstr, sbrk, getenv, environ, getc_unlocked])
|
||||
|
||||
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=
|
||||
OBJDUMP_DEFS=
|
||||
|
||||
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[3-7]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-epoc-pe*)
|
||||
BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
|
||||
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_EPOC -DDLLTOOL_ARM"
|
||||
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
|
||||
;;
|
||||
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)'
|
||||
;;
|
||||
arm*-* | xscale-* | strongarm-* | d10v-*)
|
||||
OBJDUMP_DEFS="-DDISASSEMBLER_NEEDS_RELOCS"
|
||||
;;
|
||||
changequote(,)dnl
|
||||
i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*)
|
||||
changequote([,])dnl
|
||||
BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
|
||||
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
|
||||
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
|
||||
BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
|
||||
;;
|
||||
changequote(,)dnl
|
||||
i[3-7]86-*-interix)
|
||||
changequote([,])dnl
|
||||
BUILD_DLLTOOL='$(DLLTOOL_PROG)'
|
||||
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
|
||||
;;
|
||||
changequote(,)dnl
|
||||
powerpc*-aix5.[01])
|
||||
changequote([,])dnl
|
||||
;;
|
||||
powerpc*-aix5.*)
|
||||
OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT"
|
||||
;;
|
||||
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
|
||||
|
||||
if test "${with_windres+set}" = set; then
|
||||
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
|
||||
fi
|
||||
|
||||
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_SUBST(OBJDUMP_DEFS)
|
||||
|
||||
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_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE,
|
||||
[Define to 1 if user symbol names have a leading underscore, 0 if not.])
|
||||
|
||||
# Emulation
|
||||
for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
|
||||
do
|
||||
# Canonicalize the secondary target names.
|
||||
result=`$ac_config_sub $targ_alias 2>/dev/null`
|
||||
if test -n "$result"; then
|
||||
targ=$result
|
||||
else
|
||||
targ=$targ_alias
|
||||
fi
|
||||
|
||||
. ${srcdir}/configure.tgt
|
||||
|
||||
EMULATION=$targ_emul
|
||||
EMULATION_VECTOR=$targ_emul_vector
|
||||
done
|
||||
|
||||
AC_SUBST(EMULATION)
|
||||
AC_SUBST(EMULATION_VECTOR)
|
||||
|
||||
AC_OUTPUT(Makefile doc/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,26 +0,0 @@
|
||||
# This is the binutils target specific file. This is invoked by the
|
||||
# autoconf generated configure script. Putting it in a separate shell
|
||||
# file lets us skip running autoconf when modifying target specific
|
||||
# information.
|
||||
|
||||
# This file switches on the shell variable ${targ}, and sets the
|
||||
# following shell variables:
|
||||
# targ_emul name of emulation to use
|
||||
# targ_emul_vector name of vector to use
|
||||
|
||||
case "${targ}" in
|
||||
powerpc-*-aix5* | rs6000-*-aix5*)
|
||||
targ_emul=aix
|
||||
targ_emul_vector=bin_aix5_emulation
|
||||
;;
|
||||
|
||||
powerpc-*-aix4.3* | rs6000-*-aix4.3*)
|
||||
targ_emul=aix
|
||||
targ_emul_vector=bin_aix_emulation
|
||||
;;
|
||||
|
||||
*)
|
||||
targ_emul=vanilla
|
||||
targ_emul_vector=bin_vanilla_emulation
|
||||
;;
|
||||
esac
|
||||
@@ -1,285 +0,0 @@
|
||||
/* Demangler for GNU C++ - main program
|
||||
Copyright 1989, 1991, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
|
||||
Written by James Clark (jjc@jclark.uucp)
|
||||
Rewritten by Fred Fish (fnf@cygnus.com) for ARM and Lucid demangling
|
||||
Modified by Satish Pai (pai@apollo.hp.com) for HP demangling
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC 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.
|
||||
|
||||
GCC 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 GCC; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
02110-1301, USA. */
|
||||
|
||||
#include "config.h"
|
||||
#include "bfd.h"
|
||||
#include "bucomm.h"
|
||||
#include "libiberty.h"
|
||||
#include "demangle.h"
|
||||
#include "getopt.h"
|
||||
#include "safe-ctype.h"
|
||||
|
||||
static int flags = DMGL_PARAMS | DMGL_ANSI | DMGL_VERBOSE;
|
||||
static int strip_underscore = TARGET_PREPENDS_UNDERSCORE;
|
||||
|
||||
static const struct option long_options[] =
|
||||
{
|
||||
{"strip-underscore", no_argument, NULL, '_'},
|
||||
{"format", required_argument, NULL, 's'},
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{"no-params", no_argument, NULL, 'p'},
|
||||
{"no-strip-underscores", no_argument, NULL, 'n'},
|
||||
{"no-verbose", no_argument, NULL, 'i'},
|
||||
{"types", no_argument, NULL, 't'},
|
||||
{"version", no_argument, NULL, 'v'},
|
||||
{NULL, no_argument, NULL, 0}
|
||||
};
|
||||
|
||||
static void
|
||||
demangle_it (char *mangled_name)
|
||||
{
|
||||
char *result;
|
||||
unsigned int skip_first = 0;
|
||||
|
||||
/* _ and $ are sometimes found at the start of function names
|
||||
in assembler sources in order to distinguish them from other
|
||||
names (eg register names). So skip them here. */
|
||||
if (mangled_name[0] == '.' || mangled_name[0] == '$')
|
||||
++skip_first;
|
||||
if (strip_underscore && mangled_name[skip_first] == '_')
|
||||
++skip_first;
|
||||
|
||||
result = cplus_demangle (mangled_name + skip_first, flags);
|
||||
|
||||
if (result == NULL)
|
||||
printf (mangled_name);
|
||||
else
|
||||
{
|
||||
if (mangled_name[0] == '.')
|
||||
putchar ('.');
|
||||
printf (result);
|
||||
free (result);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
print_demangler_list (FILE *stream)
|
||||
{
|
||||
const struct demangler_engine *demangler;
|
||||
|
||||
fprintf (stream, "{%s", libiberty_demanglers->demangling_style_name);
|
||||
|
||||
for (demangler = libiberty_demanglers + 1;
|
||||
demangler->demangling_style != unknown_demangling;
|
||||
++demangler)
|
||||
fprintf (stream, ",%s", demangler->demangling_style_name);
|
||||
|
||||
fprintf (stream, "}");
|
||||
}
|
||||
|
||||
static void
|
||||
usage (FILE *stream, int status)
|
||||
{
|
||||
fprintf (stream, "\
|
||||
Usage: %s [options] [mangled names]\n", program_name);
|
||||
fprintf (stream, "\
|
||||
Options are:\n\
|
||||
[-_|--strip-underscore] Ignore first leading underscore%s\n",
|
||||
TARGET_PREPENDS_UNDERSCORE ? " (default)" : "");
|
||||
fprintf (stream, "\
|
||||
[-n|--no-strip-underscore] Do not ignore a leading underscore%s\n",
|
||||
TARGET_PREPENDS_UNDERSCORE ? "" : " (default)");
|
||||
fprintf (stream, "\
|
||||
[-p|--no-params] Do not display function arguments\n\
|
||||
[-i|--no-verbose] Do not show implementation details (if any)\n\
|
||||
[-t|--types] Also attempt to demangle type encodings\n\
|
||||
[-s|--format ");
|
||||
print_demangler_list (stream);
|
||||
fprintf (stream, "]\n");
|
||||
|
||||
fprintf (stream, "\
|
||||
[@<file>] Read extra options from <file>\n\
|
||||
[-h|--help] Display this information\n\
|
||||
[-v|--version] Show the version information\n\
|
||||
Demangled names are displayed to stdout.\n\
|
||||
If a name cannot be demangled it is just echoed to stdout.\n\
|
||||
If no names are provided on the command line, stdin is read.\n");
|
||||
exit (status);
|
||||
}
|
||||
|
||||
/* Return the string of non-alnum characters that may occur
|
||||
as a valid symbol component, in the standard assembler symbol
|
||||
syntax. */
|
||||
|
||||
static const char *
|
||||
standard_symbol_characters (void)
|
||||
{
|
||||
return "_$.";
|
||||
}
|
||||
|
||||
/* Return the string of non-alnum characters that may occur
|
||||
as a valid symbol name component in an HP object file.
|
||||
|
||||
Note that, since HP's compiler generates object code straight from
|
||||
C++ source, without going through an assembler, its mangled
|
||||
identifiers can use all sorts of characters that no assembler would
|
||||
tolerate, so the alphabet this function creates is a little odd.
|
||||
Here are some sample mangled identifiers offered by HP:
|
||||
|
||||
typeid*__XT24AddressIndExpClassMember_
|
||||
[Vftptr]key:__dt__32OrdinaryCompareIndExpClassMemberFv
|
||||
__ct__Q2_9Elf64_Dyn18{unnamed.union.#1}Fv
|
||||
|
||||
This still seems really weird to me, since nowhere else in this
|
||||
file is there anything to recognize curly brackets, parens, etc.
|
||||
I've talked with Srikanth <srikanth@cup.hp.com>, and he assures me
|
||||
this is right, but I still strongly suspect that there's a
|
||||
misunderstanding here.
|
||||
|
||||
If we decide it's better for c++filt to use HP's assembler syntax
|
||||
to scrape identifiers out of its input, here's the definition of
|
||||
the symbol name syntax from the HP assembler manual:
|
||||
|
||||
Symbols are composed of uppercase and lowercase letters, decimal
|
||||
digits, dollar symbol, period (.), ampersand (&), pound sign(#) and
|
||||
underscore (_). A symbol can begin with a letter, digit underscore or
|
||||
dollar sign. If a symbol begins with a digit, it must contain a
|
||||
non-digit character.
|
||||
|
||||
So have fun. */
|
||||
static const char *
|
||||
hp_symbol_characters (void)
|
||||
{
|
||||
return "_$.<>#,*&[]:(){}";
|
||||
}
|
||||
|
||||
extern int main (int, char **);
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
const char *valid_symbols;
|
||||
enum demangling_styles style = auto_demangling;
|
||||
|
||||
program_name = argv[0];
|
||||
xmalloc_set_program_name (program_name);
|
||||
|
||||
expandargv (&argc, &argv);
|
||||
|
||||
while ((c = getopt_long (argc, argv, "_hinps:tv", long_options, (int *) 0)) != EOF)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case '?':
|
||||
usage (stderr, 1);
|
||||
break;
|
||||
case 'h':
|
||||
usage (stdout, 0);
|
||||
case 'n':
|
||||
strip_underscore = 0;
|
||||
break;
|
||||
case 'p':
|
||||
flags &= ~ DMGL_PARAMS;
|
||||
break;
|
||||
case 't':
|
||||
flags |= DMGL_TYPES;
|
||||
break;
|
||||
case 'i':
|
||||
flags &= ~ DMGL_VERBOSE;
|
||||
break;
|
||||
case 'v':
|
||||
print_version ("c++filt");
|
||||
return 0;
|
||||
case '_':
|
||||
strip_underscore = 1;
|
||||
break;
|
||||
case 's':
|
||||
style = cplus_demangle_name_to_style (optarg);
|
||||
if (style == unknown_demangling)
|
||||
{
|
||||
fprintf (stderr, "%s: unknown demangling style `%s'\n",
|
||||
program_name, optarg);
|
||||
return 1;
|
||||
}
|
||||
cplus_demangle_set_style (style);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (optind < argc)
|
||||
{
|
||||
for ( ; optind < argc; optind++)
|
||||
{
|
||||
demangle_it (argv[optind]);
|
||||
putchar ('\n');
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (current_demangling_style)
|
||||
{
|
||||
case gnu_demangling:
|
||||
case lucid_demangling:
|
||||
case arm_demangling:
|
||||
case java_demangling:
|
||||
case edg_demangling:
|
||||
case gnat_demangling:
|
||||
case gnu_v3_demangling:
|
||||
case auto_demangling:
|
||||
valid_symbols = standard_symbol_characters ();
|
||||
break;
|
||||
case hp_demangling:
|
||||
valid_symbols = hp_symbol_characters ();
|
||||
break;
|
||||
default:
|
||||
/* Folks should explicitly indicate the appropriate alphabet for
|
||||
each demangling. Providing a default would allow the
|
||||
question to go unconsidered. */
|
||||
fatal ("Internal error: no symbol alphabet for current style");
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
static char mbuffer[32767];
|
||||
unsigned i = 0;
|
||||
|
||||
c = getchar ();
|
||||
/* Try to read a mangled name. */
|
||||
while (c != EOF && (ISALNUM (c) || strchr (valid_symbols, c)))
|
||||
{
|
||||
if (i >= sizeof (mbuffer) - 1)
|
||||
break;
|
||||
mbuffer[i++] = c;
|
||||
c = getchar ();
|
||||
}
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
mbuffer[i] = 0;
|
||||
demangle_it (mbuffer);
|
||||
}
|
||||
|
||||
if (c == EOF)
|
||||
break;
|
||||
|
||||
/* Echo the whitespace characters so that the output looks
|
||||
like the input, only with the mangled names demangled. */
|
||||
putchar (c);
|
||||
}
|
||||
|
||||
fflush (stdout);
|
||||
return 0;
|
||||
}
|
||||
3373
binutils/debug.c
3373
binutils/debug.c
File diff suppressed because it is too large
Load Diff
792
binutils/debug.h
792
binutils/debug.h
@@ -1,792 +0,0 @@
|
||||
/* debug.h -- Describe generic debugging information.
|
||||
Copyright 1995, 1996, 2002, 2003 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., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
02110-1301, 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 converter 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. */
|
||||
bfd_boolean (*start_compilation_unit) (void *, 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. */
|
||||
bfd_boolean (*start_source) (void *, 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. */
|
||||
bfd_boolean (*empty_type) (void *);
|
||||
|
||||
/* Push a void type onto the type stack. */
|
||||
bfd_boolean (*void_type) (void *);
|
||||
|
||||
/* Push an integer type onto the type stack, given the size and
|
||||
whether it is unsigned. */
|
||||
bfd_boolean (*int_type) (void *, unsigned int, bfd_boolean);
|
||||
|
||||
/* Push a floating type onto the type stack, given the size. */
|
||||
bfd_boolean (*float_type) (void *, unsigned int);
|
||||
|
||||
/* Push a complex type onto the type stack, given the size. */
|
||||
bfd_boolean (*complex_type) (void *, unsigned int);
|
||||
|
||||
/* Push a bfd_boolean type onto the type stack, given the size. */
|
||||
bfd_boolean (*bool_type) (void *, 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. */
|
||||
bfd_boolean (*enum_type)
|
||||
(void *, 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. */
|
||||
bfd_boolean (*pointer_type) (void *);
|
||||
|
||||
/* 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. */
|
||||
bfd_boolean (*function_type) (void *, int, bfd_boolean);
|
||||
|
||||
/* Pop the top type on the type stack, and push a reference to that
|
||||
type onto the type stack. */
|
||||
bfd_boolean (*reference_type) (void *);
|
||||
|
||||
/* 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. */
|
||||
bfd_boolean (*range_type) (void *, 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. */
|
||||
bfd_boolean (*array_type)
|
||||
(void *, bfd_signed_vma, bfd_signed_vma, bfd_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. */
|
||||
bfd_boolean (*set_type) (void *, bfd_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. */
|
||||
bfd_boolean (*offset_type) (void *);
|
||||
|
||||
/* 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. */
|
||||
bfd_boolean (*method_type) (void *, bfd_boolean, int, bfd_boolean);
|
||||
|
||||
/* Pop the top type off the type stack, and push a const qualified
|
||||
version of that type onto the type stack. */
|
||||
bfd_boolean (*const_type) (void *);
|
||||
|
||||
/* Pop the top type off the type stack, and push a volatile
|
||||
qualified version of that type onto the type stack. */
|
||||
bfd_boolean (*volatile_type) (void *);
|
||||
|
||||
/* 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. */
|
||||
bfd_boolean (*start_struct_type)
|
||||
(void *, const char *, unsigned int, bfd_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. */
|
||||
bfd_boolean (*struct_field)
|
||||
(void *, const char *, bfd_vma, bfd_vma, enum debug_visibility);
|
||||
|
||||
/* Finish building a struct, and push it onto the type stack. */
|
||||
bfd_boolean (*end_struct_type) (void *);
|
||||
|
||||
/* 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. */
|
||||
bfd_boolean (*start_class_type)
|
||||
(void *, const char *, unsigned int, bfd_boolean, unsigned int,
|
||||
bfd_boolean, bfd_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. */
|
||||
bfd_boolean (*class_static_member)
|
||||
(void *, 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. */
|
||||
bfd_boolean (*class_baseclass)
|
||||
(void *, bfd_vma, bfd_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. */
|
||||
bfd_boolean (*class_start_method) (void *, 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). */
|
||||
bfd_boolean (*class_method_variant)
|
||||
(void *, const char *, enum debug_visibility, bfd_boolean,
|
||||
bfd_boolean, bfd_vma, bfd_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. */
|
||||
bfd_boolean (*class_static_method_variant)
|
||||
(void *, const char *, enum debug_visibility, bfd_boolean,
|
||||
bfd_boolean);
|
||||
|
||||
/* Finish describing a class method. */
|
||||
bfd_boolean (*class_end_method) (void *);
|
||||
|
||||
/* Finish describing a class, and push it onto the type stack. */
|
||||
bfd_boolean (*end_class_type) (void *);
|
||||
|
||||
/* Push a type on the stack which was given a name by an earlier
|
||||
call to typdef. */
|
||||
bfd_boolean (*typedef_type) (void *, 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). */
|
||||
bfd_boolean (*tag_type)
|
||||
(void *, const char *, unsigned int, enum debug_type_kind);
|
||||
|
||||
/* Pop the type stack, and typedef it to the given name. */
|
||||
bfd_boolean (*typdef) (void *, 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. */
|
||||
bfd_boolean (*tag) (void *, const char *);
|
||||
|
||||
/* This is called to record a named integer constant. */
|
||||
bfd_boolean (*int_constant) (void *, const char *, bfd_vma);
|
||||
|
||||
/* This is called to record a named floating point constant. */
|
||||
bfd_boolean (*float_constant) (void *, const char *, double);
|
||||
|
||||
/* This is called to record a typed integer constant. The type is
|
||||
popped off the type stack. */
|
||||
bfd_boolean (*typed_constant) (void *, const char *, bfd_vma);
|
||||
|
||||
/* This is called to record a variable. The type is popped off the
|
||||
type stack. */
|
||||
bfd_boolean (*variable)
|
||||
(void *, const char *, enum debug_var_kind, bfd_vma);
|
||||
|
||||
/* Start writing out a function. The return type must be popped off
|
||||
the stack. The bfd_boolean is TRUE if the function is global. This
|
||||
is followed by calls to function_parameter, followed by block
|
||||
information. */
|
||||
bfd_boolean (*start_function) (void *, const char *, bfd_boolean);
|
||||
|
||||
/* Record a function parameter for the current function. The type
|
||||
must be popped off the stack. */
|
||||
bfd_boolean (*function_parameter)
|
||||
(void *, 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. */
|
||||
bfd_boolean (*start_block) (void *, bfd_vma);
|
||||
|
||||
/* Finish writing out a block. The argument is the ending address
|
||||
of the block. */
|
||||
bfd_boolean (*end_block) (void *, bfd_vma);
|
||||
|
||||
/* Finish writing out a function. */
|
||||
bfd_boolean (*end_function) (void *);
|
||||
|
||||
/* Record line number information for the current compilation unit. */
|
||||
bfd_boolean (*lineno) (void *, 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 void *debug_init (void);
|
||||
|
||||
/* Set the source filename. This implicitly starts a new compilation
|
||||
unit. */
|
||||
|
||||
extern bfd_boolean debug_set_filename (void *, const char *);
|
||||
|
||||
/* Change source files to the given file name. This is used for
|
||||
include files in a single compilation unit. */
|
||||
|
||||
extern bfd_boolean debug_start_source (void *, const char *);
|
||||
|
||||
/* Record a function definition. This implicitly starts a function
|
||||
block. The debug_type argument is the type of the return value.
|
||||
The bfd_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 bfd_boolean debug_record_function
|
||||
(void *, const char *, debug_type, bfd_boolean, bfd_vma);
|
||||
|
||||
/* Record a parameter for the current function. */
|
||||
|
||||
extern bfd_boolean debug_record_parameter
|
||||
(void *, const char *, debug_type, enum debug_parm_kind, bfd_vma);
|
||||
|
||||
/* End a function definition. The argument is the address where the
|
||||
function ends. */
|
||||
|
||||
extern bfd_boolean debug_end_function (void *, 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 bfd_boolean debug_start_block (void *, 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 bfd_boolean debug_end_block (void *, bfd_vma);
|
||||
|
||||
/* Associate a line number in the current source file with a given
|
||||
address. */
|
||||
|
||||
extern bfd_boolean debug_record_line (void *, unsigned long, bfd_vma);
|
||||
|
||||
/* Start a named common block. This is a block of variables that may
|
||||
move in memory. */
|
||||
|
||||
extern bfd_boolean debug_start_common_block (void *, const char *);
|
||||
|
||||
/* End a named common block. */
|
||||
|
||||
extern bfd_boolean debug_end_common_block (void *, const char *);
|
||||
|
||||
/* Record a named integer constant. */
|
||||
|
||||
extern bfd_boolean debug_record_int_const (void *, const char *, bfd_vma);
|
||||
|
||||
/* Record a named floating point constant. */
|
||||
|
||||
extern bfd_boolean debug_record_float_const (void *, const char *, double);
|
||||
|
||||
/* Record a typed constant with an integral value. */
|
||||
|
||||
extern bfd_boolean debug_record_typed_const
|
||||
(void *, const char *, debug_type, bfd_vma);
|
||||
|
||||
/* Record a label. */
|
||||
|
||||
extern bfd_boolean debug_record_label
|
||||
(void *, const char *, debug_type, bfd_vma);
|
||||
|
||||
/* Record a variable. */
|
||||
|
||||
extern bfd_boolean debug_record_variable
|
||||
(void *, 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
|
||||
(void *, debug_type *, const char *);
|
||||
|
||||
/* Make a void type. */
|
||||
|
||||
extern debug_type debug_make_void_type (void *);
|
||||
|
||||
/* Make an integer type of a given size. The bfd_boolean argument is TRUE
|
||||
if the integer is unsigned. */
|
||||
|
||||
extern debug_type debug_make_int_type (void *, unsigned int, bfd_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 (void *, unsigned int);
|
||||
|
||||
/* Make a boolean type of a given size. */
|
||||
|
||||
extern debug_type debug_make_bool_type (void *, unsigned int);
|
||||
|
||||
/* Make a complex type of a given size. */
|
||||
|
||||
extern debug_type debug_make_complex_type (void *, 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
|
||||
(void *, bfd_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 bfd_boolean which is TRUE if this
|
||||
object has its own virtual function table. */
|
||||
|
||||
extern debug_type debug_make_object_type
|
||||
(void *, bfd_boolean, bfd_vma, debug_field *, debug_baseclass *,
|
||||
debug_method *, debug_type, bfd_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
|
||||
(void *, const char **, bfd_signed_vma *);
|
||||
|
||||
/* Make a pointer to a given type. */
|
||||
|
||||
extern debug_type debug_make_pointer_type (void *, 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
|
||||
(void *, debug_type, debug_type *, bfd_boolean);
|
||||
|
||||
/* Make a reference to a given type. */
|
||||
|
||||
extern debug_type debug_make_reference_type (void *, debug_type);
|
||||
|
||||
/* Make a range of a given type from a lower to an upper bound. */
|
||||
|
||||
extern debug_type debug_make_range_type
|
||||
(void *, 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
|
||||
(void *, debug_type, debug_type, bfd_signed_vma, bfd_signed_vma,
|
||||
bfd_boolean);
|
||||
|
||||
/* Make a set of a given type. For example, a Pascal set type. The
|
||||
bfd_boolean argument is TRUE if this set is actually a bitstring, as in
|
||||
CHILL. */
|
||||
|
||||
extern debug_type debug_make_set_type (void *, debug_type, bfd_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 (void *, 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
|
||||
(void *, debug_type, debug_type, debug_type *, bfd_boolean);
|
||||
|
||||
/* Make a const qualified version of a given type. */
|
||||
|
||||
extern debug_type debug_make_const_type (void *, debug_type);
|
||||
|
||||
/* Make a volatile qualified version of a given type. */
|
||||
|
||||
extern debug_type debug_make_volatile_type (void *, 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
|
||||
(void *, 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
|
||||
(void *, debug_type, bfd_vma, bfd_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
|
||||
(void *, 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
|
||||
(void *, 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
|
||||
(void *, 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
|
||||
(void *, const char *, debug_type, enum debug_visibility, bfd_boolean,
|
||||
bfd_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
|
||||
(void *, const char *, debug_type, enum debug_visibility, bfd_boolean,
|
||||
bfd_boolean);
|
||||
|
||||
/* Name a type. This returns a new type with an attached name. */
|
||||
|
||||
extern debug_type debug_name_type (void *, 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 (void *, const char *, debug_type);
|
||||
|
||||
/* Record the size of a given type. */
|
||||
|
||||
extern bfd_boolean debug_record_type_size (void *, debug_type, unsigned int);
|
||||
|
||||
/* Find a named type. */
|
||||
|
||||
extern debug_type debug_find_named_type (void *, const char *);
|
||||
|
||||
/* Find a tagged type. */
|
||||
|
||||
extern debug_type debug_find_tagged_type
|
||||
(void *, const char *, enum debug_type_kind);
|
||||
|
||||
/* Get the kind of a type. */
|
||||
|
||||
extern enum debug_type_kind debug_get_type_kind (void *, debug_type);
|
||||
|
||||
/* Get the name of a type. */
|
||||
|
||||
extern const char *debug_get_type_name (void *, debug_type);
|
||||
|
||||
/* Get the size of a type. */
|
||||
|
||||
extern bfd_vma debug_get_type_size (void *, debug_type);
|
||||
|
||||
/* Get the return type of a function or method type. */
|
||||
|
||||
extern debug_type debug_get_return_type (void *, 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
|
||||
bfd_boolean which is set to TRUE if the function takes a variable
|
||||
number of arguments. */
|
||||
|
||||
extern const debug_type *debug_get_parameter_types
|
||||
(void *, debug_type, bfd_boolean *);
|
||||
|
||||
/* Get the target type of a pointer or reference or const or volatile
|
||||
type. */
|
||||
|
||||
extern debug_type debug_get_target_type (void *, debug_type);
|
||||
|
||||
/* Get the NULL terminated array of fields for a struct, union, or
|
||||
class. */
|
||||
|
||||
extern const debug_field *debug_get_fields (void *, debug_type);
|
||||
|
||||
/* Get the type of a field. */
|
||||
|
||||
extern debug_type debug_get_field_type (void *, debug_field);
|
||||
|
||||
/* Get the name of a field. */
|
||||
|
||||
extern const char *debug_get_field_name (void *, 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 (void *, 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 (void *, debug_field);
|
||||
|
||||
/* Get the visibility of a field. */
|
||||
|
||||
extern enum debug_visibility debug_get_field_visibility (void *, 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 (void *, 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 void * is the debugging handle. The second void * is a handle
|
||||
which is passed to the functions. */
|
||||
|
||||
extern bfd_boolean debug_write
|
||||
(void *, const struct debug_write_fns *, void *);
|
||||
|
||||
#endif /* DEBUG_H */
|
||||
@@ -1,96 +0,0 @@
|
||||
%{/* deflex.l - Lexer for .def files */
|
||||
|
||||
/* Copyright 1995, 1997, 1998, 1999, 2002, 2003, 2004, 2005
|
||||
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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
|
||||
/* Contributed by Steve Chamberlain: sac@cygnus.com */
|
||||
|
||||
#define DONTDECLARE_MALLOC
|
||||
#include "libiberty.h"
|
||||
#include "defparse.h"
|
||||
#include "dlltool.h"
|
||||
|
||||
#define YY_NO_UNPUT
|
||||
|
||||
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; }
|
||||
"PRIVATE" { return PRIVATE; }
|
||||
"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" { }
|
||||
"\r" { }
|
||||
"\n" { linenumber ++ ;}
|
||||
"=" { return '=';}
|
||||
"." { return '.';}
|
||||
"@" { return '@';}
|
||||
"," { return ',';}
|
||||
%%
|
||||
#ifndef yywrap
|
||||
/* Needed for lex, though not flex. */
|
||||
int yywrap(void) { return 1; }
|
||||
#endif
|
||||
@@ -1,181 +0,0 @@
|
||||
%{ /* defparse.y - parser for .def files */
|
||||
|
||||
/* Copyright 1995, 1997, 1998, 1999, 2001, 2004
|
||||
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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, 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 PRIVATE
|
||||
%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 opt_PRIVATE
|
||||
%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 opt_PRIVATE
|
||||
{ def_exports ($1, $2, $3, $4, $5, $6, $7);}
|
||||
;
|
||||
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_PRIVATE:
|
||||
PRIVATE { $$ = 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; }
|
||||
| '=' ID '.' ID
|
||||
{
|
||||
char *name = xmalloc (strlen ($2) + 1 + strlen ($4) + 1);
|
||||
sprintf (name, "%s.%s", $2, $4);
|
||||
$$ = name;
|
||||
}
|
||||
| { $$ = 0; }
|
||||
;
|
||||
|
||||
opt_base: BASE '=' NUMBER { $$= $3;}
|
||||
| { $$=-1;}
|
||||
;
|
||||
|
||||
option_list:
|
||||
/* empty */
|
||||
| option_list opt_comma option
|
||||
;
|
||||
|
||||
option:
|
||||
INITINSTANCE
|
||||
| INITGLOBAL
|
||||
| TERMINSTANCE
|
||||
| TERMGLOBAL
|
||||
;
|
||||
@@ -1,20 +0,0 @@
|
||||
:loop
|
||||
/\\$/N
|
||||
/\\$/b loop
|
||||
|
||||
s!@INCDIR@!$(INCDIR)!g
|
||||
s!@TOPDIR@/include!$(INCDIR)!g
|
||||
s!@BFDDIR@!$(BFDDIR)!g
|
||||
s!@TOPDIR@/bfd!$(BFDDIR)!g
|
||||
s!@SRCDIR@/!!g
|
||||
s!@OBJDIR@/!!g
|
||||
s! \.\./intl/libintl\.h!!g
|
||||
|
||||
s/\\\n */ /g
|
||||
|
||||
s/ *$//
|
||||
s/ */ /g
|
||||
/:$/d
|
||||
|
||||
s/\(.\{50\}[^ ]*\) /\1 \\\
|
||||
/g
|
||||
3566
binutils/dlltool.c
3566
binutils/dlltool.c
File diff suppressed because it is too large
Load Diff
@@ -1,42 +0,0 @@
|
||||
/* dlltool.h -- header file for dlltool
|
||||
Copyright 1997, 1998, 2003, 2004 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., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
02110-1301, USA. */
|
||||
|
||||
#include "ansidecl.h"
|
||||
#include <stdio.h>
|
||||
|
||||
extern void def_code (int);
|
||||
extern void def_data (int);
|
||||
extern void def_description (const char *);
|
||||
extern void def_exports (const char *, const char *, int, int, int, int, int);
|
||||
extern void def_heapsize (int, int);
|
||||
extern void def_import
|
||||
(const char *, const char *, const char *, const char *, int);
|
||||
extern void def_library (const char *, int);
|
||||
extern void def_name (const char *, int);
|
||||
extern void def_section (const char *, int);
|
||||
extern void def_stacksize (int, int);
|
||||
extern void def_version (int, int);
|
||||
extern int yyparse (void);
|
||||
extern int yyerror (const char *);
|
||||
extern int yylex (void);
|
||||
|
||||
extern int yydebug;
|
||||
extern FILE *yyin;
|
||||
extern int linenumber;
|
||||
1207
binutils/dllwrap.c
1207
binutils/dllwrap.c
File diff suppressed because it is too large
Load Diff
@@ -1,163 +0,0 @@
|
||||
## Process this file with automake to generate Makefile.in
|
||||
|
||||
AUTOMAKE_OPTIONS = cygnus
|
||||
|
||||
# What version of the manual you want; "all" includes everything
|
||||
CONFIG=all
|
||||
|
||||
# Options to extract the man page from as.texinfo
|
||||
MANCONF = -Dman
|
||||
|
||||
TEXI2POD = perl $(top_srcdir)/../etc/texi2pod.pl
|
||||
|
||||
POD2MAN = pod2man --center="GNU Development Tools" \
|
||||
--release="binutils-$(VERSION)" --section=1
|
||||
|
||||
# List of man pages generated from binutils.texi
|
||||
man_MANS = \
|
||||
addr2line.1 \
|
||||
ar.1 \
|
||||
dlltool.1 \
|
||||
nlmconv.1 \
|
||||
nm.1 \
|
||||
objcopy.1 \
|
||||
objdump.1 \
|
||||
ranlib.1 \
|
||||
readelf.1 \
|
||||
size.1 \
|
||||
strings.1 \
|
||||
strip.1 \
|
||||
windres.1 \
|
||||
$(DEMANGLER_NAME).1
|
||||
|
||||
info_TEXINFOS = binutils.texi
|
||||
binutils_TEXINFOS = config.texi
|
||||
binutils_TEXI = $(srcdir)/binutils.texi
|
||||
|
||||
config.texi: $(srcdir)/../../bfd/configure $(binutils_TEXI)
|
||||
rm -f config.texi
|
||||
eval `grep '^ *VERSION=' $(srcdir)/../../bfd/configure`; \
|
||||
echo "@set VERSION $$VERSION" > $@
|
||||
echo "@set UPDATED `date "+%B %Y"`" >> config.texi
|
||||
echo "@set top_srcdir $(top_srcdir)" >> config.texi
|
||||
|
||||
# Man page generation from texinfo
|
||||
addr2line.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Daddr2line < $(binutils_TEXI) > addr2line.pod
|
||||
-($(POD2MAN) addr2line.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f addr2line.pod
|
||||
|
||||
ar.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dar < $(binutils_TEXI) > ar.pod
|
||||
-($(POD2MAN) ar.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f ar.pod
|
||||
|
||||
dlltool.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Ddlltool < $(binutils_TEXI) > dlltool.pod
|
||||
-($(POD2MAN) dlltool.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f dlltool.pod
|
||||
|
||||
nlmconv.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dnlmconv < $(binutils_TEXI) > nlmconv.pod
|
||||
-($(POD2MAN) nlmconv.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f nlmconv.pod
|
||||
|
||||
nm.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dnm < $(binutils_TEXI) > nm.pod
|
||||
-($(POD2MAN) nm.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f nm.pod
|
||||
|
||||
objcopy.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dobjcopy < $(binutils_TEXI) > objcopy.pod
|
||||
-($(POD2MAN) objcopy.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f objcopy.pod
|
||||
|
||||
objdump.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dobjdump < $(binutils_TEXI) > objdump.pod
|
||||
-($(POD2MAN) objdump.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f objdump.pod
|
||||
|
||||
ranlib.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dranlib < $(binutils_TEXI) > ranlib.pod
|
||||
-($(POD2MAN) ranlib.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f ranlib.pod
|
||||
|
||||
readelf.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dreadelf < $(binutils_TEXI) > readelf.pod
|
||||
-($(POD2MAN) readelf.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f readelf.pod
|
||||
|
||||
size.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dsize < $(binutils_TEXI) > size.pod
|
||||
-($(POD2MAN) size.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f size.pod
|
||||
|
||||
strings.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dstrings < $(binutils_TEXI) > strings.pod
|
||||
-($(POD2MAN) strings.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f strings.pod
|
||||
|
||||
strip.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dstrip < $(binutils_TEXI) > strip.pod
|
||||
-($(POD2MAN) strip.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f strip.pod
|
||||
|
||||
windres.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dwindres < $(binutils_TEXI) > windres.pod
|
||||
-($(POD2MAN) windres.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f windres.pod
|
||||
|
||||
cxxfilt.man: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dcxxfilt < $(binutils_TEXI) > $(DEMANGLER_NAME).pod
|
||||
-($(POD2MAN) $(DEMANGLER_NAME).pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f $(DEMANGLER_NAME).pod
|
||||
|
||||
MAINTAINERCLEANFILES = config.texi
|
||||
MOSTLYCLEANFILES = $(DEMANGLER_NAME).1
|
||||
|
||||
$(DEMANGLER_NAME).1: cxxfilt.man Makefile
|
||||
if test -f cxxfilt.man; then \
|
||||
man=cxxfilt.man; \
|
||||
else \
|
||||
man=$(srcdir)/cxxfilt.man; \
|
||||
fi; \
|
||||
sed -e 's/@PROGRAM@/$(DEMANGLER_NAME)/' \
|
||||
-e 's/cxxfilt/$(DEMANGLER_NAME)/' < $$man \
|
||||
> $(DEMANGLER_NAME).1
|
||||
|
||||
# We want install to imply install-info as per GNU standards, despite the
|
||||
# cygnus option.
|
||||
install-data-local: install-info
|
||||
|
||||
# Maintenance
|
||||
|
||||
# We need it for the taz target in ../../Makefile.in.
|
||||
info-local: $(MANS)
|
||||
@@ -1,694 +0,0 @@
|
||||
# Makefile.in generated by automake 1.9.5 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ..
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
subdir = doc
|
||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
||||
$(binutils_TEXINFOS)
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/../bfd/acinclude.m4 \
|
||||
$(top_srcdir)/../config/acx.m4 $(top_srcdir)/../bfd/bfd.m4 \
|
||||
$(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/../libtool.m4 \
|
||||
$(top_srcdir)/../gettext.m4 $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
depcomp =
|
||||
am__depfiles_maybe =
|
||||
SOURCES =
|
||||
INFO_DEPS = $(srcdir)/binutils.info
|
||||
TEXINFO_TEX = $(top_srcdir)/../texinfo/texinfo.tex
|
||||
am__TEXINFO_TEX_DIR = $(top_srcdir)/../texinfo
|
||||
DVIS = binutils.dvi
|
||||
PDFS = binutils.pdf
|
||||
PSS = binutils.ps
|
||||
HTMLS = binutils.html
|
||||
TEXINFOS = binutils.texi
|
||||
TEXI2DVI = `if test -f $(top_srcdir)/../texinfo/util/texi2dvi; then \
|
||||
echo $(top_srcdir)/../texinfo/util/texi2dvi; \
|
||||
else \
|
||||
echo texi2dvi; \
|
||||
fi`
|
||||
TEXI2PDF = $(TEXI2DVI) --pdf --batch
|
||||
MAKEINFOHTML = $(MAKEINFO) --html
|
||||
AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS)
|
||||
DVIPS = dvips
|
||||
man1dir = $(mandir)/man1
|
||||
am__installdirs = "$(DESTDIR)$(man1dir)"
|
||||
NROFF = nroff
|
||||
MANS = $(man_MANS)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALLOCA = @ALLOCA@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BUILD_DLLTOOL = @BUILD_DLLTOOL@
|
||||
BUILD_DLLWRAP = @BUILD_DLLWRAP@
|
||||
BUILD_MISC = @BUILD_MISC@
|
||||
BUILD_NLMCONV = @BUILD_NLMCONV@
|
||||
BUILD_SRCONV = @BUILD_SRCONV@
|
||||
BUILD_WINDRES = @BUILD_WINDRES@
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CC_FOR_BUILD = @CC_FOR_BUILD@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
DEFS = @DEFS@
|
||||
DEMANGLER_NAME = @DEMANGLER_NAME@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL_DEFS = @DLLTOOL_DEFS@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EMULATION = @EMULATION@
|
||||
EMULATION_VECTOR = @EMULATION_VECTOR@
|
||||
EXEEXT = @EXEEXT@
|
||||
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
|
||||
GMOFILES = @GMOFILES@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GT_NO = @GT_NO@
|
||||
GT_YES = @GT_YES@
|
||||
HDEFINES = @HDEFINES@
|
||||
INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
INTLDEPS = @INTLDEPS@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LEX = @LEX@
|
||||
LEXLIB = @LEXLIB@
|
||||
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
|
||||
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
NLMCONV_DEFS = @NLMCONV_DEFS@
|
||||
NO_WERROR = @NO_WERROR@
|
||||
OBJDUMP_DEFS = @OBJDUMP_DEFS@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
POFILES = @POFILES@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
WARN_CFLAGS = @WARN_CFLAGS@
|
||||
XGETTEXT = @XGETTEXT@
|
||||
YACC = @YACC@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
l = @l@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target = @target@
|
||||
target_alias = @target_alias@
|
||||
target_cpu = @target_cpu@
|
||||
target_os = @target_os@
|
||||
target_vendor = @target_vendor@
|
||||
AUTOMAKE_OPTIONS = cygnus
|
||||
|
||||
# What version of the manual you want; "all" includes everything
|
||||
CONFIG = all
|
||||
|
||||
# Options to extract the man page from as.texinfo
|
||||
MANCONF = -Dman
|
||||
TEXI2POD = perl $(top_srcdir)/../etc/texi2pod.pl
|
||||
POD2MAN = pod2man --center="GNU Development Tools" \
|
||||
--release="binutils-$(VERSION)" --section=1
|
||||
|
||||
|
||||
# List of man pages generated from binutils.texi
|
||||
man_MANS = \
|
||||
addr2line.1 \
|
||||
ar.1 \
|
||||
dlltool.1 \
|
||||
nlmconv.1 \
|
||||
nm.1 \
|
||||
objcopy.1 \
|
||||
objdump.1 \
|
||||
ranlib.1 \
|
||||
readelf.1 \
|
||||
size.1 \
|
||||
strings.1 \
|
||||
strip.1 \
|
||||
windres.1 \
|
||||
$(DEMANGLER_NAME).1
|
||||
|
||||
info_TEXINFOS = binutils.texi
|
||||
binutils_TEXINFOS = config.texi
|
||||
binutils_TEXI = $(srcdir)/binutils.texi
|
||||
MAINTAINERCLEANFILES = config.texi
|
||||
MOSTLYCLEANFILES = $(DEMANGLER_NAME).1
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .dvi .html .info .pdf .ps .texi
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign doc/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool
|
||||
|
||||
.texi.info:
|
||||
restore=: && backupdir="$(am__leading_dot)am$$$$" && \
|
||||
am__cwd=`pwd` && cd $(srcdir) && \
|
||||
rm -rf $$backupdir && mkdir $$backupdir && \
|
||||
for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \
|
||||
if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \
|
||||
done; \
|
||||
cd "$$am__cwd"; \
|
||||
if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
|
||||
-o $@ $<; \
|
||||
then \
|
||||
rc=0; \
|
||||
cd $(srcdir); \
|
||||
else \
|
||||
rc=$$?; \
|
||||
cd $(srcdir) && \
|
||||
$$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \
|
||||
fi; \
|
||||
rm -rf $$backupdir; exit $$rc
|
||||
|
||||
.texi.dvi:
|
||||
TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
|
||||
MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
|
||||
$(TEXI2DVI) $<
|
||||
|
||||
.texi.pdf:
|
||||
TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
|
||||
MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
|
||||
$(TEXI2PDF) $<
|
||||
|
||||
.texi.html:
|
||||
rm -rf $(@:.html=.htp)
|
||||
if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
|
||||
-o $(@:.html=.htp) $<; \
|
||||
then \
|
||||
rm -rf $@; \
|
||||
if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
|
||||
mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \
|
||||
else \
|
||||
if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
|
||||
rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \
|
||||
exit 1; \
|
||||
fi
|
||||
$(srcdir)/binutils.info: binutils.texi $(binutils_TEXINFOS)
|
||||
binutils.dvi: binutils.texi $(binutils_TEXINFOS)
|
||||
binutils.pdf: binutils.texi $(binutils_TEXINFOS)
|
||||
binutils.html: binutils.texi $(binutils_TEXINFOS)
|
||||
.dvi.ps:
|
||||
$(DVIPS) -o $@ $<
|
||||
|
||||
uninstall-info-am:
|
||||
@$(PRE_UNINSTALL)
|
||||
@if (install-info --version && \
|
||||
install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \
|
||||
list='$(INFO_DEPS)'; \
|
||||
for file in $$list; do \
|
||||
relfile=`echo "$$file" | sed 's|^.*/||'`; \
|
||||
echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \
|
||||
install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \
|
||||
done; \
|
||||
else :; fi
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(INFO_DEPS)'; \
|
||||
for file in $$list; do \
|
||||
relfile=`echo "$$file" | sed 's|^.*/||'`; \
|
||||
relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \
|
||||
(if cd "$(DESTDIR)$(infodir)"; then \
|
||||
echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \
|
||||
rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \
|
||||
else :; fi); \
|
||||
done
|
||||
|
||||
dist-info: $(INFO_DEPS)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(INFO_DEPS)'; \
|
||||
for base in $$list; do \
|
||||
case $$base in \
|
||||
$(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
esac; \
|
||||
if test -f $$base; then d=.; else d=$(srcdir); fi; \
|
||||
for file in $$d/$$base*; do \
|
||||
relfile=`expr "$$file" : "$$d/\(.*\)"`; \
|
||||
test -f $(distdir)/$$relfile || \
|
||||
cp -p $$file $(distdir)/$$relfile; \
|
||||
done; \
|
||||
done
|
||||
|
||||
mostlyclean-aminfo:
|
||||
-rm -rf binutils.aux binutils.cp binutils.cps binutils.fn binutils.fns \
|
||||
binutils.ky binutils.log binutils.pg binutils.pgs \
|
||||
binutils.tmp binutils.toc binutils.tp binutils.tps \
|
||||
binutils.vr binutils.vrs binutils.dvi binutils.pdf \
|
||||
binutils.ps binutils.html
|
||||
|
||||
maintainer-clean-aminfo:
|
||||
@list='$(INFO_DEPS)'; for i in $$list; do \
|
||||
i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \
|
||||
echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \
|
||||
rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \
|
||||
done
|
||||
|
||||
clean-info: mostlyclean-aminfo
|
||||
install-man1: $(man1_MANS) $(man_MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)"
|
||||
@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
|
||||
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
|
||||
for i in $$l2; do \
|
||||
case "$$i" in \
|
||||
*.1*) list="$$list $$i" ;; \
|
||||
esac; \
|
||||
done; \
|
||||
for i in $$list; do \
|
||||
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
|
||||
else file=$$i; fi; \
|
||||
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
||||
case "$$ext" in \
|
||||
1*) ;; \
|
||||
*) ext='1' ;; \
|
||||
esac; \
|
||||
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
|
||||
inst=`echo $$inst | sed -e 's/^.*\///'`; \
|
||||
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
|
||||
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
|
||||
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
|
||||
done
|
||||
uninstall-man1:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
|
||||
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
|
||||
for i in $$l2; do \
|
||||
case "$$i" in \
|
||||
*.1*) list="$$list $$i" ;; \
|
||||
esac; \
|
||||
done; \
|
||||
for i in $$list; do \
|
||||
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
||||
case "$$ext" in \
|
||||
1*) ;; \
|
||||
*) ext='1' ;; \
|
||||
esac; \
|
||||
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
|
||||
inst=`echo $$inst | sed -e 's/^.*\///'`; \
|
||||
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
|
||||
echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
|
||||
rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
|
||||
done
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS:
|
||||
|
||||
check-am:
|
||||
check: check-am
|
||||
all-am: Makefile $(MANS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(man1dir)"; do \
|
||||
test -z "$$dir" || $(mkdir_p) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-libtool
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am: $(DVIS)
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am: $(HTMLS)
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am: $(INFO_DEPS) info-local
|
||||
|
||||
install-data-am: install-data-local install-man
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am: $(INFO_DEPS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(infodir)" || $(mkdir_p) "$(DESTDIR)$(infodir)"
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(INFO_DEPS)'; \
|
||||
for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
esac; \
|
||||
if test -f $$file; then d=.; else d=$(srcdir); fi; \
|
||||
file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \
|
||||
for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \
|
||||
$$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \
|
||||
if test -f $$ifile; then \
|
||||
relfile=`echo "$$ifile" | sed 's|^.*/||'`; \
|
||||
echo " $(INSTALL_DATA) '$$ifile' '$(DESTDIR)$(infodir)/$$relfile'"; \
|
||||
$(INSTALL_DATA) "$$ifile" "$(DESTDIR)$(infodir)/$$relfile"; \
|
||||
else : ; fi; \
|
||||
done; \
|
||||
done
|
||||
@$(POST_INSTALL)
|
||||
@if (install-info --version && \
|
||||
install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \
|
||||
list='$(INFO_DEPS)'; \
|
||||
for file in $$list; do \
|
||||
relfile=`echo "$$file" | sed 's|^.*/||'`; \
|
||||
echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\
|
||||
install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\
|
||||
done; \
|
||||
else : ; fi
|
||||
install-man: install-man1
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-aminfo \
|
||||
maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-aminfo mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am: $(PDFS)
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am: $(PSS)
|
||||
|
||||
uninstall-am: uninstall-man
|
||||
|
||||
uninstall-man: uninstall-man1
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic clean-info \
|
||||
clean-libtool dist-info distclean distclean-generic \
|
||||
distclean-libtool dvi dvi-am html html-am info info-am \
|
||||
info-local install install-am install-data install-data-am \
|
||||
install-data-local install-exec install-exec-am install-info \
|
||||
install-info-am install-man install-man1 install-strip \
|
||||
installcheck installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-aminfo maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-aminfo mostlyclean-generic mostlyclean-libtool pdf \
|
||||
pdf-am ps ps-am uninstall uninstall-am uninstall-info-am \
|
||||
uninstall-man uninstall-man1
|
||||
|
||||
|
||||
config.texi: $(srcdir)/../../bfd/configure $(binutils_TEXI)
|
||||
rm -f config.texi
|
||||
eval `grep '^ *VERSION=' $(srcdir)/../../bfd/configure`; \
|
||||
echo "@set VERSION $$VERSION" > $@
|
||||
echo "@set UPDATED `date "+%B %Y"`" >> config.texi
|
||||
echo "@set top_srcdir $(top_srcdir)" >> config.texi
|
||||
|
||||
# Man page generation from texinfo
|
||||
addr2line.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Daddr2line < $(binutils_TEXI) > addr2line.pod
|
||||
-($(POD2MAN) addr2line.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f addr2line.pod
|
||||
|
||||
ar.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dar < $(binutils_TEXI) > ar.pod
|
||||
-($(POD2MAN) ar.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f ar.pod
|
||||
|
||||
dlltool.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Ddlltool < $(binutils_TEXI) > dlltool.pod
|
||||
-($(POD2MAN) dlltool.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f dlltool.pod
|
||||
|
||||
nlmconv.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dnlmconv < $(binutils_TEXI) > nlmconv.pod
|
||||
-($(POD2MAN) nlmconv.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f nlmconv.pod
|
||||
|
||||
nm.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dnm < $(binutils_TEXI) > nm.pod
|
||||
-($(POD2MAN) nm.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f nm.pod
|
||||
|
||||
objcopy.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dobjcopy < $(binutils_TEXI) > objcopy.pod
|
||||
-($(POD2MAN) objcopy.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f objcopy.pod
|
||||
|
||||
objdump.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dobjdump < $(binutils_TEXI) > objdump.pod
|
||||
-($(POD2MAN) objdump.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f objdump.pod
|
||||
|
||||
ranlib.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dranlib < $(binutils_TEXI) > ranlib.pod
|
||||
-($(POD2MAN) ranlib.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f ranlib.pod
|
||||
|
||||
readelf.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dreadelf < $(binutils_TEXI) > readelf.pod
|
||||
-($(POD2MAN) readelf.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f readelf.pod
|
||||
|
||||
size.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dsize < $(binutils_TEXI) > size.pod
|
||||
-($(POD2MAN) size.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f size.pod
|
||||
|
||||
strings.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dstrings < $(binutils_TEXI) > strings.pod
|
||||
-($(POD2MAN) strings.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f strings.pod
|
||||
|
||||
strip.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dstrip < $(binutils_TEXI) > strip.pod
|
||||
-($(POD2MAN) strip.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f strip.pod
|
||||
|
||||
windres.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dwindres < $(binutils_TEXI) > windres.pod
|
||||
-($(POD2MAN) windres.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f windres.pod
|
||||
|
||||
cxxfilt.man: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dcxxfilt < $(binutils_TEXI) > $(DEMANGLER_NAME).pod
|
||||
-($(POD2MAN) $(DEMANGLER_NAME).pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f $(DEMANGLER_NAME).pod
|
||||
|
||||
$(DEMANGLER_NAME).1: cxxfilt.man Makefile
|
||||
if test -f cxxfilt.man; then \
|
||||
man=cxxfilt.man; \
|
||||
else \
|
||||
man=$(srcdir)/cxxfilt.man; \
|
||||
fi; \
|
||||
sed -e 's/@PROGRAM@/$(DEMANGLER_NAME)/' \
|
||||
-e 's/cxxfilt/$(DEMANGLER_NAME)/' < $$man \
|
||||
> $(DEMANGLER_NAME).1
|
||||
|
||||
# We want install to imply install-info as per GNU standards, despite the
|
||||
# cygnus option.
|
||||
install-data-local: install-info
|
||||
|
||||
# Maintenance
|
||||
|
||||
# We need it for the taz target in ../../Makefile.in.
|
||||
info-local: $(MANS)
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,368 +0,0 @@
|
||||
@c -*-texinfo-*-
|
||||
@node GNU Free Documentation License
|
||||
|
||||
@appendix GNU Free Documentation License
|
||||
@center Version 1.1, March 2000
|
||||
|
||||
@display
|
||||
Copyright (C) 2000, 2003 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
@end display
|
||||
@sp 1
|
||||
@enumerate 0
|
||||
@item
|
||||
PREAMBLE
|
||||
|
||||
The purpose of this License is to make a manual, textbook, or other
|
||||
written document ``free'' in the sense of freedom: to assure everyone
|
||||
the effective freedom to copy and redistribute it, with or without
|
||||
modifying it, either commercially or noncommercially. Secondarily,
|
||||
this License preserves for the author and publisher a way to get
|
||||
credit for their work, while not being considered responsible for
|
||||
modifications made by others.
|
||||
|
||||
This License is a kind of ``copyleft'', which means that derivative
|
||||
works of the document must themselves be free in the same sense. It
|
||||
complements the GNU General Public License, which is a copyleft
|
||||
license designed for free software.
|
||||
|
||||
We have designed this License in order to use it for manuals for free
|
||||
software, because free software needs free documentation: a free
|
||||
program should come with manuals providing the same freedoms that the
|
||||
software does. But this License is not limited to software manuals;
|
||||
it can be used for any textual work, regardless of subject matter or
|
||||
whether it is published as a printed book. We recommend this License
|
||||
principally for works whose purpose is instruction or reference.
|
||||
|
||||
@sp 1
|
||||
@item
|
||||
APPLICABILITY AND DEFINITIONS
|
||||
|
||||
This License applies to any manual or other work that contains a
|
||||
notice placed by the copyright holder saying it can be distributed
|
||||
under the terms of this License. The ``Document'', below, refers to any
|
||||
such manual or work. Any member of the public is a licensee, and is
|
||||
addressed as ``you.''
|
||||
|
||||
A ``Modified Version'' of the Document means any work containing the
|
||||
Document or a portion of it, either copied verbatim, or with
|
||||
modifications and/or translated into another language.
|
||||
|
||||
A ``Secondary Section'' is a named appendix or a front-matter section of
|
||||
the Document that deals exclusively with the relationship of the
|
||||
publishers or authors of the Document to the Document's overall subject
|
||||
(or to related matters) and contains nothing that could fall directly
|
||||
within that overall subject. (For example, if the Document is in part a
|
||||
textbook of mathematics, a Secondary Section may not explain any
|
||||
mathematics.) The relationship could be a matter of historical
|
||||
connection with the subject or with related matters, or of legal,
|
||||
commercial, philosophical, ethical or political position regarding
|
||||
them.
|
||||
|
||||
The ``Invariant Sections'' are certain Secondary Sections whose titles
|
||||
are designated, as being those of Invariant Sections, in the notice
|
||||
that says that the Document is released under this License.
|
||||
|
||||
The ``Cover Texts'' are certain short passages of text that are listed,
|
||||
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
|
||||
the Document is released under this License.
|
||||
|
||||
A ``Transparent'' copy of the Document means a machine-readable copy,
|
||||
represented in a format whose specification is available to the
|
||||
general public, whose contents can be viewed and edited directly and
|
||||
straightforwardly with generic text editors or (for images composed of
|
||||
pixels) generic paint programs or (for drawings) some widely available
|
||||
drawing editor, and that is suitable for input to text formatters or
|
||||
for automatic translation to a variety of formats suitable for input
|
||||
to text formatters. A copy made in an otherwise Transparent file
|
||||
format whose markup has been designed to thwart or discourage
|
||||
subsequent modification by readers is not Transparent. A copy that is
|
||||
not ``Transparent'' is called ``Opaque.''
|
||||
|
||||
Examples of suitable formats for Transparent copies include plain
|
||||
ASCII without markup, Texinfo input format, LaTeX input format, SGML
|
||||
or XML using a publicly available DTD, and standard-conforming simple
|
||||
HTML designed for human modification. Opaque formats include
|
||||
PostScript, PDF, proprietary formats that can be read and edited only
|
||||
by proprietary word processors, SGML or XML for which the DTD and/or
|
||||
processing tools are not generally available, and the
|
||||
machine-generated HTML produced by some word processors for output
|
||||
purposes only.
|
||||
|
||||
The ``Title Page'' means, for a printed book, the title page itself,
|
||||
plus such following pages as are needed to hold, legibly, the material
|
||||
this License requires to appear in the title page. For works in
|
||||
formats which do not have any title page as such, ``Title Page'' means
|
||||
the text near the most prominent appearance of the work's title,
|
||||
preceding the beginning of the body of the text.
|
||||
@sp 1
|
||||
@item
|
||||
VERBATIM COPYING
|
||||
|
||||
You may copy and distribute the Document in any medium, either
|
||||
commercially or noncommercially, provided that this License, the
|
||||
copyright notices, and the license notice saying this License applies
|
||||
to the Document are reproduced in all copies, and that you add no other
|
||||
conditions whatsoever to those of this License. You may not use
|
||||
technical measures to obstruct or control the reading or further
|
||||
copying of the copies you make or distribute. However, you may accept
|
||||
compensation in exchange for copies. If you distribute a large enough
|
||||
number of copies you must also follow the conditions in section 3.
|
||||
|
||||
You may also lend copies, under the same conditions stated above, and
|
||||
you may publicly display copies.
|
||||
@sp 1
|
||||
@item
|
||||
COPYING IN QUANTITY
|
||||
|
||||
If you publish printed copies of the Document numbering more than 100,
|
||||
and the Document's license notice requires Cover Texts, you must enclose
|
||||
the copies in covers that carry, clearly and legibly, all these Cover
|
||||
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
|
||||
the back cover. Both covers must also clearly and legibly identify
|
||||
you as the publisher of these copies. The front cover must present
|
||||
the full title with all words of the title equally prominent and
|
||||
visible. You may add other material on the covers in addition.
|
||||
Copying with changes limited to the covers, as long as they preserve
|
||||
the title of the Document and satisfy these conditions, can be treated
|
||||
as verbatim copying in other respects.
|
||||
|
||||
If the required texts for either cover are too voluminous to fit
|
||||
legibly, you should put the first ones listed (as many as fit
|
||||
reasonably) on the actual cover, and continue the rest onto adjacent
|
||||
pages.
|
||||
|
||||
If you publish or distribute Opaque copies of the Document numbering
|
||||
more than 100, you must either include a machine-readable Transparent
|
||||
copy along with each Opaque copy, or state in or with each Opaque copy
|
||||
a publicly-accessible computer-network location containing a complete
|
||||
Transparent copy of the Document, free of added material, which the
|
||||
general network-using public has access to download anonymously at no
|
||||
charge using public-standard network protocols. If you use the latter
|
||||
option, you must take reasonably prudent steps, when you begin
|
||||
distribution of Opaque copies in quantity, to ensure that this
|
||||
Transparent copy will remain thus accessible at the stated location
|
||||
until at least one year after the last time you distribute an Opaque
|
||||
copy (directly or through your agents or retailers) of that edition to
|
||||
the public.
|
||||
|
||||
It is requested, but not required, that you contact the authors of the
|
||||
Document well before redistributing any large number of copies, to give
|
||||
them a chance to provide you with an updated version of the Document.
|
||||
@sp 1
|
||||
@item
|
||||
MODIFICATIONS
|
||||
|
||||
You may copy and distribute a Modified Version of the Document under
|
||||
the conditions of sections 2 and 3 above, provided that you release
|
||||
the Modified Version under precisely this License, with the Modified
|
||||
Version filling the role of the Document, thus licensing distribution
|
||||
and modification of the Modified Version to whoever possesses a copy
|
||||
of it. In addition, you must do these things in the Modified Version:
|
||||
|
||||
A. Use in the Title Page (and on the covers, if any) a title distinct
|
||||
from that of the Document, and from those of previous versions
|
||||
(which should, if there were any, be listed in the History section
|
||||
of the Document). You may use the same title as a previous version
|
||||
if the original publisher of that version gives permission.@*
|
||||
B. List on the Title Page, as authors, one or more persons or entities
|
||||
responsible for authorship of the modifications in the Modified
|
||||
Version, together with at least five of the principal authors of the
|
||||
Document (all of its principal authors, if it has less than five).@*
|
||||
C. State on the Title page the name of the publisher of the
|
||||
Modified Version, as the publisher.@*
|
||||
D. Preserve all the copyright notices of the Document.@*
|
||||
E. Add an appropriate copyright notice for your modifications
|
||||
adjacent to the other copyright notices.@*
|
||||
F. Include, immediately after the copyright notices, a license notice
|
||||
giving the public permission to use the Modified Version under the
|
||||
terms of this License, in the form shown in the Addendum below.@*
|
||||
G. Preserve in that license notice the full lists of Invariant Sections
|
||||
and required Cover Texts given in the Document's license notice.@*
|
||||
H. Include an unaltered copy of this License.@*
|
||||
I. Preserve the section entitled ``History'', and its title, and add to
|
||||
it an item stating at least the title, year, new authors, and
|
||||
publisher of the Modified Version as given on the Title Page. If
|
||||
there is no section entitled ``History'' in the Document, create one
|
||||
stating the title, year, authors, and publisher of the Document as
|
||||
given on its Title Page, then add an item describing the Modified
|
||||
Version as stated in the previous sentence.@*
|
||||
J. Preserve the network location, if any, given in the Document for
|
||||
public access to a Transparent copy of the Document, and likewise
|
||||
the network locations given in the Document for previous versions
|
||||
it was based on. These may be placed in the ``History'' section.
|
||||
You may omit a network location for a work that was published at
|
||||
least four years before the Document itself, or if the original
|
||||
publisher of the version it refers to gives permission.@*
|
||||
K. In any section entitled ``Acknowledgements'' or ``Dedications'',
|
||||
preserve the section's title, and preserve in the section all the
|
||||
substance and tone of each of the contributor acknowledgements
|
||||
and/or dedications given therein.@*
|
||||
L. Preserve all the Invariant Sections of the Document,
|
||||
unaltered in their text and in their titles. Section numbers
|
||||
or the equivalent are not considered part of the section titles.@*
|
||||
M. Delete any section entitled ``Endorsements.'' Such a section
|
||||
may not be included in the Modified Version.@*
|
||||
N. Do not retitle any existing section as ``Endorsements''
|
||||
or to conflict in title with any Invariant Section.@*
|
||||
@sp 1
|
||||
If the Modified Version includes new front-matter sections or
|
||||
appendices that qualify as Secondary Sections and contain no material
|
||||
copied from the Document, you may at your option designate some or all
|
||||
of these sections as invariant. To do this, add their titles to the
|
||||
list of Invariant Sections in the Modified Version's license notice.
|
||||
These titles must be distinct from any other section titles.
|
||||
|
||||
You may add a section entitled ``Endorsements'', provided it contains
|
||||
nothing but endorsements of your Modified Version by various
|
||||
parties--for example, statements of peer review or that the text has
|
||||
been approved by an organization as the authoritative definition of a
|
||||
standard.
|
||||
|
||||
You may add a passage of up to five words as a Front-Cover Text, and a
|
||||
passage of up to 25 words as a Back-Cover Text, to the end of the list
|
||||
of Cover Texts in the Modified Version. Only one passage of
|
||||
Front-Cover Text and one of Back-Cover Text may be added by (or
|
||||
through arrangements made by) any one entity. If the Document already
|
||||
includes a cover text for the same cover, previously added by you or
|
||||
by arrangement made by the same entity you are acting on behalf of,
|
||||
you may not add another; but you may replace the old one, on explicit
|
||||
permission from the previous publisher that added the old one.
|
||||
|
||||
The author(s) and publisher(s) of the Document do not by this License
|
||||
give permission to use their names for publicity for or to assert or
|
||||
imply endorsement of any Modified Version.
|
||||
@sp 1
|
||||
@item
|
||||
COMBINING DOCUMENTS
|
||||
|
||||
You may combine the Document with other documents released under this
|
||||
License, under the terms defined in section 4 above for modified
|
||||
versions, provided that you include in the combination all of the
|
||||
Invariant Sections of all of the original documents, unmodified, and
|
||||
list them all as Invariant Sections of your combined work in its
|
||||
license notice.
|
||||
|
||||
The combined work need only contain one copy of this License, and
|
||||
multiple identical Invariant Sections may be replaced with a single
|
||||
copy. If there are multiple Invariant Sections with the same name but
|
||||
different contents, make the title of each such section unique by
|
||||
adding at the end of it, in parentheses, the name of the original
|
||||
author or publisher of that section if known, or else a unique number.
|
||||
Make the same adjustment to the section titles in the list of
|
||||
Invariant Sections in the license notice of the combined work.
|
||||
|
||||
In the combination, you must combine any sections entitled ``History''
|
||||
in the various original documents, forming one section entitled
|
||||
``History''; likewise combine any sections entitled ``Acknowledgements'',
|
||||
and any sections entitled ``Dedications.'' You must delete all sections
|
||||
entitled ``Endorsements.''
|
||||
@sp 1
|
||||
@item
|
||||
COLLECTIONS OF DOCUMENTS
|
||||
|
||||
You may make a collection consisting of the Document and other documents
|
||||
released under this License, and replace the individual copies of this
|
||||
License in the various documents with a single copy that is included in
|
||||
the collection, provided that you follow the rules of this License for
|
||||
verbatim copying of each of the documents in all other respects.
|
||||
|
||||
You may extract a single document from such a collection, and distribute
|
||||
it individually under this License, provided you insert a copy of this
|
||||
License into the extracted document, and follow this License in all
|
||||
other respects regarding verbatim copying of that document.
|
||||
@sp 1
|
||||
@item
|
||||
AGGREGATION WITH INDEPENDENT WORKS
|
||||
|
||||
A compilation of the Document or its derivatives with other separate
|
||||
and independent documents or works, in or on a volume of a storage or
|
||||
distribution medium, does not as a whole count as a Modified Version
|
||||
of the Document, provided no compilation copyright is claimed for the
|
||||
compilation. Such a compilation is called an ``aggregate'', and this
|
||||
License does not apply to the other self-contained works thus compiled
|
||||
with the Document, on account of their being thus compiled, if they
|
||||
are not themselves derivative works of the Document.
|
||||
|
||||
If the Cover Text requirement of section 3 is applicable to these
|
||||
copies of the Document, then if the Document is less than one quarter
|
||||
of the entire aggregate, the Document's Cover Texts may be placed on
|
||||
covers that surround only the Document within the aggregate.
|
||||
Otherwise they must appear on covers around the whole aggregate.
|
||||
@sp 1
|
||||
@item
|
||||
TRANSLATION
|
||||
|
||||
Translation is considered a kind of modification, so you may
|
||||
distribute translations of the Document under the terms of section 4.
|
||||
Replacing Invariant Sections with translations requires special
|
||||
permission from their copyright holders, but you may include
|
||||
translations of some or all Invariant Sections in addition to the
|
||||
original versions of these Invariant Sections. You may include a
|
||||
translation of this License provided that you also include the
|
||||
original English version of this License. In case of a disagreement
|
||||
between the translation and the original English version of this
|
||||
License, the original English version will prevail.
|
||||
@sp 1
|
||||
@item
|
||||
TERMINATION
|
||||
|
||||
You may not copy, modify, sublicense, or distribute the Document except
|
||||
as expressly provided for under this License. Any other attempt to
|
||||
copy, modify, sublicense or distribute the Document is void, and will
|
||||
automatically terminate your rights under this License. However,
|
||||
parties who have received copies, or rights, from you under this
|
||||
License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
@sp 1
|
||||
@item
|
||||
FUTURE REVISIONS OF THIS LICENSE
|
||||
|
||||
The Free Software Foundation may publish new, revised versions
|
||||
of the GNU Free Documentation License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns. See
|
||||
http://www.gnu.org/copyleft/.
|
||||
|
||||
Each version of the License is given a distinguishing version number.
|
||||
If the Document specifies that a particular numbered version of this
|
||||
License ``or any later version'' applies to it, you have the option of
|
||||
following the terms and conditions either of that specified version or
|
||||
of any later version that has been published (not as a draft) by the
|
||||
Free Software Foundation. If the Document does not specify a version
|
||||
number of this License, you may choose any version ever published (not
|
||||
as a draft) by the Free Software Foundation.
|
||||
|
||||
@end enumerate
|
||||
|
||||
@unnumberedsec ADDENDUM: How to use this License for your documents
|
||||
|
||||
To use this License in a document you have written, include a copy of
|
||||
the License in the document and put the following copyright and
|
||||
license notices just after the title page:
|
||||
|
||||
@smallexample
|
||||
@group
|
||||
Copyright (C) @var{year} @var{your name}.
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.1
|
||||
or any later version published by the Free Software Foundation;
|
||||
with the Invariant Sections being @var{list their titles}, with the
|
||||
Front-Cover Texts being @var{list}, and with the Back-Cover Texts being @var{list}.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License."
|
||||
@end group
|
||||
@end smallexample
|
||||
|
||||
If you have no Invariant Sections, write ``with no Invariant Sections''
|
||||
instead of saying which ones are invariant. If you have no
|
||||
Front-Cover Texts, write ``no Front-Cover Texts'' instead of
|
||||
``Front-Cover Texts being @var{list}''; likewise for Back-Cover Texts.
|
||||
|
||||
If your document contains nontrivial examples of program code, we
|
||||
recommend releasing these examples in parallel under your choice of
|
||||
free software license, such as the GNU General Public License,
|
||||
to permit their use in free software.
|
||||
3753
binutils/dwarf.c
3753
binutils/dwarf.c
File diff suppressed because it is too large
Load Diff
122
binutils/dwarf.h
122
binutils/dwarf.h
@@ -1,122 +0,0 @@
|
||||
/* dwwrf.h - DWARF support header file
|
||||
Copyright 2005
|
||||
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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "elf/dwarf2.h"
|
||||
|
||||
#if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2)
|
||||
/* We can't use any bfd types here since readelf may define BFD64 and
|
||||
objdump may not. */
|
||||
typedef unsigned long long dwarf_vma;
|
||||
typedef unsigned long long dwarf_size_type;
|
||||
#else
|
||||
typedef unsigned long dwarf_vma;
|
||||
typedef unsigned long dwarf_size_type;
|
||||
#endif
|
||||
|
||||
struct dwarf_section
|
||||
{
|
||||
const char *name;
|
||||
unsigned char *start;
|
||||
dwarf_vma address;
|
||||
dwarf_size_type size;
|
||||
};
|
||||
|
||||
/* A structure containing the name of a debug section
|
||||
and a pointer to a function that can decode it. */
|
||||
struct dwarf_section_display
|
||||
{
|
||||
struct dwarf_section section;
|
||||
int (*display) (struct dwarf_section *, void *);
|
||||
unsigned int relocate : 1;
|
||||
unsigned int eh_frame : 1;
|
||||
};
|
||||
|
||||
enum dwarf_section_display_enum {
|
||||
abbrev = 0,
|
||||
aranges,
|
||||
frame,
|
||||
info,
|
||||
line,
|
||||
pubnames,
|
||||
eh_frame,
|
||||
macinfo,
|
||||
str,
|
||||
loc,
|
||||
pubtypes,
|
||||
ranges,
|
||||
static_func,
|
||||
static_vars,
|
||||
types,
|
||||
weaknames,
|
||||
max
|
||||
};
|
||||
|
||||
extern struct dwarf_section_display debug_displays [];
|
||||
|
||||
/* This structure records the information that
|
||||
we extract from the.debug_info section. */
|
||||
typedef struct
|
||||
{
|
||||
unsigned int pointer_size;
|
||||
unsigned long cu_offset;
|
||||
unsigned long base_address;
|
||||
/* This is an array of offsets to the location list table. */
|
||||
unsigned long *loc_offsets;
|
||||
int *have_frame_base;
|
||||
unsigned int num_loc_offsets;
|
||||
unsigned int max_loc_offsets;
|
||||
unsigned long *range_lists;
|
||||
unsigned int num_range_lists;
|
||||
unsigned int max_range_lists;
|
||||
}
|
||||
debug_info;
|
||||
|
||||
extern dwarf_vma (*byte_get) (unsigned char *, int);
|
||||
extern dwarf_vma byte_get_little_endian (unsigned char *, int);
|
||||
extern dwarf_vma byte_get_big_endian (unsigned char *, int);
|
||||
|
||||
extern dwarf_vma eh_addr_size;
|
||||
extern int is_relocatable;
|
||||
|
||||
extern int do_debug_info;
|
||||
extern int do_debug_abbrevs;
|
||||
extern int do_debug_lines;
|
||||
extern int do_debug_pubnames;
|
||||
extern int do_debug_aranges;
|
||||
extern int do_debug_ranges;
|
||||
extern int do_debug_frames;
|
||||
extern int do_debug_frames_interp;
|
||||
extern int do_debug_macinfo;
|
||||
extern int do_debug_str;
|
||||
extern int do_debug_loc;
|
||||
|
||||
extern int load_debug_section (enum dwarf_section_display_enum,
|
||||
void *);
|
||||
extern void free_debug_section (enum dwarf_section_display_enum);
|
||||
|
||||
extern void free_debug_memory (void);
|
||||
|
||||
void *cmalloc (size_t, size_t);
|
||||
void *xcmalloc (size_t, size_t);
|
||||
void *xcrealloc (void *, size_t, size_t);
|
||||
|
||||
void error (const char *, ...) ATTRIBUTE_PRINTF_1;
|
||||
void warn (const char *, ...) ATTRIBUTE_PRINTF_1;
|
||||
@@ -1,173 +0,0 @@
|
||||
/* Binutils emulation layer.
|
||||
Copyright 2002, 2003 Free Software Foundation, Inc.
|
||||
Written by Tom Rix, Red Hat 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include "binemul.h"
|
||||
#include "bfdlink.h"
|
||||
#include "coff/internal.h"
|
||||
#include "coff/xcoff.h"
|
||||
#include "libcoff.h"
|
||||
#include "libxcoff.h"
|
||||
|
||||
/* Default to <bigaf>. */
|
||||
static bfd_boolean big_archive = TRUE;
|
||||
|
||||
/* Whether to include 32 bit objects. */
|
||||
static bfd_boolean X32 = TRUE;
|
||||
|
||||
/* Whether to include 64 bit objects. */
|
||||
static bfd_boolean X64 = FALSE;
|
||||
|
||||
static void ar_emul_aix_usage (FILE *);
|
||||
static bfd_boolean ar_emul_aix_append (bfd **, char *, bfd_boolean);
|
||||
static bfd_boolean ar_emul_aix5_append (bfd **, char *, bfd_boolean);
|
||||
static bfd_boolean ar_emul_aix_replace (bfd **, char *, bfd_boolean);
|
||||
static bfd_boolean ar_emul_aix5_replace (bfd **, char *, bfd_boolean);
|
||||
static bfd_boolean ar_emul_aix_parse_arg (char *);
|
||||
static bfd_boolean ar_emul_aix_internal
|
||||
(bfd **, char *, bfd_boolean, const char *, bfd_boolean);
|
||||
|
||||
static void
|
||||
ar_emul_aix_usage (FILE *fp)
|
||||
{
|
||||
AR_EMUL_USAGE_PRINT_OPTION_HEADER (fp);
|
||||
/* xgettext:c-format */
|
||||
fprintf (fp, _(" [-g] - 32 bit small archive\n"));
|
||||
fprintf (fp, _(" [-X32] - ignores 64 bit objects\n"));
|
||||
fprintf (fp, _(" [-X64] - ignores 32 bit objects\n"));
|
||||
fprintf (fp, _(" [-X32_64] - accepts 32 and 64 bit objects\n"));
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
ar_emul_aix_internal (bfd **after_bfd, char *file_name, bfd_boolean verbose,
|
||||
const char * target_name, bfd_boolean is_append)
|
||||
{
|
||||
bfd *temp;
|
||||
bfd *try_bfd;
|
||||
|
||||
temp = *after_bfd;
|
||||
|
||||
/* Try 64 bit. */
|
||||
try_bfd = bfd_openr (file_name, target_name);
|
||||
|
||||
/* Failed or the object is possibly 32 bit. */
|
||||
if (NULL == try_bfd || ! bfd_check_format (try_bfd, bfd_object))
|
||||
try_bfd = bfd_openr (file_name, "aixcoff-rs6000");
|
||||
|
||||
AR_EMUL_ELEMENT_CHECK (try_bfd, file_name);
|
||||
|
||||
if (bfd_xcoff_is_xcoff64 (try_bfd) && (! X64))
|
||||
return FALSE;
|
||||
|
||||
if (bfd_xcoff_is_xcoff32 (try_bfd)
|
||||
&& bfd_check_format (try_bfd, bfd_object) && (! X32))
|
||||
return FALSE;
|
||||
|
||||
if (is_append)
|
||||
{
|
||||
AR_EMUL_APPEND_PRINT_VERBOSE (verbose, file_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
AR_EMUL_REPLACE_PRINT_VERBOSE (verbose, file_name);
|
||||
}
|
||||
|
||||
*after_bfd = try_bfd;
|
||||
(*after_bfd)->next = temp;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static bfd_boolean
|
||||
ar_emul_aix_append (bfd **after_bfd, char *file_name, bfd_boolean verbose)
|
||||
{
|
||||
return ar_emul_aix_internal (after_bfd, file_name, verbose,
|
||||
"aixcoff64-rs6000", TRUE);
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
ar_emul_aix5_append (bfd **after_bfd, char *file_name, bfd_boolean verbose)
|
||||
{
|
||||
return ar_emul_aix_internal (after_bfd, file_name, verbose,
|
||||
"aix5coff64-rs6000", TRUE);
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
ar_emul_aix_replace (bfd **after_bfd, char *file_name, bfd_boolean verbose)
|
||||
{
|
||||
return ar_emul_aix_internal (after_bfd, file_name, verbose,
|
||||
"aixcoff64-rs6000", FALSE);
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
ar_emul_aix5_replace (bfd **after_bfd, char *file_name, bfd_boolean verbose)
|
||||
{
|
||||
return ar_emul_aix_internal (after_bfd, file_name, verbose,
|
||||
"aix5coff64-rs6000", FALSE);
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
ar_emul_aix_parse_arg (char *arg)
|
||||
{
|
||||
if (strncmp (arg, "-X32_64", 6) == 0)
|
||||
{
|
||||
big_archive = TRUE;
|
||||
X32 = TRUE;
|
||||
X64 = TRUE;
|
||||
}
|
||||
else if (strncmp (arg, "-X32", 3) == 0)
|
||||
{
|
||||
big_archive = TRUE;
|
||||
X32 = TRUE;
|
||||
X64 = FALSE;
|
||||
}
|
||||
else if (strncmp (arg, "-X64", 3) == 0)
|
||||
{
|
||||
big_archive = TRUE;
|
||||
X32 = FALSE;
|
||||
X64 = TRUE;
|
||||
}
|
||||
else if (strncmp (arg, "-g", 2) == 0)
|
||||
{
|
||||
big_archive = FALSE;
|
||||
X32 = TRUE;
|
||||
X64 = FALSE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
struct bin_emulation_xfer_struct bin_aix_emulation =
|
||||
{
|
||||
ar_emul_aix_usage,
|
||||
ar_emul_aix_append,
|
||||
ar_emul_aix_replace,
|
||||
ar_emul_aix_parse_arg,
|
||||
};
|
||||
|
||||
struct bin_emulation_xfer_struct bin_aix5_emulation =
|
||||
{
|
||||
ar_emul_aix_usage,
|
||||
ar_emul_aix5_append,
|
||||
ar_emul_aix5_replace,
|
||||
ar_emul_aix_parse_arg,
|
||||
};
|
||||
@@ -1,29 +0,0 @@
|
||||
/* Binutils emulation layer.
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Written by Tom Rix, Red Hat 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include "binemul.h"
|
||||
|
||||
struct bin_emulation_xfer_struct bin_vanilla_emulation =
|
||||
{
|
||||
ar_emul_default_usage,
|
||||
ar_emul_default_append,
|
||||
ar_emul_default_replace,
|
||||
ar_emul_default_parse_arg,
|
||||
};
|
||||
@@ -1,248 +0,0 @@
|
||||
/* filemode.c -- make a string describing file modes
|
||||
Copyright 1985, 1990, 1991, 1994, 1995, 1997, 1999, 2002, 2003, 2005
|
||||
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., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
02110-1301, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "bucomm.h"
|
||||
|
||||
static char ftypelet (unsigned long);
|
||||
static void setst (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. */
|
||||
|
||||
/* 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 (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 multiplexer 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 (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 (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
|
||||
}
|
||||
7397
binutils/ieee.c
7397
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,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;
|
||||
2140
binutils/nlmconv.c
2140
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 1993, 2002, 2003 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, 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 bfd_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 bfd_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 bfd_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 (void);
|
||||
|
||||
/* Tell the lexer what file to read. */
|
||||
extern bfd_boolean nlmlex_file (const char *);
|
||||
@@ -1,960 +0,0 @@
|
||||
%{/* nlmheader.y - parse NLM header specification keywords.
|
||||
Copyright 1993, 1994, 1995, 1997, 1998, 2001, 2002, 2003
|
||||
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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, 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 "safe-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). */
|
||||
bfd_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). */
|
||||
bfd_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. */
|
||||
bfd_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 (void);
|
||||
static void nlmlex_file_push (const char *);
|
||||
static bfd_boolean nlmlex_file_open (const char *);
|
||||
static int nlmlex_buf_init (void);
|
||||
static char nlmlex_buf_add (int);
|
||||
static long nlmlex_get_number (const char *);
|
||||
static void nlmheader_identify (void);
|
||||
static void nlmheader_warn (const char *, int);
|
||||
static void nlmheader_error (const char *);
|
||||
static struct string_list * string_list_cons (char *, struct string_list *);
|
||||
static struct string_list * string_list_append (struct string_list *,
|
||||
struct string_list *);
|
||||
static struct string_list * string_list_append1 (struct string_list *,
|
||||
char *);
|
||||
static char *xstrdup (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 PARAMS ((int));
|
||||
|
||||
/* 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. */
|
||||
|
||||
bfd_boolean
|
||||
nlmlex_file (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 (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 bfd_boolean
|
||||
nlmlex_file_open (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;
|
||||
};
|
||||
|
||||
static 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 (void)
|
||||
{
|
||||
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 (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 (void)
|
||||
{
|
||||
int c;
|
||||
|
||||
tail_recurse:
|
||||
|
||||
c = getc (current.file);
|
||||
|
||||
/* Commas are treated as whitespace characters. */
|
||||
while (ISSPACE (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 (c));
|
||||
BUF_INIT ();
|
||||
while (! ISSPACE (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 (c) || c == '_')
|
||||
{
|
||||
BUF_ADD (TOUPPER (c));
|
||||
c = getc (current.file);
|
||||
}
|
||||
BUF_FINISH ();
|
||||
|
||||
if (c != EOF && ! ISSPACE (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 (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 (void)
|
||||
{
|
||||
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 (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 (const char *s)
|
||||
{
|
||||
nlmheader_warn (s, -1);
|
||||
++parse_errors;
|
||||
}
|
||||
|
||||
/* Add a string to a string list. */
|
||||
|
||||
static struct string_list *
|
||||
string_list_cons (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 (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 (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 (const char *s)
|
||||
{
|
||||
unsigned long len;
|
||||
char *ret;
|
||||
|
||||
len = strlen (s);
|
||||
ret = xmalloc (len + 1);
|
||||
strcpy (ret, s);
|
||||
return ret;
|
||||
}
|
||||
1639
binutils/nm.c
1639
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;
|
||||
3215
binutils/objcopy.c
3215
binutils/objcopy.c
File diff suppressed because it is too large
Load Diff
3205
binutils/objdump.c
3205
binutils/objdump.c
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
||||
*.gmo
|
||||
@@ -1,254 +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>
|
||||
# Copyright 2003 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file may 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
|
||||
|
||||
DESTDIR =
|
||||
|
||||
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) $(DESTDIR)$(datadir); \
|
||||
else \
|
||||
$(top_srcdir)/mkinstalldirs $(DESTDIR)$(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)$$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) $(DESTDIR)$(gettextsrcdir); \
|
||||
else \
|
||||
$(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
|
||||
fi; \
|
||||
$(INSTALL_DATA) $(srcdir)/Makefile.in.in \
|
||||
$(DESTDIR)$(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 $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
|
||||
rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
|
||||
rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
|
||||
rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
|
||||
done
|
||||
rm -f $(DESTDIR)$(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,60 +0,0 @@
|
||||
addr2line.c
|
||||
ar.c
|
||||
arsup.c
|
||||
arsup.h
|
||||
binemul.c
|
||||
binemul.h
|
||||
bucomm.c
|
||||
bucomm.h
|
||||
budbg.h
|
||||
budemang.c
|
||||
budemang.h
|
||||
coffdump.c
|
||||
coffgrok.c
|
||||
coffgrok.h
|
||||
cxxfilt.c
|
||||
debug.c
|
||||
debug.c
|
||||
debug.h
|
||||
dlltool.c
|
||||
dlltool.h
|
||||
dllwrap.c
|
||||
emul_aix.c
|
||||
emul_vanilla.c
|
||||
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
4800
binutils/po/da.po
4800
binutils/po/da.po
File diff suppressed because it is too large
Load Diff
5875
binutils/po/es.po
5875
binutils/po/es.po
File diff suppressed because it is too large
Load Diff
5779
binutils/po/fr.po
5779
binutils/po/fr.po
File diff suppressed because it is too large
Load Diff
4110
binutils/po/ja.po
4110
binutils/po/ja.po
File diff suppressed because it is too large
Load Diff
5090
binutils/po/ro.po
5090
binutils/po/ro.po
File diff suppressed because it is too large
Load Diff
5508
binutils/po/ru.po
5508
binutils/po/ru.po
File diff suppressed because it is too large
Load Diff
4990
binutils/po/rw.po
4990
binutils/po/rw.po
File diff suppressed because it is too large
Load Diff
5571
binutils/po/sv.po
5571
binutils/po/sv.po
File diff suppressed because it is too large
Load Diff
5790
binutils/po/tr.po
5790
binutils/po/tr.po
File diff suppressed because it is too large
Load Diff
4742
binutils/po/zh_CN.po
4742
binutils/po/zh_CN.po
File diff suppressed because it is too large
Load Diff
5497
binutils/po/zh_TW.po
5497
binutils/po/zh_TW.po
File diff suppressed because it is too large
Load Diff
2795
binutils/prdbg.c
2795
binutils/prdbg.c
File diff suppressed because it is too large
Load Diff
@@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
# A simple ranlib script, to use less disk space than a ranlib program.
|
||||
ar s "$1"
|
||||
504
binutils/rclex.l
504
binutils/rclex.l
@@ -1,504 +0,0 @@
|
||||
%{ /* rclex.l -- lexer for Windows rc files parser */
|
||||
/* Copyright 1997, 1998, 1999, 2001, 2002, 2003, 2005
|
||||
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., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
02110-1301, 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 "safe-ctype.h"
|
||||
#include "windres.h"
|
||||
#include "rcparse.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#define YY_NO_UNPUT
|
||||
|
||||
/* 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 (const char *);
|
||||
static char *handle_quotes (const char *, unsigned long *);
|
||||
static char *get_string (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\n]*)+ {
|
||||
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 (void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Handle a C preprocessor line. */
|
||||
|
||||
static void
|
||||
cpp_line (const char *s)
|
||||
{
|
||||
int line;
|
||||
char *send, *fn;
|
||||
|
||||
++s;
|
||||
while (ISSPACE (*s))
|
||||
++s;
|
||||
|
||||
line = strtol (s, &send, 0);
|
||||
if (*send != '\0' && ! ISSPACE (*send))
|
||||
return;
|
||||
|
||||
/* Subtract 1 because we are about to count the newline. */
|
||||
rc_lineno = line - 1;
|
||||
|
||||
s = send;
|
||||
while (ISSPACE (*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 (const char *input, unsigned long *len)
|
||||
{
|
||||
char *ret, *s;
|
||||
const char *t;
|
||||
int ch;
|
||||
int num_xdigits;
|
||||
|
||||
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_B; /* Strange, but true... */
|
||||
++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;
|
||||
/* We only handle single byte chars here. Make sure
|
||||
we finish an escape sequence like "/xB0ABC" after
|
||||
the first two digits. */
|
||||
num_xdigits = 2;
|
||||
while (num_xdigits--)
|
||||
{
|
||||
if (*t >= '0' && *t <= '9')
|
||||
ch = (ch << 4) | (*t - '0');
|
||||
else if (*t >= 'a' && *t <= 'f')
|
||||
ch = (ch << 4) | (*t - 'a' + 10);
|
||||
else if (*t >= 'A' && *t <= 'F')
|
||||
ch = (ch << 4) | (*t - 'A' + 10);
|
||||
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 (*t));
|
||||
while (ISSPACE (*t))
|
||||
{
|
||||
if ((*t) == '\n')
|
||||
++rc_lineno;
|
||||
++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 (int len)
|
||||
{
|
||||
struct alloc_string *as;
|
||||
|
||||
as = (struct alloc_string *) xmalloc (sizeof *as);
|
||||
as->s = xmalloc (len);
|
||||
|
||||
as->next = strings;
|
||||
strings = as;
|
||||
|
||||
return as->s;
|
||||
}
|
||||
|
||||
/* Discard all the strings we have allocated. The parser calls this
|
||||
when it no longer needs them. */
|
||||
|
||||
void
|
||||
rcparse_discard_strings (void)
|
||||
{
|
||||
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 (void)
|
||||
{
|
||||
rcdata_mode = 1;
|
||||
}
|
||||
|
||||
/* Go back to normal mode from rcdata mode. */
|
||||
|
||||
void
|
||||
rcparse_normal (void)
|
||||
{
|
||||
rcdata_mode = 0;
|
||||
}
|
||||
1777
binutils/rcparse.y
1777
binutils/rcparse.y
File diff suppressed because it is too large
Load Diff
@@ -1,874 +0,0 @@
|
||||
/* stabs.c -- Parse COFF debugging information
|
||||
Copyright 1996, 1999, 2000, 2002, 2003 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., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
02110-1301, USA. */
|
||||
|
||||
/* This file contains code which parses COFF debugging information. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "coff/internal.h"
|
||||
#include "bucomm.h"
|
||||
#include "libiberty.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 (struct coff_types *, int);
|
||||
static debug_type parse_coff_type
|
||||
(bfd *, struct coff_symbols *, struct coff_types *, long, int,
|
||||
union internal_auxent *, bfd_boolean, void *);
|
||||
static debug_type parse_coff_base_type
|
||||
(bfd *, struct coff_symbols *, struct coff_types *, long, int,
|
||||
union internal_auxent *, void *);
|
||||
static debug_type parse_coff_struct_type
|
||||
(bfd *, struct coff_symbols *, struct coff_types *, int,
|
||||
union internal_auxent *, void *);
|
||||
static debug_type parse_coff_enum_type
|
||||
(bfd *, struct coff_symbols *, struct coff_types *,
|
||||
union internal_auxent *, void *);
|
||||
static bfd_boolean parse_coff_symbol
|
||||
(bfd *, struct coff_types *, asymbol *, long, struct internal_syment *,
|
||||
void *, debug_type, bfd_boolean);
|
||||
static bfd_boolean external_coff_symbol_p (int sym_class);
|
||||
|
||||
/* Return the slot for a type. */
|
||||
|
||||
static debug_type *
|
||||
coff_get_slot (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 (bfd *abfd, struct coff_symbols *symbols,
|
||||
struct coff_types *types, long coff_symno, int ntype,
|
||||
union internal_auxent *pauxent, bfd_boolean useaux,
|
||||
void *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 (bfd *abfd, struct coff_symbols *symbols,
|
||||
struct coff_types *types, long coff_symno, int ntype,
|
||||
union internal_auxent *pauxent, void *dhandle)
|
||||
{
|
||||
debug_type ret;
|
||||
bfd_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 (bfd *abfd, struct coff_symbols *symbols,
|
||||
struct coff_types *types, int ntype,
|
||||
union internal_auxent *pauxent, void *dhandle)
|
||||
{
|
||||
long symend;
|
||||
int alloc;
|
||||
debug_field *fields;
|
||||
int count;
|
||||
bfd_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 (bfd *abfd, struct coff_symbols *symbols,
|
||||
struct coff_types *types ATTRIBUTE_UNUSED,
|
||||
union internal_auxent *pauxent, void *dhandle)
|
||||
{
|
||||
long symend;
|
||||
int alloc;
|
||||
const char **names;
|
||||
bfd_signed_vma *vals;
|
||||
int count;
|
||||
bfd_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 bfd_boolean
|
||||
parse_coff_symbol (bfd *abfd ATTRIBUTE_UNUSED, struct coff_types *types,
|
||||
asymbol *sym, long coff_symno,
|
||||
struct internal_syment *psyment, void *dhandle,
|
||||
debug_type type, bfd_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_WEAKEXT:
|
||||
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;
|
||||
}
|
||||
|
||||
/* Determine if a symbol has external visibility. */
|
||||
|
||||
static bfd_boolean
|
||||
external_coff_symbol_p (int sym_class)
|
||||
{
|
||||
switch (sym_class)
|
||||
{
|
||||
case C_EXT:
|
||||
case C_WEAKEXT:
|
||||
return TRUE;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* This is the main routine. It looks through all the symbols and
|
||||
handles them. */
|
||||
|
||||
bfd_boolean
|
||||
parse_coff (bfd *abfd, asymbol **syms, long symcount, void *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;
|
||||
bfd_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_WEAKEXT:
|
||||
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,
|
||||
external_coff_symbol_p (fnclass),
|
||||
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;
|
||||
}
|
||||
442
binutils/rddbg.c
442
binutils/rddbg.c
@@ -1,442 +0,0 @@
|
||||
/* rddbg.c -- Read debugging information into a generic form.
|
||||
Copyright 1995, 1996, 1997, 2000, 2002, 2003
|
||||
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., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
02110-1301, 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 bfd_boolean read_section_stabs_debugging_info
|
||||
(bfd *, asymbol **, long, void *, bfd_boolean *);
|
||||
static bfd_boolean read_symbol_stabs_debugging_info
|
||||
(bfd *, asymbol **, long, void *, bfd_boolean *);
|
||||
static bfd_boolean read_ieee_debugging_info (bfd *, void *, bfd_boolean *);
|
||||
static void save_stab (int, int, bfd_vma, const char *);
|
||||
static void stab_context (void);
|
||||
static void free_saved_stabs (void);
|
||||
|
||||
/* Read debugging information from a BFD. Returns a generic debugging
|
||||
pointer. */
|
||||
|
||||
void *
|
||||
read_debugging_info (bfd *abfd, asymbol **syms, long symcount)
|
||||
{
|
||||
void *dhandle;
|
||||
bfd_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 bfd_boolean
|
||||
read_section_stabs_debugging_info (bfd *abfd, asymbol **syms, long symcount,
|
||||
void *dhandle, bfd_boolean *pfound)
|
||||
{
|
||||
static struct
|
||||
{
|
||||
const char *secname;
|
||||
const char *strsecname;
|
||||
} names[] = { { ".stab", ".stabstr" },
|
||||
{ "LC_SYMTAB.stabs", "LC_SYMTAB.stabstr" } };
|
||||
unsigned int i;
|
||||
void *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 %ld is corrupt, strx = 0x%x, type = %d\n",
|
||||
bfd_get_filename (abfd), names[i].secname,
|
||||
(long) (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 bfd_boolean
|
||||
read_symbol_stabs_debugging_info (bfd *abfd, asymbol **syms, long symcount,
|
||||
void *dhandle, bfd_boolean *pfound)
|
||||
{
|
||||
void *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 bfd_boolean
|
||||
read_ieee_debugging_info (bfd *abfd, void *dhandle, bfd_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 (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 (void)
|
||||
{
|
||||
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 (void)
|
||||
{
|
||||
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;
|
||||
}
|
||||
9201
binutils/readelf.c
9201
binutils/readelf.c
File diff suppressed because it is too large
Load Diff
@@ -1,219 +0,0 @@
|
||||
/* rename.c -- rename a file, preserving symlinks.
|
||||
Copyright 1999, 2002, 2003 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., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
02110-1301, 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
|
||||
|
||||
#if ! defined (_WIN32) || defined (__CYGWIN32__)
|
||||
static int simple_copy (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 (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;
|
||||
}
|
||||
#endif /* __CYGWIN32__ or not _WIN32 */
|
||||
|
||||
/* Set the times of the file DESTINATION to be the same as those in
|
||||
STATBUF. */
|
||||
|
||||
void
|
||||
set_times (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 (const char *from, const char *to, int preserve_dates ATTRIBUTE_UNUSED)
|
||||
{
|
||||
bfd_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 (_("unable to rename '%s' reason: %s"), to, strerror (errno));
|
||||
unlink (from);
|
||||
}
|
||||
#else
|
||||
/* Use rename only if TO is not a symbolic link and has
|
||||
only one hard link, and we have permission to write to it. */
|
||||
if (! exists
|
||||
|| (!S_ISLNK (s.st_mode)
|
||||
&& S_ISREG (s.st_mode)
|
||||
&& (s.st_mode & S_IWUSR)
|
||||
&& 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 (_("unable to rename '%s' reason: %s"), to, strerror (errno));
|
||||
unlink (from);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = simple_copy (from, to);
|
||||
if (ret != 0)
|
||||
non_fatal (_("unable to copy file '%s' reason: %s"), to, strerror (errno));
|
||||
|
||||
if (preserve_dates)
|
||||
set_times (to, &s);
|
||||
unlink (from);
|
||||
}
|
||||
#endif /* _WIN32 && !__CYGWIN32__ */
|
||||
|
||||
return ret;
|
||||
}
|
||||
2318
binutils/resbin.c
2318
binutils/resbin.c
File diff suppressed because it is too large
Load Diff
@@ -1,766 +0,0 @@
|
||||
/* rescoff.c -- read and write resources in Windows COFF files.
|
||||
Copyright 1997, 1998, 1999, 2000, 2003
|
||||
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., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
02110-1301, 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 (const struct coff_file_info *, const char *);
|
||||
static struct res_directory *read_coff_res_dir
|
||||
(const bfd_byte *, const struct coff_file_info *,
|
||||
const struct res_id *, int);
|
||||
static struct res_resource *read_coff_data_entry
|
||||
(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 (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 (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 (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 (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
|
||||
(const struct res_directory *, struct coff_write_info *);
|
||||
static unsigned char *coff_alloc (struct bindata_build *, size_t);
|
||||
static void coff_to_bin
|
||||
(const struct res_directory *, struct coff_write_info *);
|
||||
static void coff_res_to_bin
|
||||
(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 (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 (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 (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 (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 (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);
|
||||
}
|
||||
}
|
||||
2596
binutils/resrc.c
2596
binutils/resrc.c
File diff suppressed because it is too large
Load Diff
@@ -1,663 +0,0 @@
|
||||
/* resres.c: read_res_file and write_res_file implementation for windres.
|
||||
Copyright 1998, 1999, 2001, 2002 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., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
02110-1301, 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);
|
||||
|
||||
reshdr.header_size = (reshdr.header_size + 3) & ~3;
|
||||
|
||||
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 ((size_t) 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)
|
||||
{
|
||||
int pos = ftell (fres);
|
||||
int skip = ((pos + 3) & ~3) - pos;
|
||||
if (fseek (fres, skip, 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
|
||||
552
binutils/size.c
552
binutils/size.c
@@ -1,552 +0,0 @@
|
||||
/* size.c -- report size of various sections of an executable file.
|
||||
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||
2001, 2002, 2003, 2004, 2005 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, 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 "bucomm.h"
|
||||
#include "libiberty.h"
|
||||
#include "getopt.h"
|
||||
|
||||
#ifndef BSD_DEFAULT
|
||||
#define BSD_DEFAULT 1
|
||||
#endif
|
||||
|
||||
/* Program options. */
|
||||
|
||||
enum
|
||||
{
|
||||
decimal, octal, hex
|
||||
}
|
||||
radix = decimal;
|
||||
|
||||
/* 0 means use AT&T-style output. */
|
||||
static int berkeley_format = BSD_DEFAULT;
|
||||
|
||||
int show_version = 0;
|
||||
int show_help = 0;
|
||||
int show_totals = 0;
|
||||
|
||||
static bfd_size_type total_bsssize;
|
||||
static bfd_size_type total_datasize;
|
||||
static bfd_size_type total_textsize;
|
||||
|
||||
/* Program exit status. */
|
||||
int return_code = 0;
|
||||
|
||||
static char *target = NULL;
|
||||
|
||||
/* Static declarations. */
|
||||
|
||||
static void usage (FILE *, int);
|
||||
static void display_file (char *);
|
||||
static void display_bfd (bfd *);
|
||||
static void display_archive (bfd *);
|
||||
static int size_number (bfd_size_type);
|
||||
static void rprint_number (int, bfd_size_type);
|
||||
static void print_berkeley_format (bfd *);
|
||||
static void sysv_internal_sizer (bfd *, asection *, void *);
|
||||
static void sysv_internal_printer (bfd *, asection *, void *);
|
||||
static void print_sysv_format (bfd *);
|
||||
static void print_sizes (bfd * file);
|
||||
static void berkeley_sum (bfd *, sec_ptr, void *);
|
||||
|
||||
static void
|
||||
usage (FILE *stream, int status)
|
||||
{
|
||||
fprintf (stream, _("Usage: %s [option(s)] [file(s)]\n"), program_name);
|
||||
fprintf (stream, _(" Displays the sizes of sections inside binary files\n"));
|
||||
fprintf (stream, _(" If no input file(s) are specified, a.out is assumed\n"));
|
||||
fprintf (stream, _(" The options are:\n\
|
||||
-A|-B --format={sysv|berkeley} Select output style (default is %s)\n\
|
||||
-o|-d|-x --radix={8|10|16} Display numbers in octal, decimal or hex\n\
|
||||
-t --totals Display the total sizes (Berkeley only)\n\
|
||||
--target=<bfdname> Set the binary file format\n\
|
||||
@<file> Read options from <file>\n\
|
||||
-h --help Display this information\n\
|
||||
-v --version Display the program's version\n\
|
||||
\n"),
|
||||
#if BSD_DEFAULT
|
||||
"berkeley"
|
||||
#else
|
||||
"sysv"
|
||||
#endif
|
||||
);
|
||||
list_supported_targets (program_name, stream);
|
||||
if (status == 0)
|
||||
fprintf (stream, _("Report bugs to %s\n"), REPORT_BUGS_TO);
|
||||
exit (status);
|
||||
}
|
||||
|
||||
static struct option long_options[] =
|
||||
{
|
||||
{"format", required_argument, 0, 200},
|
||||
{"radix", required_argument, 0, 201},
|
||||
{"target", required_argument, 0, 202},
|
||||
{"totals", no_argument, &show_totals, 1},
|
||||
{"version", no_argument, &show_version, 1},
|
||||
{"help", no_argument, &show_help, 1},
|
||||
{0, no_argument, 0, 0}
|
||||
};
|
||||
|
||||
int main (int, char **);
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int temp;
|
||||
int c;
|
||||
|
||||
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
|
||||
setlocale (LC_MESSAGES, "");
|
||||
#endif
|
||||
#if defined (HAVE_SETLOCALE)
|
||||
setlocale (LC_CTYPE, "");
|
||||
#endif
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
program_name = *argv;
|
||||
xmalloc_set_program_name (program_name);
|
||||
|
||||
expandargv (&argc, &argv);
|
||||
|
||||
bfd_init ();
|
||||
set_default_bfd_target ();
|
||||
|
||||
while ((c = getopt_long (argc, argv, "ABHhVvdfotx", 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':
|
||||
case 'V':
|
||||
show_version = 1;
|
||||
break;
|
||||
case 'd':
|
||||
radix = decimal;
|
||||
break;
|
||||
case 'x':
|
||||
radix = hex;
|
||||
break;
|
||||
case 'o':
|
||||
radix = octal;
|
||||
break;
|
||||
case 't':
|
||||
show_totals = 1;
|
||||
break;
|
||||
case 'f': /* FIXME : For sysv68, `-f' means `full format', i.e.
|
||||
`[fname:] M(.text) + N(.data) + O(.bss) + P(.comment) = Q'
|
||||
where `fname: ' appears only if there are >= 2 input files,
|
||||
and M, N, O, P, Q are expressed in decimal by default,
|
||||
hexa or octal if requested by `-x' or `-o'.
|
||||
Just to make things interesting, Solaris also accepts -f,
|
||||
which prints out the size of each allocatable section, the
|
||||
name of the section, and the total of the section sizes. */
|
||||
/* For the moment, accept `-f' silently, and ignore it. */
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
case 'h':
|
||||
case 'H':
|
||||
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++]);
|
||||
|
||||
if (show_totals && berkeley_format)
|
||||
{
|
||||
bfd_size_type total = total_textsize + total_datasize + total_bsssize;
|
||||
|
||||
rprint_number (7, total_textsize);
|
||||
putchar('\t');
|
||||
rprint_number (7, total_datasize);
|
||||
putchar('\t');
|
||||
rprint_number (7, total_bsssize);
|
||||
printf (((radix == octal) ? "\t%7lo\t%7lx\t" : "\t%7lu\t%7lx\t"),
|
||||
(unsigned long) total, (unsigned long) total);
|
||||
fputs ("(TOTALS)\n", stdout);
|
||||
}
|
||||
|
||||
return return_code;
|
||||
}
|
||||
|
||||
/* Display stats on file or archive member ABFD. */
|
||||
|
||||
static void
|
||||
display_bfd (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 (bfd *file)
|
||||
{
|
||||
bfd *arfile = (bfd *) NULL;
|
||||
bfd *last_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);
|
||||
|
||||
if (last_arfile != NULL)
|
||||
bfd_close (last_arfile);
|
||||
last_arfile = arfile;
|
||||
}
|
||||
|
||||
if (last_arfile != NULL)
|
||||
bfd_close (last_arfile);
|
||||
}
|
||||
|
||||
static void
|
||||
display_file (char *filename)
|
||||
{
|
||||
bfd *file;
|
||||
|
||||
if (get_file_size (filename) < 1)
|
||||
return;
|
||||
|
||||
file = bfd_openr (filename, target);
|
||||
if (file == NULL)
|
||||
{
|
||||
bfd_nonfatal (filename);
|
||||
return_code = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (bfd_check_format (file, bfd_archive))
|
||||
display_archive (file);
|
||||
else
|
||||
display_bfd (file);
|
||||
|
||||
if (!bfd_close (file))
|
||||
{
|
||||
bfd_nonfatal (filename);
|
||||
return_code = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* This is what lexical functions are for. */
|
||||
|
||||
static int
|
||||
size_number (bfd_size_type num)
|
||||
{
|
||||
char buffer[40];
|
||||
|
||||
sprintf (buffer,
|
||||
(radix == decimal ? "%lu" :
|
||||
((radix == octal) ? "0%lo" : "0x%lx")),
|
||||
(unsigned long) num);
|
||||
|
||||
return strlen (buffer);
|
||||
}
|
||||
|
||||
static void
|
||||
rprint_number (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 (bfd *abfd ATTRIBUTE_UNUSED, sec_ptr sec,
|
||||
void *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 (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 (bfd *abfd)
|
||||
{
|
||||
static int files_seen = 0;
|
||||
bfd_size_type total;
|
||||
|
||||
bsssize = 0;
|
||||
datasize = 0;
|
||||
textsize = 0;
|
||||
|
||||
bfd_map_over_sections (abfd, berkeley_sum, NULL);
|
||||
|
||||
if (files_seen++ == 0)
|
||||
puts ((radix == octal) ? " text\t data\t bss\t oct\t hex\tfilename" :
|
||||
" text\t data\t bss\t dec\t hex\tfilename");
|
||||
|
||||
total = textsize + datasize + bsssize;
|
||||
|
||||
if (show_totals)
|
||||
{
|
||||
total_textsize += textsize;
|
||||
total_datasize += datasize;
|
||||
total_bsssize += 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 (bfd *file ATTRIBUTE_UNUSED, sec_ptr sec,
|
||||
void *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 (bfd *file ATTRIBUTE_UNUSED, sec_ptr sec,
|
||||
void *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 (bfd *file)
|
||||
{
|
||||
/* Size all of the columns. */
|
||||
svi_total = 0;
|
||||
svi_maxvma = 0;
|
||||
svi_namelen = 0;
|
||||
bfd_map_over_sections (file, sysv_internal_sizer, 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, NULL);
|
||||
|
||||
printf ("%-*s ", svi_namelen, "Total");
|
||||
rprint_number (svi_sizelen, svi_total);
|
||||
printf ("\n\n");
|
||||
}
|
||||
|
||||
static void
|
||||
print_sizes (bfd *file)
|
||||
{
|
||||
if (berkeley_format)
|
||||
print_berkeley_format (file);
|
||||
else
|
||||
print_sysv_format (file);
|
||||
}
|
||||
1881
binutils/srconv.c
1881
binutils/srconv.c
File diff suppressed because it is too large
Load Diff
5399
binutils/stabs.c
5399
binutils/stabs.c
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
||||
timestamp
|
||||
@@ -1,727 +0,0 @@
|
||||
/* strings -- print the strings of printable characters in files
|
||||
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
|
||||
2002, 2003, 2004, 2005 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., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
02110-1301, 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.)
|
||||
|
||||
--encoding={s,S,b,l,B,L}
|
||||
-e {s,S,b,l,B,L}
|
||||
Select character encoding: 7-bit-character, 8-bit-character,
|
||||
bigendian 16-bit, littleendian 16-bit, bigendian 32-bit,
|
||||
littleendian 32-bit.
|
||||
|
||||
--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>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#include "bfd.h"
|
||||
#include <stdio.h>
|
||||
#include "getopt.h"
|
||||
#include <errno.h>
|
||||
#include "bucomm.h"
|
||||
#include "libiberty.h"
|
||||
#include "safe-ctype.h"
|
||||
#include <sys/stat.h>
|
||||
|
||||
/* Some platforms need to put stdin into binary mode, to read
|
||||
binary files. */
|
||||
#ifdef HAVE_SETMODE
|
||||
#ifndef O_BINARY
|
||||
#ifdef _O_BINARY
|
||||
#define O_BINARY _O_BINARY
|
||||
#define setmode _setmode
|
||||
#else
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
#endif
|
||||
#if O_BINARY
|
||||
#include <io.h>
|
||||
#define SET_BINARY(f) do { if (!isatty (f)) setmode (f,O_BINARY); } while (0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define STRING_ISGRAPHIC(c) \
|
||||
( (c) >= 0 \
|
||||
&& (c) <= 255 \
|
||||
&& ((c) == '\t' || ISPRINT (c) || (encoding == 'S' && (c) > 127)))
|
||||
|
||||
#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)
|
||||
|
||||
#ifdef HAVE_FOPEN64
|
||||
typedef off64_t file_off;
|
||||
#define file_open(s,m) fopen64(s, m)
|
||||
#else
|
||||
typedef off_t file_off;
|
||||
#define file_open(s,m) fopen(s, m)
|
||||
#endif
|
||||
#ifdef HAVE_STAT64
|
||||
typedef struct stat64 statbuf;
|
||||
#define file_stat(f,s) stat64(f, s)
|
||||
#else
|
||||
typedef struct stat statbuf;
|
||||
#define file_stat(f,s) stat(f, s)
|
||||
#endif
|
||||
|
||||
/* 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 bfd_boolean print_addresses;
|
||||
|
||||
/* TRUE means print filename for each string. */
|
||||
static bfd_boolean print_filenames;
|
||||
|
||||
/* TRUE means for object files scan only the data section. */
|
||||
static bfd_boolean datasection_only;
|
||||
|
||||
/* TRUE if we found an initialized data section in the current file. */
|
||||
static bfd_boolean got_a_section;
|
||||
|
||||
/* The BFD object file format. */
|
||||
static char *target;
|
||||
|
||||
/* The character encoding format. */
|
||||
static char encoding;
|
||||
static int encoding_bytes;
|
||||
|
||||
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'},
|
||||
{"encoding", required_argument, NULL, 'e'},
|
||||
{"target", required_argument, NULL, 'T'},
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{"version", no_argument, NULL, 'v'},
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
/* Records the size of a named file so that we
|
||||
do not repeatedly run bfd_stat() on it. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char * filename;
|
||||
bfd_size_type filesize;
|
||||
} filename_and_size_t;
|
||||
|
||||
static void strings_a_section (bfd *, asection *, void *);
|
||||
static bfd_boolean strings_object_file (const char *);
|
||||
static bfd_boolean strings_file (char *file);
|
||||
static int integer_arg (char *s);
|
||||
static void print_strings (const char *, FILE *, file_off, int, int, char *);
|
||||
static void usage (FILE *, int);
|
||||
static long get_char (FILE *, file_off *, int *, char **);
|
||||
|
||||
int main (int, char **);
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int optc;
|
||||
int exit_status = 0;
|
||||
bfd_boolean files_given = FALSE;
|
||||
|
||||
#if defined (HAVE_SETLOCALE)
|
||||
setlocale (LC_ALL, "");
|
||||
#endif
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
program_name = argv[0];
|
||||
xmalloc_set_program_name (program_name);
|
||||
|
||||
expandargv (&argc, &argv);
|
||||
|
||||
string_min = -1;
|
||||
print_addresses = FALSE;
|
||||
print_filenames = FALSE;
|
||||
datasection_only = TRUE;
|
||||
target = NULL;
|
||||
encoding = 's';
|
||||
|
||||
while ((optc = getopt_long (argc, argv, "afhHn:ot:e:Vv0123456789",
|
||||
long_options, (int *) 0)) != EOF)
|
||||
{
|
||||
switch (optc)
|
||||
{
|
||||
case 'a':
|
||||
datasection_only = FALSE;
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
print_filenames = TRUE;
|
||||
break;
|
||||
|
||||
case 'H':
|
||||
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 'e':
|
||||
if (optarg[1] != '\0')
|
||||
usage (stderr, 1);
|
||||
encoding = optarg[0];
|
||||
break;
|
||||
|
||||
case 'V':
|
||||
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;
|
||||
|
||||
switch (encoding)
|
||||
{
|
||||
case 'S':
|
||||
case 's':
|
||||
encoding_bytes = 1;
|
||||
break;
|
||||
case 'b':
|
||||
case 'l':
|
||||
encoding_bytes = 2;
|
||||
break;
|
||||
case 'B':
|
||||
case 'L':
|
||||
encoding_bytes = 4;
|
||||
break;
|
||||
default:
|
||||
usage (stderr, 1);
|
||||
}
|
||||
|
||||
bfd_init ();
|
||||
set_default_bfd_target ();
|
||||
|
||||
if (optind >= argc)
|
||||
{
|
||||
datasection_only = FALSE;
|
||||
#ifdef SET_BINARY
|
||||
SET_BINARY (fileno (stdin));
|
||||
#endif
|
||||
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)
|
||||
usage (stderr, 1);
|
||||
|
||||
return (exit_status);
|
||||
}
|
||||
|
||||
/* Scan section SECT of the file ABFD, whose printable name is in
|
||||
ARG->filename and whose size might be in ARG->filesize. If it
|
||||
contains initialized data set `got_a_section' and print the
|
||||
strings in it.
|
||||
|
||||
FIXME: We ought to be able to return error codes/messages for
|
||||
certain conditions. */
|
||||
|
||||
static void
|
||||
strings_a_section (bfd *abfd, asection *sect, void *arg)
|
||||
{
|
||||
filename_and_size_t * filename_and_sizep;
|
||||
bfd_size_type *filesizep;
|
||||
bfd_size_type sectsize;
|
||||
void *mem;
|
||||
|
||||
if ((sect->flags & DATA_FLAGS) != DATA_FLAGS)
|
||||
return;
|
||||
|
||||
sectsize = bfd_get_section_size (sect);
|
||||
|
||||
if (sectsize <= 0)
|
||||
return;
|
||||
|
||||
/* Get the size of the file. This might have been cached for us. */
|
||||
filename_and_sizep = (filename_and_size_t *) arg;
|
||||
filesizep = & filename_and_sizep->filesize;
|
||||
|
||||
if (*filesizep == 0)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
if (bfd_stat (abfd, &st))
|
||||
return;
|
||||
|
||||
/* Cache the result so that we do not repeatedly stat this file. */
|
||||
*filesizep = st.st_size;
|
||||
}
|
||||
|
||||
/* Compare the size of the section against the size of the file.
|
||||
If the section is bigger then the file must be corrupt and
|
||||
we should not try dumping it. */
|
||||
if (sectsize >= *filesizep)
|
||||
return;
|
||||
|
||||
mem = xmalloc (sectsize);
|
||||
|
||||
if (bfd_get_section_contents (abfd, sect, mem, (file_ptr) 0, sectsize))
|
||||
{
|
||||
got_a_section = TRUE;
|
||||
|
||||
print_strings (filename_and_sizep->filename, NULL, sect->filepos,
|
||||
0, sectsize, 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 bfd_boolean
|
||||
strings_object_file (const char *file)
|
||||
{
|
||||
filename_and_size_t filename_and_size;
|
||||
bfd *abfd;
|
||||
|
||||
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))
|
||||
{
|
||||
bfd_close (abfd);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
got_a_section = FALSE;
|
||||
filename_and_size.filename = file;
|
||||
filename_and_size.filesize = 0;
|
||||
bfd_map_over_sections (abfd, strings_a_section, & filename_and_size);
|
||||
|
||||
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 bfd_boolean
|
||||
strings_file (char *file)
|
||||
{
|
||||
statbuf st;
|
||||
|
||||
if (file_stat (file, &st) < 0)
|
||||
{
|
||||
if (errno == ENOENT)
|
||||
non_fatal (_("'%s': No such file"), file);
|
||||
else
|
||||
non_fatal (_("Warning: could not locate '%s'. reason: %s"),
|
||||
file, strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* 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 = file_open (file, FOPEN_RB);
|
||||
if (stream == NULL)
|
||||
{
|
||||
fprintf (stderr, "%s: ", program_name);
|
||||
perror (file);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
print_strings (file, stream, (file_off) 0, 0, 0, (char *) 0);
|
||||
|
||||
if (fclose (stream) == EOF)
|
||||
{
|
||||
fprintf (stderr, "%s: ", program_name);
|
||||
perror (file);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Read the next character, return EOF if none available.
|
||||
Assume that STREAM is positioned so that the next byte read
|
||||
is at address ADDRESS in the file.
|
||||
|
||||
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. */
|
||||
|
||||
static long
|
||||
get_char (FILE *stream, file_off *address, int *magiccount, char **magic)
|
||||
{
|
||||
int c, i;
|
||||
long r = EOF;
|
||||
unsigned char buf[4];
|
||||
|
||||
for (i = 0; i < encoding_bytes; i++)
|
||||
{
|
||||
if (*magiccount)
|
||||
{
|
||||
(*magiccount)--;
|
||||
c = *(*magic)++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (stream == NULL)
|
||||
return EOF;
|
||||
|
||||
/* Only use getc_unlocked if we found a declaration for it.
|
||||
Otherwise, libc is not thread safe by default, and we
|
||||
should not use it. */
|
||||
|
||||
#if defined(HAVE_GETC_UNLOCKED) && HAVE_DECL_GETC_UNLOCKED
|
||||
c = getc_unlocked (stream);
|
||||
#else
|
||||
c = getc (stream);
|
||||
#endif
|
||||
if (c == EOF)
|
||||
return EOF;
|
||||
}
|
||||
|
||||
(*address)++;
|
||||
buf[i] = c;
|
||||
}
|
||||
|
||||
switch (encoding)
|
||||
{
|
||||
case 'S':
|
||||
case 's':
|
||||
r = buf[0];
|
||||
break;
|
||||
case 'b':
|
||||
r = (buf[0] << 8) | buf[1];
|
||||
break;
|
||||
case 'l':
|
||||
r = buf[0] | (buf[1] << 8);
|
||||
break;
|
||||
case 'B':
|
||||
r = ((long) buf[0] << 24) | ((long) buf[1] << 16) |
|
||||
((long) buf[2] << 8) | buf[3];
|
||||
break;
|
||||
case 'L':
|
||||
r = buf[0] | ((long) buf[1] << 8) | ((long) buf[2] << 16) |
|
||||
((long) buf[3] << 24);
|
||||
break;
|
||||
}
|
||||
|
||||
if (r == EOF)
|
||||
return 0;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/* 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 (const char *filename, FILE *stream, file_off address,
|
||||
int stop_point, int magiccount, char *magic)
|
||||
{
|
||||
char *buf = (char *) xmalloc (sizeof (char) * (string_min + 1));
|
||||
|
||||
while (1)
|
||||
{
|
||||
file_off start;
|
||||
int i;
|
||||
long 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++)
|
||||
{
|
||||
c = get_char (stream, &address, &magiccount, &magic);
|
||||
if (c == EOF)
|
||||
return;
|
||||
if (! STRING_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:
|
||||
#if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2)
|
||||
if (sizeof (start) > sizeof (long))
|
||||
printf ("%7Lo ", (unsigned long long) start);
|
||||
else
|
||||
#else
|
||||
# if !BFD_HOST_64BIT_LONG
|
||||
if (start != (unsigned long) start)
|
||||
printf ("++%7lo ", (unsigned long) start);
|
||||
else
|
||||
# endif
|
||||
#endif
|
||||
printf ("%7lo ", (unsigned long) start);
|
||||
break;
|
||||
|
||||
case 10:
|
||||
#if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2)
|
||||
if (sizeof (start) > sizeof (long))
|
||||
printf ("%7Ld ", (unsigned long long) start);
|
||||
else
|
||||
#else
|
||||
# if !BFD_HOST_64BIT_LONG
|
||||
if (start != (unsigned long) start)
|
||||
printf ("++%7ld ", (unsigned long) start);
|
||||
else
|
||||
# endif
|
||||
#endif
|
||||
printf ("%7ld ", (long) start);
|
||||
break;
|
||||
|
||||
case 16:
|
||||
#if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2)
|
||||
if (sizeof (start) > sizeof (long))
|
||||
printf ("%7Lx ", (unsigned long long) start);
|
||||
else
|
||||
#else
|
||||
# if !BFD_HOST_64BIT_LONG
|
||||
if (start != (unsigned long) start)
|
||||
printf ("%lx%8.8lx ", (unsigned long) (start >> 32),
|
||||
(unsigned long) (start & 0xffffffff));
|
||||
else
|
||||
# endif
|
||||
#endif
|
||||
printf ("%7lx ", (unsigned long) start);
|
||||
break;
|
||||
}
|
||||
|
||||
buf[i] = '\0';
|
||||
fputs (buf, stdout);
|
||||
|
||||
while (1)
|
||||
{
|
||||
c = get_char (stream, &address, &magiccount, &magic);
|
||||
if (c == EOF)
|
||||
break;
|
||||
if (! STRING_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 (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 (FILE *stream, int status)
|
||||
{
|
||||
fprintf (stream, _("Usage: %s [option(s)] [file(s)]\n"), program_name);
|
||||
fprintf (stream, _(" Display printable strings in [file(s)] (stdin by default)\n"));
|
||||
fprintf (stream, _(" The options are:\n\
|
||||
-a - --all Scan the entire file, not just the data section\n\
|
||||
-f --print-file-name Print the name of the file before each string\n\
|
||||
-n --bytes=[number] Locate & print any NUL-terminated sequence of at\n\
|
||||
-<number> least [number] characters (default 4).\n\
|
||||
-t --radix={o,d,x} Print the location of the string in base 8, 10 or 16\n\
|
||||
-o An alias for --radix=o\n\
|
||||
-T --target=<BFDNAME> Specify the binary file format\n\
|
||||
-e --encoding={s,S,b,l,B,L} Select character size and endianness:\n\
|
||||
s = 7-bit, S = 8-bit, {b,l} = 16-bit, {B,L} = 32-bit\n\
|
||||
@<file> Read options from <file>\n\
|
||||
-h --help Display this information\n\
|
||||
-v --version Print the program's version number\n"));
|
||||
list_supported_targets (program_name, stream);
|
||||
if (status == 0)
|
||||
fprintf (stream, _("Report bugs to %s\n"), REPORT_BUGS_TO);
|
||||
exit (status);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user