Implemented new command line options: --change-section-vma and --change-section-lma.

Tidied up the code.
This commit is contained in:
Nick Clifton 1998-06-03 22:54:50 +00:00
parent 77be9a8a19
commit 537b2e5e86
4 changed files with 429 additions and 353 deletions

View File

@ -1,5 +1,21 @@
Wed Jun 3 12:09:40 1998 Nick Clifton <nickc@cygnus.com>
* objcopy.c: Add new command line options: --change-section-lma
and --change-section-vma. Rename old command line option
--adjust-section-vma to --change-section-address. Rename
--adjust-vma to --change-addresses and --adjust-start to
--change-start. Provide aliases to support the old versions of
these command line options.
Change the names of macros and enum elements to upper case to
match the GNU coding standard.
Replace calls to fprintf (stderr,...) with calls to fatal () or
non_fatal () as appropriate.
* objcopy.1: Document command line option changes.
* binutils.texi: Document command line option changes.
* bucomm.h: New exported funtion from bucomm.c: non_fatal().
* bucomm.c (non_fatal): New exported function. Just like fatal()
except that it returns rather than calling xexit().

View File

@ -837,9 +837,11 @@ objcopy [ -F @var{bfdname} | --target=@var{bfdname} ]
[ -p | --preserve-dates ] [ --debugging ]
[ --gap-fill=@var{val} ] [ --pad-to=@var{address} ]
[ --set-start=@var{val} ] [ --adjust-start=@var{incr} ]
[ --adjust-vma=@var{incr} ]
[ --adjust-section-vma=@var{section}@{=,+,-@}@var{val} ]
[ --adjust-warnings ] [ --no-adjust-warnings ]
[ --change-addresses=@var{incr} ]
[ --change-section-address=@var{section}@{=,+,-@}@var{val} ]
[ --change-section-lma=@var{section}@{=,+,-@}@var{val} ]
[ --change-section-vma=@var{section}@{=,+,-@}@var{val} ]
[ --change-warnings ] [ --no-change-warnings ]
[ --set-section-flags=@var{section}=@var{flags} ]
[ --add-section=@var{sectionname}=@var{filename} ]
[ --change-leading-char ] [ --remove-leading-char ]
@ -986,33 +988,70 @@ filled in with the value specified by @samp{--gap-fill} (default zero).
Set the address of the new file to @var{val}. Not all object file
formats support setting the start address.
@item --adjust-start @var{incr}
Adjust the start address by adding @var{incr}. Not all object file
@item --change-start @var{incr}
@itemx --adjust-start @var{incr}
@cindex changing start address
Change the start address by adding @var{incr}. Not all object file
formats support setting the start address.
@item --adjust-vma @var{incr}
Adjust the address of all sections, as well as the start address, by
adding @var{incr}. Some object file formats do not permit section
addresses to be changed arbitrarily. Note that this does not relocate
the sections; if the program expects sections to be loaded at a certain
address, and this option is used to change the sections such that they
are loaded at a different address, the program may fail.
@item --change-addresses @var{incr}
@itemx --adjust-vma @var{incr}
@cindex changing object addresses
Change the VMA and LMA addresses of all sections, as well as the start
address, by adding @var{incr}. Some object file formats do not permit
section addresses to be changed arbitrarily. Note that this does not
relocate the sections; if the program expects sections to be loaded at a
certain address, and this option is used to change the sections such
that they are loaded at a different address, the program may fail.
@item --adjust-section-vma @var{section}@{=,+,-@}@var{val}
Set or adjust the address of the named @var{section}. If @samp{=} is
used, the section address is set to @var{val}. Otherwise, @var{val} is
added to or subtracted from the section address. See the comments under
@samp{--adjust-vma}, above. If @var{section} does not exist in the
input file, a warning will be issued, unless @samp{--no-adjust-warnings}
is used.
@item --change-section-address @var{section}@{=,+,-@}@var{val}
@itemx --adjust-section-vma @var{section}@{=,+,-@}@var{val}
@cindex changing section address
Set or change both the VMA address and the LMA address of the named
@var{section}. If @samp{=} is used, the section address is set to
@var{val}. Otherwise, @var{val} is added to or subtracted from the
section address. See the comments under @samp{--change-addresses},
above. If @var{section} does not exist in the input file, a warning will
be issued, unless @samp{--no-change-warnings} is used.
@item --adjust-warnings
If @samp{--adjust-section-vma} is used, and the named section does not
exist, issue a warning. This is the default.
@item --change-section-lma @var{section}@{=,+,-@}@var{val}
@cindex changing section LMA
Set or change the LMA address of the named @var{section}. The LMA
address is the address where the section will be loaded into memory at
program load time. Normally this is the same as the VMA address, which
is the address of the section at program run time, but on some systems,
especially those where a program is held in ROM, the two can be
different. If @samp{=} is used, the section address is set to
@var{val}. Otherwise, @var{val} is added to or subtracted from the
section address. See the comments under @samp{--change-addresses},
above. If @var{section} does not exist in the input file, a warning
will be issued, unless @samp{--no-change-warnings} is used.
@item --no-adjust-warnings
Do not issue a warning if @samp{--adjust-section-vma} is used, even if
the named section does not exist.
@item --change-section-vma @var{section}@{=,+,-@}@var{val}
@cindex changing section VMA
Set or change the VMA address of the named @var{section}. The VMA
address is the address where the section will be located once the
program has started executing. Normally this is the same as the LMA
address, which is the address where the section will be loaded into
memory, but on some systems, especially those where a program is held in
ROM, the two can be different. If @samp{=} is used, the section address
is set to @var{val}. Otherwise, @var{val} is added to or subtracted
from the section address. See the comments under
@samp{--change-addresses}, above. If @var{section} does not exist in
the input file, a warning will be issued, unless
@samp{--no-change-warnings} is used.
@item --change-warnings
@itemx --adjust-warnings
If @samp{--change-section-address} or @samp{--change-section-lma} or
@samp{--change-section-vma} is used, and the named section does not
exist, issue a warning. This is the default.
@item --no-change-warnings
@itemx --no-adjust-warnings
Do not issue a warning if @samp{--change-section-address} or
@samp{--adjust-section-lma} or @samp{--adjust-section-vma} is used, even
if the named section does not exist.
@item --set-section-flags @var{section}=@var{flags}
Set the flags for the named section. The @var{flags} argument is a

