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> 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.h: New exported funtion from bucomm.c: non_fatal().
* bucomm.c (non_fatal): New exported function. Just like fatal() * bucomm.c (non_fatal): New exported function. Just like fatal()
except that it returns rather than calling xexit(). 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 ] [ -p | --preserve-dates ] [ --debugging ]
[ --gap-fill=@var{val} ] [ --pad-to=@var{address} ] [ --gap-fill=@var{val} ] [ --pad-to=@var{address} ]
[ --set-start=@var{val} ] [ --adjust-start=@var{incr} ] [ --set-start=@var{val} ] [ --adjust-start=@var{incr} ]
[ --adjust-vma=@var{incr} ] [ --change-addresses=@var{incr} ]
[ --adjust-section-vma=@var{section}@{=,+,-@}@var{val} ] [ --change-section-address=@var{section}@{=,+,-@}@var{val} ]
[ --adjust-warnings ] [ --no-adjust-warnings ] [ --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} ] [ --set-section-flags=@var{section}=@var{flags} ]
[ --add-section=@var{sectionname}=@var{filename} ] [ --add-section=@var{sectionname}=@var{filename} ]
[ --change-leading-char ] [ --remove-leading-char ] [ --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 Set the address of the new file to @var{val}. Not all object file
formats support setting the start address. formats support setting the start address.
@item --adjust-start @var{incr} @item --change-start @var{incr}
Adjust the start address by adding @var{incr}. Not all object file @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. formats support setting the start address.
@item --adjust-vma @var{incr} @item --change-addresses @var{incr}
Adjust the address of all sections, as well as the start address, by @itemx --adjust-vma @var{incr}
adding @var{incr}. Some object file formats do not permit section @cindex changing object addresses
addresses to be changed arbitrarily. Note that this does not relocate Change the VMA and LMA addresses of all sections, as well as the start
the sections; if the program expects sections to be loaded at a certain address, by adding @var{incr}. Some object file formats do not permit
address, and this option is used to change the sections such that they section addresses to be changed arbitrarily. Note that this does not
are loaded at a different address, the program may fail. 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} @item --change-section-address @var{section}@{=,+,-@}@var{val}
Set or adjust the address of the named @var{section}. If @samp{=} is @itemx --adjust-section-vma @var{section}@{=,+,-@}@var{val}
used, the section address is set to @var{val}. Otherwise, @var{val} is @cindex changing section address
added to or subtracted from the section address. See the comments under Set or change both the VMA address and the LMA address of the named
@samp{--adjust-vma}, above. If @var{section} does not exist in the @var{section}. If @samp{=} is used, the section address is set to
input file, a warning will be issued, unless @samp{--no-adjust-warnings} @var{val}. Otherwise, @var{val} is added to or subtracted from the
is used. 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 @item --change-section-lma @var{section}@{=,+,-@}@var{val}
If @samp{--adjust-section-vma} is used, and the named section does not @cindex changing section LMA
exist, issue a warning. This is the default. 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 @item --change-section-vma @var{section}@{=,+,-@}@var{val}
Do not issue a warning if @samp{--adjust-section-vma} is used, even if @cindex changing section VMA
the named section does not exist. 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} @item --set-section-flags @var{section}=@var{flags}
Set the flags for the named section. The @var{flags} argument is a 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 "[\|" \-\-gap\-fill=\fIval\fR "\|]"
.RB "[\|" \-\-pad\-to=\fIaddress\fR "\|]" .RB "[\|" \-\-pad\-to=\fIaddress\fR "\|]"
.RB "[\|" \-\-set\-start=\fIval\fR "\|]" .RB "[\|" \-\-set\-start=\fIval\fR "\|]"
.RB "[\|" \-\-adjust\-start=\fIincr\fR "\|]" .RB "[\|" \-\-change\-start=\fIincr\fR "\|]"
.RB "[\|" \-\-adjust\-vma=\fIincr\fR "\|]" .RB "[\|" \-\-change\-addresses=\fIincr\fR "\|]"
.RB "[\|" \-\-adjust\-section\-vma=\fIsection{=,+,-}val\fR "\|]" .RB "[\|" \-\-change\-section\-address=\fIsection{=,+,-}val\fR "\|]"
.RB "[\|" \-\-adjust\-warnings\fR "\|]" .RB "[\|" \-\-change\-section\-lma=\fIsection{=,+,-}val\fR "\|]"
.RB "[\|" \-\-no\-adjust\-warnings\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 "[\|" \-\-set\-section\-flags=\fIsection=flags\fR "\|]"
.RB "[\|" \-\-add\-section=\fIsectionname=filename\fR "\|]" .RB "[\|" \-\-add\-section=\fIsectionname=filename\fR "\|]"
.RB "[\|" \-\-change\-leading\-char\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 Set the start address of the new file to \fIval\fP. Not all object
file formats support setting the start address. file formats support setting the start address.
.TP .TP
.B \fB\-\-adjust\-start=\fIincr .B \fB\-\-change\-start=\fIincr\fR, \fB\-\-adjust\-start=\fIincr
Adjust the start address by adding \fIincr\fP. Not all object file Changes the start address by adding \fIincr\fP. Not all object file
formats support setting the start address. formats support setting the start address.
.TP .TP
.B \fB\-\-adjust\-vma=\fIincr .B \fB\-\-change\-addresses=\fIincr\fR, \fB\-\-adjust\-vma=\fIincr
Adjust the address of all sections, as well as the start address, by Changes the address of all sections, as well as the start address, by
adding \fIincr\fP. Some object file formats do not permit section adding \fIincr\fP. Some object file formats do not permit section
addresses to be changed arbitrarily. Note that this does not relocate addresses to be changed arbitrarily. Note that this does not relocate
the sections; if the program expects sections to be loaded at a the sections; if the program expects sections to be loaded at a
certain address, and this option is used to change the sections such certain address, and this option is used to change the sections such
that they are loaded at a different address, the program may fail. that they are loaded at a different address, the program may fail.
.TP .TP
.B \fB\-\-adjust\-section\-vma=\fIsection{=,+,-}val .B \fB\-\-change\-section\-address=\fIsection{=,+,-}val\fR, \fB\-\-adjust\-section\-vma=\fIsection{=,+,-}val
Set or adjust the address of the named \fIsection\fP. If \fI=\fP is 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 used, the section address is set to \fIval\fP. Otherwise, \fIval\fP
is added to or subtracted from the section address. See the comments 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 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 .TP
.B \fB\-\-adjust\-warnings .B \fB\-\-change\-section\-vma=\fIsection{=,+,-}val
If \fB\-\-adjust\-section\-vma\fP is used, and the named section does 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. not exist, issue a warning. This is the default.
.TP .TP
.B \fB\-\-no\-adjust\-warnings .B \fB\-\-no\-change\-warnings\fR, \fB\-\-no\-adjust\-warnings
Do not issue a warning if \fB\-\-adjust\-section\-vma\fP is used, even Do not issue a warning if \fB\-\-change\-section\-XXX\fP is used, even
if the named section does not exist. if the named section does not exist.
.TP .TP
.B \fB\-\-set\-section\-flags=\fIsection=flags .B \fB\-\-set\-section\-flags=\fIsection=flags

File diff suppressed because it is too large Load diff