View File

@ -35,11 +35,13 @@ objcopy \- copy and translate object files
.RB "[\|" \-\-gap\-fill=\fIval\fR "\|]"
.RB "[\|" \-\-pad\-to=\fIaddress\fR "\|]"
.RB "[\|" \-\-set\-start=\fIval\fR "\|]"
.RB "[\|" \-\-adjust\-start=\fIincr\fR "\|]"
.RB "[\|" \-\-adjust\-vma=\fIincr\fR "\|]"
.RB "[\|" \-\-adjust\-section\-vma=\fIsection{=,+,-}val\fR "\|]"
.RB "[\|" \-\-adjust\-warnings\fR "\|]"
.RB "[\|" \-\-no\-adjust\-warnings\fR "\|]"
.RB "[\|" \-\-change\-start=\fIincr\fR "\|]"
.RB "[\|" \-\-change\-addresses=\fIincr\fR "\|]"
.RB "[\|" \-\-change\-section\-address=\fIsection{=,+,-}val\fR "\|]"
.RB "[\|" \-\-change\-section\-lma=\fIsection{=,+,-}val\fR "\|]"
.RB "[\|" \-\-change\-section\-vma=\fIsection{=,+,-}val\fR "\|]"
.RB "[\|" \-\-change\-warnings\fR "\|]"
.RB "[\|" \-\-no\-change\-warnings\fR "\|]"
.RB "[\|" \-\-set\-section\-flags=\fIsection=flags\fR "\|]"
.RB "[\|" \-\-add\-section=\fIsectionname=filename\fR "\|]"
.RB "[\|" \-\-change\-leading\-char\fR "\|]"
@ -193,32 +195,48 @@ zero).
Set the start address of the new file to \fIval\fP. Not all object
file formats support setting the start address.
.TP
.B \fB\-\-adjust\-start=\fIincr
Adjust the start address by adding \fIincr\fP. Not all object file
.B \fB\-\-change\-start=\fIincr\fR, \fB\-\-adjust\-start=\fIincr
Changes the start address by adding \fIincr\fP. Not all object file
formats support setting the start address.
.TP
.B \fB\-\-adjust\-vma=\fIincr
Adjust the address of all sections, as well as the start address, by
.B \fB\-\-change\-addresses=\fIincr\fR, \fB\-\-adjust\-vma=\fIincr
Changes the address of all sections, as well as the start address, by
adding \fIincr\fP. Some object file formats do not permit section
addresses to be changed arbitrarily. Note that this does not relocate
the sections; if the program expects sections to be loaded at a
certain address, and this option is used to change the sections such
that they are loaded at a different address, the program may fail.
.TP
.B \fB\-\-adjust\-section\-vma=\fIsection{=,+,-}val
Set or adjust the address of the named \fIsection\fP. If \fI=\fP is
.B \fB\-\-change\-section\-address=\fIsection{=,+,-}val\fR, \fB\-\-adjust\-section\-vma=\fIsection{=,+,-}val
Set or changes the VMA and LMA addresses of the named \fIsection\fP.
If \fI=\fP is used, the section address is set to \fIval\fP.
Otherwise, \fIval\fP is added to or subtracted from the section
address. See the comments under \fB\-\-change\-addresses\fP, above. If
\fIsection\fP does not exist in the input file, a warning will be
issued, unless \fB\-\-no\-change\-warnings\fP is used.
.TP
.B \fB\-\-change\-section\-lma=\fIsection{=,+,-}val
Set or change the LMA address of the named \fIsection\fP. If \fI=\fP is
used, the section address is set to \fIval\fP. Otherwise, \fIval\fP
is added to or subtracted from the section address. See the comments
under \fB\-\-adjust\-vma\fP, above. If \fIsection\fP does not exist
under \fB\-\-change\-addresses\fP, above. If \fIsection\fP does not exist
in the input file, a warning will be issued, unless
\fB\-\-no\-adjust\-warnings\fP is used.
\fB\-\-no\-change\-warnings\fP is used.
.TP
.B \fB\-\-adjust\-warnings
If \fB\-\-adjust\-section\-vma\fP is used, and the named section does
.B \fB\-\-change\-section\-vma=\fIsection{=,+,-}val
Set or change the VMA address of the named \fIsection\fP. If \fI=\fP is
used, the section address is set to \fIval\fP. Otherwise, \fIval\fP
is added to or subtracted from the section address. See the comments
under \fB\-\-change\-addresses\fP, above. If \fIsection\fP does not exist
in the input file, a warning will be issued, unless
\fB\-\-no\-change\-warnings\fP is used.
.TP
.B \fB\-\-change\-warnings\fR, \fB\-\-adjust\-warnings
If \fB\-\-change\-section\-XXX\fP is used, and the named section does
not exist, issue a warning. This is the default.
.TP
.B \fB\-\-no\-adjust\-warnings
Do not issue a warning if \fB\-\-adjust\-section\-vma\fP is used, even
.B \fB\-\-no\-change\-warnings\fR, \fB\-\-no\-adjust\-warnings
Do not issue a warning if \fB\-\-change\-section\-XXX\fP is used, even
if the named section does not exist.
.TP
.B \fB\-\-set\-section\-flags=\fIsection=flags

File diff suppressed because it is too large Load Diff