mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-29 14:16:31 +00:00
elf2flt: upgrade to latest version
Upgrade to the latest uclinux CVS snapshot, gives us blackfin support. Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
This commit is contained in:
parent
177549dcbe
commit
338aee6ca6
@ -1,6 +1,6 @@
|
|||||||
config BR2_PACKAGE_HOST_ELF2FLT
|
config BR2_PACKAGE_HOST_ELF2FLT
|
||||||
bool "Enable elf2flt support?"
|
bool "Enable elf2flt support?"
|
||||||
depends on BR2_arm || BR2_sh || BR2_sparc
|
depends on BR2_arm || BR2_bfin || BR2_sh || BR2_sparc
|
||||||
help
|
help
|
||||||
uCLinux uses a Binary Flat format commonly known as BFLT. It
|
uCLinux uses a Binary Flat format commonly known as BFLT. It
|
||||||
is a relatively simple and lightweight executable format
|
is a relatively simple and lightweight executable format
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
#
|
#
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
ELF2FLT_SOURCE =
|
ELF2FLT_VERSION = 20130904
|
||||||
HOST_ELF2FLT_SOURCE =
|
ELF2FLT_SITE = cvs://cvs.uclinux.org:/var/cvs
|
||||||
ELF2FLT_VERSION = cvs
|
ELF2FLT_SITE_METHOD = cvs
|
||||||
ELF2FLT_LICENSE = GPLv2+
|
ELF2FLT_LICENSE = GPLv2+
|
||||||
ELF2FLT_LICENSE_FILES = LICENSE.TXT
|
ELF2FLT_LICENSE_FILES = LICENSE.TXT
|
||||||
|
|
||||||
@ -23,8 +23,4 @@ HOST_ELF2FLT_CONF_OPT = \
|
|||||||
|
|
||||||
HOST_ELF2FLT_CONF_ENV = LIBS=-lz
|
HOST_ELF2FLT_CONF_ENV = LIBS=-lz
|
||||||
|
|
||||||
define HOST_ELF2FLT_EXTRACT_CMDS
|
|
||||||
cp -r package/elf2flt/src/* $(@D)
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(eval $(host-autotools-package))
|
$(eval $(host-autotools-package))
|
||||||
|
@ -1,340 +0,0 @@
|
|||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
Version 2, June 1991
|
|
||||||
|
|
||||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
|
||||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The licenses for most software are designed to take away your
|
|
||||||
freedom to share and change it. By contrast, the GNU General Public
|
|
||||||
License is intended to guarantee your freedom to share and change free
|
|
||||||
software--to make sure the software is free for all its users. This
|
|
||||||
General Public License applies to most of the Free Software
|
|
||||||
Foundation's software and to any other program whose authors commit to
|
|
||||||
using it. (Some other Free Software Foundation software is covered by
|
|
||||||
the GNU Library General Public License instead.) You can apply it to
|
|
||||||
your programs, too.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
this service if you wish), that you receive source code or can get it
|
|
||||||
if you want it, that you can change the software or use pieces of it
|
|
||||||
in new free programs; and that you know you can do these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to make restrictions that forbid
|
|
||||||
anyone to deny you these rights or to ask you to surrender the rights.
|
|
||||||
These restrictions translate to certain responsibilities for you if you
|
|
||||||
distribute copies of the software, or if you modify it.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
|
||||||
gratis or for a fee, you must give the recipients all the rights that
|
|
||||||
you have. You must make sure that they, too, receive or can get the
|
|
||||||
source code. And you must show them these terms so they know their
|
|
||||||
rights.
|
|
||||||
|
|
||||||
We protect your rights with two steps: (1) copyright the software, and
|
|
||||||
(2) offer you this license which gives you legal permission to copy,
|
|
||||||
distribute and/or modify the software.
|
|
||||||
|
|
||||||
Also, for each author's protection and ours, we want to make certain
|
|
||||||
that everyone understands that there is no warranty for this free
|
|
||||||
software. If the software is modified by someone else and passed on, we
|
|
||||||
want its recipients to know that what they have is not the original, so
|
|
||||||
that any problems introduced by others will not reflect on the original
|
|
||||||
authors' reputations.
|
|
||||||
|
|
||||||
Finally, any free program is threatened constantly by software
|
|
||||||
patents. We wish to avoid the danger that redistributors of a free
|
|
||||||
program will individually obtain patent licenses, in effect making the
|
|
||||||
program proprietary. To prevent this, we have made it clear that any
|
|
||||||
patent must be licensed for everyone's free use or not licensed at all.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
||||||
|
|
||||||
0. This License applies to any program or other work which contains
|
|
||||||
a notice placed by the copyright holder saying it may be distributed
|
|
||||||
under the terms of this General Public License. The "Program", below,
|
|
||||||
refers to any such program or work, and a "work based on the Program"
|
|
||||||
means either the Program or any derivative work under copyright law:
|
|
||||||
that is to say, a work containing the Program or a portion of it,
|
|
||||||
either verbatim or with modifications and/or translated into another
|
|
||||||
language. (Hereinafter, translation is included without limitation in
|
|
||||||
the term "modification".) Each licensee is addressed as "you".
|
|
||||||
|
|
||||||
Activities other than copying, distribution and modification are not
|
|
||||||
covered by this License; they are outside its scope. The act of
|
|
||||||
running the Program is not restricted, and the output from the Program
|
|
||||||
is covered only if its contents constitute a work based on the
|
|
||||||
Program (independent of having been made by running the Program).
|
|
||||||
Whether that is true depends on what the Program does.
|
|
||||||
|
|
||||||
1. You may copy and distribute verbatim copies of the Program's
|
|
||||||
source code as you receive it, in any medium, provided that you
|
|
||||||
conspicuously and appropriately publish on each copy an appropriate
|
|
||||||
copyright notice and disclaimer of warranty; keep intact all the
|
|
||||||
notices that refer to this License and to the absence of any warranty;
|
|
||||||
and give any other recipients of the Program a copy of this License
|
|
||||||
along with the Program.
|
|
||||||
|
|
||||||
You may charge a fee for the physical act of transferring a copy, and
|
|
||||||
you may at your option offer warranty protection in exchange for a fee.
|
|
||||||
|
|
||||||
2. You may modify your copy or copies of the Program or any portion
|
|
||||||
of it, thus forming a work based on the Program, and copy and
|
|
||||||
distribute such modifications or work under the terms of Section 1
|
|
||||||
above, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) You must cause the modified files to carry prominent notices
|
|
||||||
stating that you changed the files and the date of any change.
|
|
||||||
|
|
||||||
b) You must cause any work that you distribute or publish, that in
|
|
||||||
whole or in part contains or is derived from the Program or any
|
|
||||||
part thereof, to be licensed as a whole at no charge to all third
|
|
||||||
parties under the terms of this License.
|
|
||||||
|
|
||||||
c) If the modified program normally reads commands interactively
|
|
||||||
when run, you must cause it, when started running for such
|
|
||||||
interactive use in the most ordinary way, to print or display an
|
|
||||||
announcement including an appropriate copyright notice and a
|
|
||||||
notice that there is no warranty (or else, saying that you provide
|
|
||||||
a warranty) and that users may redistribute the program under
|
|
||||||
these conditions, and telling the user how to view a copy of this
|
|
||||||
License. (Exception: if the Program itself is interactive but
|
|
||||||
does not normally print such an announcement, your work based on
|
|
||||||
the Program is not required to print an announcement.)
|
|
||||||
|
|
||||||
These requirements apply to the modified work as a whole. If
|
|
||||||
identifiable sections of that work are not derived from the Program,
|
|
||||||
and can be reasonably considered independent and separate works in
|
|
||||||
themselves, then this License, and its terms, do not apply to those
|
|
||||||
sections when you distribute them as separate works. But when you
|
|
||||||
distribute the same sections as part of a whole which is a work based
|
|
||||||
on the Program, the distribution of the whole must be on the terms of
|
|
||||||
this License, whose permissions for other licensees extend to the
|
|
||||||
entire whole, and thus to each and every part regardless of who wrote it.
|
|
||||||
|
|
||||||
Thus, it is not the intent of this section to claim rights or contest
|
|
||||||
your rights to work written entirely by you; rather, the intent is to
|
|
||||||
exercise the right to control the distribution of derivative or
|
|
||||||
collective works based on the Program.
|
|
||||||
|
|
||||||
In addition, mere aggregation of another work not based on the Program
|
|
||||||
with the Program (or with a work based on the Program) on a volume of
|
|
||||||
a storage or distribution medium does not bring the other work under
|
|
||||||
the scope of this License.
|
|
||||||
|
|
||||||
3. You may copy and distribute the Program (or a work based on it,
|
|
||||||
under Section 2) in object code or executable form under the terms of
|
|
||||||
Sections 1 and 2 above provided that you also do one of the following:
|
|
||||||
|
|
||||||
a) Accompany it with the complete corresponding machine-readable
|
|
||||||
source code, which must be distributed under the terms of Sections
|
|
||||||
1 and 2 above on a medium customarily used for software interchange; or,
|
|
||||||
|
|
||||||
b) Accompany it with a written offer, valid for at least three
|
|
||||||
years, to give any third party, for a charge no more than your
|
|
||||||
cost of physically performing source distribution, a complete
|
|
||||||
machine-readable copy of the corresponding source code, to be
|
|
||||||
distributed under the terms of Sections 1 and 2 above on a medium
|
|
||||||
customarily used for software interchange; or,
|
|
||||||
|
|
||||||
c) Accompany it with the information you received as to the offer
|
|
||||||
to distribute corresponding source code. (This alternative is
|
|
||||||
allowed only for noncommercial distribution and only if you
|
|
||||||
received the program in object code or executable form with such
|
|
||||||
an offer, in accord with Subsection b above.)
|
|
||||||
|
|
||||||
The source code for a work means the preferred form of the work for
|
|
||||||
making modifications to it. For an executable work, complete source
|
|
||||||
code means all the source code for all modules it contains, plus any
|
|
||||||
associated interface definition files, plus the scripts used to
|
|
||||||
control compilation and installation of the executable. However, as a
|
|
||||||
special exception, the source code distributed need not include
|
|
||||||
anything that is normally distributed (in either source or binary
|
|
||||||
form) with the major components (compiler, kernel, and so on) of the
|
|
||||||
operating system on which the executable runs, unless that component
|
|
||||||
itself accompanies the executable.
|
|
||||||
|
|
||||||
If distribution of executable or object code is made by offering
|
|
||||||
access to copy from a designated place, then offering equivalent
|
|
||||||
access to copy the source code from the same place counts as
|
|
||||||
distribution of the source code, even though third parties are not
|
|
||||||
compelled to copy the source along with the object code.
|
|
||||||
|
|
||||||
4. You may not copy, modify, sublicense, or distribute the Program
|
|
||||||
except as expressly provided under this License. Any attempt
|
|
||||||
otherwise to copy, modify, sublicense or distribute the Program 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.
|
|
||||||
|
|
||||||
5. You are not required to accept this License, since you have not
|
|
||||||
signed it. However, nothing else grants you permission to modify or
|
|
||||||
distribute the Program or its derivative works. These actions are
|
|
||||||
prohibited by law if you do not accept this License. Therefore, by
|
|
||||||
modifying or distributing the Program (or any work based on the
|
|
||||||
Program), you indicate your acceptance of this License to do so, and
|
|
||||||
all its terms and conditions for copying, distributing or modifying
|
|
||||||
the Program or works based on it.
|
|
||||||
|
|
||||||
6. Each time you redistribute the Program (or any work based on the
|
|
||||||
Program), the recipient automatically receives a license from the
|
|
||||||
original licensor to copy, distribute or modify the Program subject to
|
|
||||||
these terms and conditions. You may not impose any further
|
|
||||||
restrictions on the recipients' exercise of the rights granted herein.
|
|
||||||
You are not responsible for enforcing compliance by third parties to
|
|
||||||
this License.
|
|
||||||
|
|
||||||
7. If, as a consequence of a court judgment or allegation of patent
|
|
||||||
infringement or for any other reason (not limited to patent issues),
|
|
||||||
conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot
|
|
||||||
distribute so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you
|
|
||||||
may not distribute the Program at all. For example, if a patent
|
|
||||||
license would not permit royalty-free redistribution of the Program by
|
|
||||||
all those who receive copies directly or indirectly through you, then
|
|
||||||
the only way you could satisfy both it and this License would be to
|
|
||||||
refrain entirely from distribution of the Program.
|
|
||||||
|
|
||||||
If any portion of this section is held invalid or unenforceable under
|
|
||||||
any particular circumstance, the balance of the section is intended to
|
|
||||||
apply and the section as a whole is intended to apply in other
|
|
||||||
circumstances.
|
|
||||||
|
|
||||||
It is not the purpose of this section to induce you to infringe any
|
|
||||||
patents or other property right claims or to contest validity of any
|
|
||||||
such claims; this section has the sole purpose of protecting the
|
|
||||||
integrity of the free software distribution system, which is
|
|
||||||
implemented by public license practices. Many people have made
|
|
||||||
generous contributions to the wide range of software distributed
|
|
||||||
through that system in reliance on consistent application of that
|
|
||||||
system; it is up to the author/donor to decide if he or she is willing
|
|
||||||
to distribute software through any other system and a licensee cannot
|
|
||||||
impose that choice.
|
|
||||||
|
|
||||||
This section is intended to make thoroughly clear what is believed to
|
|
||||||
be a consequence of the rest of this License.
|
|
||||||
|
|
||||||
8. If the distribution and/or use of the Program is restricted in
|
|
||||||
certain countries either by patents or by copyrighted interfaces, the
|
|
||||||
original copyright holder who places the Program under this License
|
|
||||||
may add an explicit geographical distribution limitation excluding
|
|
||||||
those countries, so that distribution is permitted only in or among
|
|
||||||
countries not thus excluded. In such case, this License incorporates
|
|
||||||
the limitation as if written in the body of this License.
|
|
||||||
|
|
||||||
9. The Free Software Foundation may publish revised and/or new versions
|
|
||||||
of the General Public 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.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the Program
|
|
||||||
specifies a version number of this License which applies to it and "any
|
|
||||||
later version", you have the option of following the terms and conditions
|
|
||||||
either of that version or of any later version published by the Free
|
|
||||||
Software Foundation. If the Program does not specify a version number of
|
|
||||||
this License, you may choose any version ever published by the Free Software
|
|
||||||
Foundation.
|
|
||||||
|
|
||||||
10. If you wish to incorporate parts of the Program into other free
|
|
||||||
programs whose distribution conditions are different, write to the author
|
|
||||||
to ask for permission. For software which is copyrighted by the Free
|
|
||||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
|
||||||
make exceptions for this. Our decision will be guided by the two goals
|
|
||||||
of preserving the free status of all derivatives of our free software and
|
|
||||||
of promoting the sharing and reuse of software generally.
|
|
||||||
|
|
||||||
NO WARRANTY
|
|
||||||
|
|
||||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
|
||||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
|
||||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
|
||||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
|
||||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
|
||||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
|
||||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
|
||||||
REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
|
||||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
|
||||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
|
||||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
|
||||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
|
||||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
|
||||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGES.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
convey the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If the program is interactive, make it output a short notice like this
|
|
||||||
when it starts in an interactive mode:
|
|
||||||
|
|
||||||
Gnomovision version 69, Copyright (C) year name of author
|
|
||||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
|
||||||
under certain conditions; type `show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
||||||
parts of the General Public License. Of course, the commands you use may
|
|
||||||
be called something other than `show w' and `show c'; they could even be
|
|
||||||
mouse-clicks or menu items--whatever suits your program.
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or your
|
|
||||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
|
||||||
necessary. Here is a sample; alter the names:
|
|
||||||
|
|
||||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
|
||||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
|
||||||
|
|
||||||
<signature of Ty Coon>, 1 April 1989
|
|
||||||
Ty Coon, President of Vice
|
|
||||||
|
|
||||||
This General Public License does not permit incorporating your program into
|
|
||||||
proprietary programs. If your program is a subroutine library, you may
|
|
||||||
consider it more useful to permit linking proprietary applications with the
|
|
||||||
library. If this is what you want to do, use the GNU Library General
|
|
||||||
Public License instead of this License.
|
|
@ -1,81 +0,0 @@
|
|||||||
srcdir = @srcdir@
|
|
||||||
VPATH = @srcdir@
|
|
||||||
prefix = @prefix@
|
|
||||||
exec_prefix = @exec_prefix@
|
|
||||||
|
|
||||||
bindir = @bindir@
|
|
||||||
libdir = @libdir@
|
|
||||||
includedir = @includedir@
|
|
||||||
|
|
||||||
CC = @CC@
|
|
||||||
CPU = @target_cpu@
|
|
||||||
TARGET = @target_alias@
|
|
||||||
CFLAGS = @CFLAGS@
|
|
||||||
INCLUDES = @bfd_include_dir@ @binutils_include_dir@
|
|
||||||
CPPFLAGS = @CPPFLAGS@
|
|
||||||
LDFLAGS = @LDFLAGS@
|
|
||||||
LIBS = @LIBS@
|
|
||||||
INSTALL = @INSTALL@
|
|
||||||
DEFS = @DEFS@ -DTARGET_$(CPU)
|
|
||||||
EXEEXT = @EXEEXT@
|
|
||||||
OBJEXT = @OBJEXT@
|
|
||||||
|
|
||||||
HOST = @host_alias@
|
|
||||||
|
|
||||||
ifneq (,$(findstring mingw32,$(HOST)))
|
|
||||||
LIBS := $(LIBS) -lws2_32
|
|
||||||
endif
|
|
||||||
|
|
||||||
# force link order under cygwin to avoid getopts / libiberty clash
|
|
||||||
ifneq ($(strip $(shell gcc -v 2>&1 | grep "cygwin")),)
|
|
||||||
LIBS := -lcygwin $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
CCFLAGS = $(CFLAGS) $(DEFS) $(INCLUDES)
|
|
||||||
|
|
||||||
LDFILE= elf2flt.ld
|
|
||||||
ifeq ($(strip $(CPU)),e1)
|
|
||||||
SRC_LDFILE= $(CPU)-elf2flt.ld
|
|
||||||
else
|
|
||||||
SRC_LDFILE= elf2flt.ld
|
|
||||||
endif
|
|
||||||
|
|
||||||
target_bindir = $(prefix)/$(TARGET)/bin
|
|
||||||
target_libdir = $(prefix)/$(TARGET)/lib
|
|
||||||
|
|
||||||
|
|
||||||
PROG_ELF2FLT = elf2flt$(EXEEXT)
|
|
||||||
PROG_FLTHDR = flthdr$(EXEEXT)
|
|
||||||
PROGS = $(PROG_ELF2FLT) $(PROG_FLTHDR)
|
|
||||||
|
|
||||||
all: $(PROGS)
|
|
||||||
|
|
||||||
$(PROG_ELF2FLT): elf2flt.c stubs.c Makefile
|
|
||||||
$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $(srcdir)/elf2flt.c $(srcdir)/stubs.c $(LIBS)
|
|
||||||
|
|
||||||
$(PROG_FLTHDR): flthdr.c Makefile
|
|
||||||
$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $(srcdir)/flthdr.c $(LIBS)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
-rm -f $(PROGS) *.$(OBJEXT)
|
|
||||||
|
|
||||||
distclean: clean
|
|
||||||
-rm -f Makefile config.log config.status config.cache ld-elf2flt
|
|
||||||
|
|
||||||
install:
|
|
||||||
$(INSTALL) -d $(bindir)
|
|
||||||
$(INSTALL) -d $(target_bindir)
|
|
||||||
$(INSTALL) -d $(target_libdir)
|
|
||||||
$(INSTALL) -m 755 $(PROG_FLTHDR) $(bindir)/$(TARGET)-$(PROG_FLTHDR)
|
|
||||||
$(INSTALL) -m 755 $(PROG_FLTHDR) $(target_bindir)/$(PROG_FLTHDR)
|
|
||||||
$(INSTALL) -m 755 $(PROG_ELF2FLT) $(bindir)/$(TARGET)-$(PROG_ELF2FLT)
|
|
||||||
$(INSTALL) -m 755 $(PROG_ELF2FLT) $(target_bindir)/$(PROG_ELF2FLT)
|
|
||||||
[ -f $(bindir)/$(TARGET)-ld.real$(EXEEXT) ] || \
|
|
||||||
mv $(bindir)/$(TARGET)-ld$(EXEEXT) $(bindir)/$(TARGET)-ld.real$(EXEEXT)
|
|
||||||
[ -f $(target_bindir)/ld.real$(EXEEXT) ] || \
|
|
||||||
mv $(target_bindir)/ld$(EXEEXT) $(target_bindir)/ld.real$(EXEEXT)
|
|
||||||
$(INSTALL) -m 755 ld-elf2flt $(bindir)/$(TARGET)-ld
|
|
||||||
$(INSTALL) -m 755 ld-elf2flt $(target_bindir)/ld
|
|
||||||
$(INSTALL) -m 644 $(srcdir)/$(SRC_LDFILE) $(target_libdir)/$(LDFILE)
|
|
||||||
|
|
||||||
|
|
@ -1,62 +0,0 @@
|
|||||||
|
|
||||||
README - elf2flt
|
|
||||||
----------------
|
|
||||||
|
|
||||||
Copyright (C) 2001-2003, SnapGear (www.snapgear.com)
|
|
||||||
davidm@snapgear.com
|
|
||||||
gerg@snapgear.com
|
|
||||||
|
|
||||||
This is Free Software, under the GNU Public Licence v2 or greater. See
|
|
||||||
LICENSE.TXT for more details.
|
|
||||||
|
|
||||||
Elf2flt with PIC, ZFLAT and full reloc support. Currently supported
|
|
||||||
targets include: m68k/ColdFire, ARM, Sparc, NEC v850, MicroBlaze,
|
|
||||||
h8300 and SuperH.
|
|
||||||
|
|
||||||
COMPILING:
|
|
||||||
|
|
||||||
You need an appropriate libbfd.a and libiberty.a for your target to
|
|
||||||
build this tool. They are normally part of the binutils package.
|
|
||||||
|
|
||||||
To compile elf2flt do:
|
|
||||||
|
|
||||||
./configure --target=<ARCH> --with-libbfd=<libbfd.a> --with-libiberty=<libiberty.a>
|
|
||||||
make
|
|
||||||
make install
|
|
||||||
|
|
||||||
The <ARCH> argument to configure specifies what the target architecture is.
|
|
||||||
This should be the same target as you used to build the binutils and gcc
|
|
||||||
cross development tools. The --with-libbfd and --with-libiberty arguments
|
|
||||||
specify where the libbfd.a and libiberty.a library files are to use.
|
|
||||||
|
|
||||||
|
|
||||||
FILES:
|
|
||||||
|
|
||||||
README - this file
|
|
||||||
configure - autoconf configuration shell script
|
|
||||||
configure.in- original autoconf file
|
|
||||||
config.* - autoconf support scripts
|
|
||||||
Makefile.in - Makefile template used by configure
|
|
||||||
elf2flt.c - the source
|
|
||||||
flthdr.c - flat header manipulation program
|
|
||||||
flat.h - header from uClinux kernel sources
|
|
||||||
elf2flt.ld - an example linker script that works for C/C++ and uClinux
|
|
||||||
ld-elf2flt - A linker replacement that implements a -elf2flt option for the
|
|
||||||
linker and runs elf2flt automatically for you. It auto
|
|
||||||
detects PIC/non-PIC code and adjusts its option accordingly.
|
|
||||||
It uses the environment variable FLTFLAGS when running
|
|
||||||
elf2flt. It runs /.../m68k-elf-ld.real to do the actual
|
|
||||||
linking.
|
|
||||||
|
|
||||||
TIPS:
|
|
||||||
|
|
||||||
The ld-elf2flt produces 2 files as output. The binary flat file X, and
|
|
||||||
X.gdb which is used for debugging and PIC purposes.
|
|
||||||
|
|
||||||
The '-p' option requires an elf executable linked at address 0. The
|
|
||||||
elf2flt.ld provided will generate the correct format binary when linked
|
|
||||||
with the real linker with *no* '-r' option for the linker.
|
|
||||||
|
|
||||||
The '-r' flag can be added to PIC builds to get contiguous code/data. This
|
|
||||||
is good for loading application symbols into gdb (add-symbol-file XXX.gdb).
|
|
||||||
|
|
1418
package/elf2flt/src/config.guess
vendored
1418
package/elf2flt/src/config.guess
vendored
File diff suppressed because it is too large
Load Diff
1577
package/elf2flt/src/config.sub
vendored
1577
package/elf2flt/src/config.sub
vendored
File diff suppressed because it is too large
Load Diff
4719
package/elf2flt/src/configure
vendored
4719
package/elf2flt/src/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -1,134 +0,0 @@
|
|||||||
dnl Process this file with autoconf to produce a configure script.
|
|
||||||
AC_INIT(elf2flt.c)
|
|
||||||
|
|
||||||
AC_ARG_WITH(libbfd,
|
|
||||||
[ --with-libbfd=<file> path to libbfd.a library to use ],
|
|
||||||
[ ac_libbfd=$withval ],
|
|
||||||
[ ac_libbfd=NONE ]
|
|
||||||
)
|
|
||||||
|
|
||||||
AC_ARG_WITH(libiberty,
|
|
||||||
[ --with-libiberty=<file> path to libiberty.a library to use ],
|
|
||||||
[ ac_libiberty=$withval ],
|
|
||||||
[ ac_libiberty=NONE ]
|
|
||||||
)
|
|
||||||
|
|
||||||
AC_ARG_WITH(bfd-include-dir,
|
|
||||||
[ --with-bfd-include-dir=<dir> include path for correct bfd.h ],
|
|
||||||
[ ac_bfd_include_dir=$withval ],
|
|
||||||
[ ac_bfd_include_dir=NONE ]
|
|
||||||
)
|
|
||||||
|
|
||||||
AC_ARG_WITH(binutils-include-dir,
|
|
||||||
[ --with-binutils-include-dir=<dir> include path for binutils headers ],
|
|
||||||
[ ac_binutils_include_dir=$withval ],
|
|
||||||
[ ac_binutils_include_dir=NONE ]
|
|
||||||
)
|
|
||||||
|
|
||||||
AC_ARG_WITH(binutils-ldscript-dir,
|
|
||||||
[ --with-binutils-ldscript-dir=<dir> path to install elf2flt.ld ],
|
|
||||||
[ ac_binutils_ldscript_dir=$withval ],
|
|
||||||
[ ac_binutils_ldscript_dir=NONE ]
|
|
||||||
)
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(got-check,
|
|
||||||
[ --disable-got-check - disable check for GOT (needed on H8) ],
|
|
||||||
[ got_check=$enableval ],
|
|
||||||
[ got_check=yes ]
|
|
||||||
)
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(emit_relocs,
|
|
||||||
[ --disable-emit-relocs - don't use the --emit-relocs (-q) linker option ],
|
|
||||||
[ emit_relocs=$enableval ],
|
|
||||||
[ emit_relocs=yes ]
|
|
||||||
)
|
|
||||||
|
|
||||||
AC_CANONICAL_HOST
|
|
||||||
AC_CANONICAL_TARGET
|
|
||||||
|
|
||||||
dnl Checks for programs.
|
|
||||||
AC_PROG_CC
|
|
||||||
AC_PROG_INSTALL
|
|
||||||
|
|
||||||
dnl Checks for libraries.
|
|
||||||
if test "$ac_libiberty" = "NONE"; then
|
|
||||||
AC_CHECK_LIB(iberty, objalloc_create)
|
|
||||||
ac_libiberty=auto
|
|
||||||
else
|
|
||||||
LIBS="$ac_libiberty $LIBS"
|
|
||||||
fi
|
|
||||||
if test "$ac_libbfd" = "NONE"; then
|
|
||||||
AC_CHECK_LIB(bfd, bfd_openr)
|
|
||||||
ac_libbfd=auto
|
|
||||||
else
|
|
||||||
LIBS="$ac_libbfd $LIBS"
|
|
||||||
fi
|
|
||||||
|
|
||||||
bfd_include_dir=
|
|
||||||
if test "$ac_bfd_include_dir" != "NONE"; then
|
|
||||||
bfd_include_dir="-I$ac_bfd_include_dir"
|
|
||||||
fi
|
|
||||||
|
|
||||||
binutils_include_dir=
|
|
||||||
if test "$ac_binutils_include_dir" != "NONE"; then
|
|
||||||
binutils_include_dir="-I$ac_binutils_include_dir"
|
|
||||||
fi
|
|
||||||
|
|
||||||
binutils_ldscript_dir=
|
|
||||||
if test "$ac_binutils_ldscript_dir" = "NONE"; then
|
|
||||||
ac_binutils_ldscript_dir="\${TOOLDIR}/../${target_alias}/lib"
|
|
||||||
fi
|
|
||||||
binutils_ldscript_dir="$ac_binutils_ldscript_dir"
|
|
||||||
|
|
||||||
if test "$ac_libbfd" = "NONE" -o "$ac_libiberty" = "NONE" ; then
|
|
||||||
AC_MSG_ERROR([
|
|
||||||
|
|
||||||
You need to specify the location of the libfd.a and libiberty.a
|
|
||||||
host libraries from the binutils package.
|
|
||||||
|
|
||||||
Run configure again specifying these options:
|
|
||||||
|
|
||||||
./configure --target=<ARCH> --with-bfd-include-dir=<dir> --with-libbfd=<libbfd.a> --with-libiberty=<libiberty.a>
|
|
||||||
])
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "$ac_bfd_include_dir" = "NONE" ; then
|
|
||||||
AC_MSG_ERROR([
|
|
||||||
|
|
||||||
You need to specify the location of the bfd.h header from a
|
|
||||||
configured/compiled version of the binutils package for your target.
|
|
||||||
Without this your elf2flt may crash as it will try to use the
|
|
||||||
systems bfd.h which may be from a different binutils package.
|
|
||||||
|
|
||||||
Run configure again specifying these options:
|
|
||||||
|
|
||||||
./configure --target=<ARCH> --with-bfd-include-dir=<dir> --with-libbfd=<libbfd.a> --with-libiberty=<libiberty.a>
|
|
||||||
])
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl Checks for header files.
|
|
||||||
AC_HEADER_STDC
|
|
||||||
AC_CHECK_HEADERS(fcntl.h unistd.h bfd.h)
|
|
||||||
|
|
||||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
|
||||||
AC_C_CONST
|
|
||||||
|
|
||||||
dnl Checks for library functions.
|
|
||||||
AC_FUNC_VPRINTF
|
|
||||||
|
|
||||||
AC_CHECK_FUNCS(dcgettext)
|
|
||||||
|
|
||||||
dnl Subsitute values
|
|
||||||
AC_SUBST(target)
|
|
||||||
AC_SUBST(target_alias)
|
|
||||||
AC_SUBST(target_cpu)
|
|
||||||
AC_SUBST(target_os)
|
|
||||||
AC_SUBST(target_vendor)
|
|
||||||
AC_SUBST(bfd_include_dir)
|
|
||||||
AC_SUBST(binutils_include_dir)
|
|
||||||
AC_SUBST(binutils_ldscript_dir)
|
|
||||||
AC_SUBST(got_check)
|
|
||||||
AC_SUBST(emit_relocs)
|
|
||||||
|
|
||||||
AC_OUTPUT(Makefile ld-elf2flt)
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
@ -1,161 +0,0 @@
|
|||||||
|
|
||||||
ENTRY (__start)
|
|
||||||
|
|
||||||
MEMORY {
|
|
||||||
flatmem : ORIGIN = 0x0, LENGTH = 0xfffffff
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTIONS {
|
|
||||||
.G6 (DEFINED(G6Base) ? G6Base : 0x0) : {
|
|
||||||
*(.G6)
|
|
||||||
}
|
|
||||||
.G7 (DEFINED(G7Base) ? G7Base : 0x0) : {
|
|
||||||
*(.G7)
|
|
||||||
}
|
|
||||||
.G8 (DEFINED(G8Base) ? G8Base : 0x0) : {
|
|
||||||
*(.G8)
|
|
||||||
}
|
|
||||||
.G9 (DEFINED(G9Base) ? G9Base : 0) : {
|
|
||||||
*(.G9)
|
|
||||||
}
|
|
||||||
.G10 (DEFINED(G10Base) ? G10Base : 0) : {
|
|
||||||
*(.G10)
|
|
||||||
}
|
|
||||||
.G11 (DEFINED(G11Base) ? G11Base : 0) : {
|
|
||||||
*(.G11)
|
|
||||||
}
|
|
||||||
.G12 (DEFINED(G12Base) ? G12Base : 0) : {
|
|
||||||
*(.G12)
|
|
||||||
}
|
|
||||||
.G13 (DEFINED(G13Base) ? G13Base : 0) : {
|
|
||||||
*(.G13)
|
|
||||||
}
|
|
||||||
.text 0x0 : {
|
|
||||||
. = . + 4;
|
|
||||||
. = ALIGN(0x4) ;
|
|
||||||
_stext = . ;
|
|
||||||
*(.text)
|
|
||||||
*(.text.*)
|
|
||||||
*(.gnu.warning)
|
|
||||||
*(.stub)
|
|
||||||
*(.gnu.linkonce.t*)
|
|
||||||
*(.glue_7t)
|
|
||||||
*(.glue_7)
|
|
||||||
*(.jcr)
|
|
||||||
*(.init)
|
|
||||||
*(.fini)
|
|
||||||
|
|
||||||
W_RODAT *(.rodata)
|
|
||||||
W_RODAT *(.rodata1)
|
|
||||||
W_RODAT *(.rodata.*)
|
|
||||||
|
|
||||||
/* This is special code area at the end of the normal
|
|
||||||
text section. It contains a small lookup table at
|
|
||||||
the start followed by the code pointed to by entries
|
|
||||||
in the lookup table. */
|
|
||||||
. = ALIGN (4) ;
|
|
||||||
PROVIDE(__ctbp = .);
|
|
||||||
*(.call_table_data)
|
|
||||||
*(.call_table_text)
|
|
||||||
|
|
||||||
. = ALIGN(0x20) ;
|
|
||||||
_etext = . ;
|
|
||||||
} > flatmem
|
|
||||||
.data : {
|
|
||||||
. = ALIGN(0x4) ;
|
|
||||||
_sdata = . ;
|
|
||||||
__data_start = . ;
|
|
||||||
data_start = . ;
|
|
||||||
*(.got.plt)
|
|
||||||
*(.got)
|
|
||||||
FILL(0) ;
|
|
||||||
. = ALIGN(0x20) ;
|
|
||||||
LONG(-1)
|
|
||||||
. = ALIGN(0x20) ;
|
|
||||||
R_RODAT *(.rodata)
|
|
||||||
R_RODAT *(.rodata1)
|
|
||||||
R_RODAT *(.rodata.*)
|
|
||||||
*(.gnu.linkonce.r*)
|
|
||||||
*(.data)
|
|
||||||
*(.data1)
|
|
||||||
*(.data.*)
|
|
||||||
*(.gnu.linkonce.d*)
|
|
||||||
*(.data1)
|
|
||||||
*(.eh_frame)
|
|
||||||
*(.gcc_except_table)
|
|
||||||
|
|
||||||
/* Microblaze has .sdata and .sbss (small bss). They must
|
|
||||||
be contiguous, so please don't move any of this. JW */
|
|
||||||
_ssrw = . ;
|
|
||||||
*(.sdata)
|
|
||||||
*(.sdata.*)
|
|
||||||
*(.sbss) /* Don't move this! */
|
|
||||||
_essrw = . ;
|
|
||||||
|
|
||||||
_ssrw_size = _essrw - _ssrw;
|
|
||||||
PROVIDE(_SDA_BASE_ = _ssrw + (_ssrw_size / 2));
|
|
||||||
|
|
||||||
*(.gnu.linkonce.s.*)
|
|
||||||
*(__libc_atexit)
|
|
||||||
*(__libc_subinit)
|
|
||||||
*(__libc_subfreeres)
|
|
||||||
*(.note.ABI-tag)
|
|
||||||
|
|
||||||
/* microblaze-specific read-only small data area
|
|
||||||
and associated locating symbols */
|
|
||||||
_ssro = . ;
|
|
||||||
*(.sdata2)
|
|
||||||
_essro = . ;
|
|
||||||
_ssro_size = _essro - _ssro;
|
|
||||||
PROVIDE(_SDA2_BASE_ = _ssro + (_ssro_size / 2));
|
|
||||||
|
|
||||||
. = ALIGN(4) ;
|
|
||||||
__CTOR_LIST__ = .;
|
|
||||||
LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
|
|
||||||
*(.ctors)
|
|
||||||
LONG(0)
|
|
||||||
__CTOR_END__ = .;
|
|
||||||
__DTOR_LIST__ = .;
|
|
||||||
LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
|
|
||||||
*(.dtors)
|
|
||||||
LONG(0)
|
|
||||||
__DTOR_END__ = .;
|
|
||||||
|
|
||||||
. = ALIGN(0x10) ;
|
|
||||||
_edata = . ;
|
|
||||||
} > flatmem
|
|
||||||
.bss : {
|
|
||||||
. = ALIGN(0x4) ;
|
|
||||||
_sbss = ALIGN(0x4) ;
|
|
||||||
__bss_start = . ;
|
|
||||||
*(.dynsbss)
|
|
||||||
*(.sbss)
|
|
||||||
*(.sbss.*)
|
|
||||||
*(.scommon)
|
|
||||||
*(.dynbss)
|
|
||||||
*(.bss)
|
|
||||||
*(.bss.*)
|
|
||||||
*(.bss*)
|
|
||||||
*(.gnu.linkonce.b*)
|
|
||||||
*(COMMON)
|
|
||||||
. = ALIGN(0x10) ;
|
|
||||||
_ebss = . ;
|
|
||||||
_end = . ;
|
|
||||||
end = . ;
|
|
||||||
} > flatmem
|
|
||||||
|
|
||||||
.junk 0 : { *(.rel*) *(.rela*) }
|
|
||||||
/* Stabs debugging sections. */
|
|
||||||
.stab 0 : { *(.stab) }
|
|
||||||
.stabstr 0 : { *(.stabstr) }
|
|
||||||
.stab.excl 0 : { *(.stab.excl) }
|
|
||||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
|
||||||
.stab.index 0 : { *(.stab.index) }
|
|
||||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
|
||||||
.comment 0 : { *(.comment) }
|
|
||||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
|
||||||
.debug_info 0 : { *(.debug_info) }
|
|
||||||
.debug_line 0 : { *(.debug_line) }
|
|
||||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
|
||||||
.debug_aranges 0 : { *(.debug_aranges) }
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
@ -1,179 +0,0 @@
|
|||||||
|
|
||||||
ENTRY (_start)
|
|
||||||
|
|
||||||
MEMORY {
|
|
||||||
flatmem : ORIGIN = 0x0, LENGTH = 0xfffffff
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTIONS {
|
|
||||||
|
|
||||||
.text 0x0 : {
|
|
||||||
. = . + 4;
|
|
||||||
. = ALIGN(0x4) ;
|
|
||||||
_stext = . ;
|
|
||||||
*(.text)
|
|
||||||
*(.text.*)
|
|
||||||
*(.gnu.warning)
|
|
||||||
*(.stub)
|
|
||||||
*(.gnu.linkonce.t*)
|
|
||||||
*(.glue_7t)
|
|
||||||
*(.glue_7)
|
|
||||||
*(.jcr)
|
|
||||||
*(.init)
|
|
||||||
*(.fini)
|
|
||||||
|
|
||||||
W_RODAT *(.rodata)
|
|
||||||
W_RODAT *(.rodata1)
|
|
||||||
W_RODAT *(.rodata.*)
|
|
||||||
W_RODAT *(.gnu.linkonce.r*)
|
|
||||||
|
|
||||||
/* This is special code area at the end of the normal
|
|
||||||
text section. It contains a small lookup table at
|
|
||||||
the start followed by the code pointed to by entries
|
|
||||||
in the lookup table. */
|
|
||||||
. = ALIGN (4) ;
|
|
||||||
PROVIDE(__ctbp = .);
|
|
||||||
*(.call_table_data)
|
|
||||||
*(.call_table_text)
|
|
||||||
|
|
||||||
. = ALIGN(0x20) ;
|
|
||||||
_etext = . ;
|
|
||||||
} > flatmem
|
|
||||||
|
|
||||||
.data : {
|
|
||||||
. = ALIGN(0x4) ;
|
|
||||||
_sdata = . ;
|
|
||||||
__data_start = . ;
|
|
||||||
data_start = . ;
|
|
||||||
*(.got.plt)
|
|
||||||
*(.got)
|
|
||||||
FILL(0) ;
|
|
||||||
. = ALIGN(0x20) ;
|
|
||||||
LONG(-1)
|
|
||||||
. = ALIGN(0x20) ;
|
|
||||||
R_RODAT *(.rodata)
|
|
||||||
R_RODAT *(.rodata1)
|
|
||||||
R_RODAT *(.rodata.*)
|
|
||||||
R_RODAT *(.gnu.linkonce.r*)
|
|
||||||
*(.data)
|
|
||||||
*(.data1)
|
|
||||||
*(.data.*)
|
|
||||||
*(.gnu.linkonce.d*)
|
|
||||||
*(.data1)
|
|
||||||
*(.eh_frame)
|
|
||||||
*(.gcc_except_table)
|
|
||||||
|
|
||||||
/* Microblaze has .sdata and .sbss (small bss). They must
|
|
||||||
be contiguous, so please don't move any of this. JW */
|
|
||||||
_ssrw = . ;
|
|
||||||
*(.sdata)
|
|
||||||
*(.sdata.*)
|
|
||||||
*(.sbss) /* Don't move this! */
|
|
||||||
_essrw = . ;
|
|
||||||
|
|
||||||
_ssrw_size = _essrw - _ssrw;
|
|
||||||
PROVIDE(_SDA_BASE_ = _ssrw + (_ssrw_size / 2));
|
|
||||||
|
|
||||||
*(.gnu.linkonce.s.*)
|
|
||||||
*(__libc_atexit)
|
|
||||||
*(__libc_subinit)
|
|
||||||
*(__libc_subfreeres)
|
|
||||||
*(.note.ABI-tag)
|
|
||||||
|
|
||||||
/* microblaze-specific read-only small data area
|
|
||||||
and associated locating symbols */
|
|
||||||
_ssro = . ;
|
|
||||||
*(.sdata2)
|
|
||||||
_essro = . ;
|
|
||||||
_ssro_size = _essro - _ssro;
|
|
||||||
PROVIDE(_SDA2_BASE_ = _ssro + (_ssro_size / 2));
|
|
||||||
|
|
||||||
. = ALIGN(4) ;
|
|
||||||
__CTOR_LIST__ = .;
|
|
||||||
LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
|
|
||||||
SINGLE_LINK: /* gcc uses crtbegin.o to find the start of
|
|
||||||
SINGLE_LINK: the constructors, so we make sure it is
|
|
||||||
SINGLE_LINK: first. Because this is a wildcard, it
|
|
||||||
SINGLE_LINK: doesn't matter if the user does not
|
|
||||||
SINGLE_LINK: actually link against crtbegin.o; the
|
|
||||||
SINGLE_LINK: linker won't look for a file to match a
|
|
||||||
SINGLE_LINK: wildcard. The wildcard also means that it
|
|
||||||
SINGLE_LINK: doesn't matter which directory crtbegin.o
|
|
||||||
SINGLE_LINK: is in. */
|
|
||||||
SINGLE_LINK: KEEP (*crtbegin*.o(.ctors))
|
|
||||||
SINGLE_LINK: /* We don't want to include the .ctor section from
|
|
||||||
SINGLE_LINK: from the crtend.o file until after the sorted ctors.
|
|
||||||
SINGLE_LINK: The .ctor section from the crtend file contains the
|
|
||||||
SINGLE_LINK: end of ctors marker and it must be last */
|
|
||||||
SINGLE_LINK: KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
|
|
||||||
SINGLE_LINK: KEEP (*(SORT(.ctors.*)))
|
|
||||||
KEEP (*(.ctors))
|
|
||||||
LONG(0)
|
|
||||||
__CTOR_END__ = .;
|
|
||||||
__DTOR_LIST__ = .;
|
|
||||||
LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
|
|
||||||
SINGLE_LINK: KEEP (*crtbegin*.o(.dtors))
|
|
||||||
SINGLE_LINK: KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
|
|
||||||
SINGLE_LINK: KEEP (*(SORT(.dtors.*)))
|
|
||||||
KEEP (*(.dtors))
|
|
||||||
LONG(0)
|
|
||||||
__DTOR_END__ = .;
|
|
||||||
|
|
||||||
PROVIDE (__preinit_array_start = .);
|
|
||||||
KEEP (*(.preinit_array))
|
|
||||||
PROVIDE (__preinit_array_end = .);
|
|
||||||
|
|
||||||
PROVIDE (__init_array_start = .);
|
|
||||||
KEEP (*(SORT(.init_array.*)))
|
|
||||||
KEEP (*(.init_array))
|
|
||||||
PROVIDE (__init_array_end = .);
|
|
||||||
|
|
||||||
PROVIDE (__fini_array_start = .);
|
|
||||||
KEEP (*(.fini_array))
|
|
||||||
KEEP (*(SORT(.fini_array.*)))
|
|
||||||
PROVIDE (__fini_array_end = .);
|
|
||||||
|
|
||||||
. = ALIGN(0x10) ;
|
|
||||||
_edata = . ;
|
|
||||||
} > flatmem
|
|
||||||
|
|
||||||
.bss : {
|
|
||||||
. = ALIGN(0x4) ;
|
|
||||||
_sbss = ALIGN(0x4) ;
|
|
||||||
__bss_start = . ;
|
|
||||||
*(.dynsbss)
|
|
||||||
*(.sbss)
|
|
||||||
*(.sbss.*)
|
|
||||||
*(.scommon)
|
|
||||||
*(.dynbss)
|
|
||||||
*(.bss)
|
|
||||||
*(.bss.*)
|
|
||||||
*(.bss*)
|
|
||||||
*(.gnu.linkonce.b*)
|
|
||||||
*(COMMON)
|
|
||||||
. = ALIGN(0x10) ;
|
|
||||||
_ebss = . ;
|
|
||||||
_end = . ;
|
|
||||||
end = . ;
|
|
||||||
} > flatmem
|
|
||||||
|
|
||||||
.stack : {
|
|
||||||
. = ALIGN(0x4);
|
|
||||||
__stack_start = .;
|
|
||||||
}
|
|
||||||
|
|
||||||
.junk 0 : { *(.rel*) *(.rela*) }
|
|
||||||
/* Stabs debugging sections. */
|
|
||||||
.stab 0 : { *(.stab) }
|
|
||||||
.stabstr 0 : { *(.stabstr) }
|
|
||||||
.stab.excl 0 : { *(.stab.excl) }
|
|
||||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
|
||||||
.stab.index 0 : { *(.stab.index) }
|
|
||||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
|
||||||
.comment 0 : { *(.comment) }
|
|
||||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
|
||||||
.debug_info 0 : { *(.debug_info) }
|
|
||||||
.debug_line 0 : { *(.debug_line) }
|
|
||||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
|
||||||
.debug_aranges 0 : { *(.debug_aranges) }
|
|
||||||
}
|
|
@ -1,111 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2002-2005 David McCullough <davidm@snapgear.com>
|
|
||||||
* Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com>
|
|
||||||
* The Silver Hammer Group, Ltd.
|
|
||||||
*
|
|
||||||
* This file provides the definitions and structures needed to
|
|
||||||
* support uClinux flat-format executables.
|
|
||||||
*
|
|
||||||
* This is Free Software, under the GNU Public Licence v2 or greater.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _LINUX_FLAT_H
|
|
||||||
#define _LINUX_FLAT_H
|
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
|
||||||
#include <linux/types.h>
|
|
||||||
#include <asm/flat.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define FLAT_VERSION 0x00000004L
|
|
||||||
|
|
||||||
#ifdef CONFIG_BINFMT_SHARED_FLAT
|
|
||||||
#define MAX_SHARED_LIBS (4)
|
|
||||||
#else
|
|
||||||
#define MAX_SHARED_LIBS (1)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* To make everything easier to port and manage cross platform
|
|
||||||
* development, all fields are in network byte order.
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct flat_hdr {
|
|
||||||
char magic[4];
|
|
||||||
uint32_t rev; /* version (as above) */
|
|
||||||
uint32_t entry; /* Offset of first executable instruction
|
|
||||||
with text segment from beginning of file */
|
|
||||||
uint32_t data_start; /* Offset of data segment from beginning of
|
|
||||||
file */
|
|
||||||
uint32_t data_end; /* Offset of end of data segment from beginning
|
|
||||||
of file */
|
|
||||||
uint32_t bss_end; /* Offset of end of bss segment from beginning
|
|
||||||
of file */
|
|
||||||
|
|
||||||
/* (It is assumed that data_end through bss_end forms the bss segment.) */
|
|
||||||
|
|
||||||
uint32_t stack_size; /* Size of stack, in bytes */
|
|
||||||
uint32_t reloc_start; /* Offset of relocation records from beginning
|
|
||||||
of file */
|
|
||||||
uint32_t reloc_count; /* Number of relocation records */
|
|
||||||
uint32_t flags;
|
|
||||||
uint32_t build_date; /* When the program/library was built */
|
|
||||||
uint32_t filler[5]; /* Reservered, set to zero */
|
|
||||||
};
|
|
||||||
|
|
||||||
#define FLAT_FLAG_RAM 0x0001 /* load program entirely into RAM */
|
|
||||||
#define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */
|
|
||||||
#define FLAT_FLAG_GZIP 0x0004 /* all but the header is compressed */
|
|
||||||
#define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */
|
|
||||||
#define FLAT_FLAG_KTRACE 0x0010 /* output useful kernel trace for debugging */
|
|
||||||
|
|
||||||
#ifdef __KERNEL__ /* so systems without linux headers can compile the apps */
|
|
||||||
/*
|
|
||||||
* While it would be nice to keep this header clean, users of older
|
|
||||||
* tools still need this support in the kernel. So this section is
|
|
||||||
* purely for compatibility with old tool chains.
|
|
||||||
*
|
|
||||||
* DO NOT make changes or enhancements to the old format please, just work
|
|
||||||
* with the format above, except to fix bugs with old format support.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <asm/byteorder.h>
|
|
||||||
|
|
||||||
#define OLD_FLAT_VERSION 0x00000002L
|
|
||||||
#define OLD_FLAT_RELOC_TYPE_TEXT 0
|
|
||||||
#define OLD_FLAT_RELOC_TYPE_DATA 1
|
|
||||||
#define OLD_FLAT_RELOC_TYPE_BSS 2
|
|
||||||
|
|
||||||
typedef union {
|
|
||||||
uint32_t value;
|
|
||||||
struct {
|
|
||||||
# if defined(mc68000) && !defined(CONFIG_COLDFIRE)
|
|
||||||
int32_t offset : 30;
|
|
||||||
uint32_t type : 2;
|
|
||||||
# define OLD_FLAT_FLAG_RAM 0x1 /* load program entirely into RAM */
|
|
||||||
# elif defined(__BIG_ENDIAN_BITFIELD)
|
|
||||||
uint32_t type : 2;
|
|
||||||
int32_t offset : 30;
|
|
||||||
# define OLD_FLAT_FLAG_RAM 0x1 /* load program entirely into RAM */
|
|
||||||
# elif defined(__LITTLE_ENDIAN_BITFIELD)
|
|
||||||
int32_t offset : 30;
|
|
||||||
uint32_t type : 2;
|
|
||||||
# define OLD_FLAT_FLAG_RAM 0x1 /* load program entirely into RAM */
|
|
||||||
# else
|
|
||||||
# error "Unknown bitfield order for flat files."
|
|
||||||
# endif
|
|
||||||
} reloc;
|
|
||||||
} flat_v2_reloc_t;
|
|
||||||
|
|
||||||
#endif /* __KERNEL__ */
|
|
||||||
|
|
||||||
#endif /* _LINUX_FLAT_H */
|
|
||||||
|
|
||||||
/* this __MUST__ be at the VERY end of the file - do NOT move!!
|
|
||||||
* Local Variables:
|
|
||||||
* c-basic-offset: 4
|
|
||||||
* tab-width: 8
|
|
||||||
* end:
|
|
||||||
* vi: tabstop=8 shiftwidth=4 textwidth=79 noexpandtab
|
|
||||||
*/
|
|
@ -1,382 +0,0 @@
|
|||||||
/****************************************************************************/
|
|
||||||
/*
|
|
||||||
* A simple program to manipulate flat files
|
|
||||||
*
|
|
||||||
* Copyright (C) 2001-2003 SnapGear Inc, davidm@snapgear.com
|
|
||||||
* Copyright (C) 2001 Lineo, davidm@lineo.com
|
|
||||||
*
|
|
||||||
* This is Free Software, under the GNU Public Licence v2 or greater.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
/****************************************************************************/
|
|
||||||
|
|
||||||
#include <stdio.h> /* Userland pieces of the ANSI C standard I/O package */
|
|
||||||
#include <unistd.h> /* Userland prototypes of the Unix std system calls */
|
|
||||||
#include <time.h>
|
|
||||||
#include <stdlib.h> /* exit() */
|
|
||||||
#include <string.h> /* strcat(), strcpy() */
|
|
||||||
|
|
||||||
/* macros for conversion between host and (internet) network byte order */
|
|
||||||
#ifndef WIN32
|
|
||||||
#include <netinet/in.h> /* Consts and structs defined by the internet system */
|
|
||||||
#define BINARY_FILE_OPTS
|
|
||||||
#else
|
|
||||||
#include <winsock2.h>
|
|
||||||
#define BINARY_FILE_OPTS "b"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* from uClinux-x.x.x/include/linux */
|
|
||||||
#include "flat.h" /* Binary flat header description */
|
|
||||||
|
|
||||||
#if defined(__MINGW32__)
|
|
||||||
#include <getopt.h>
|
|
||||||
|
|
||||||
#define mkstemp(p) mktemp(p)
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************/
|
|
||||||
|
|
||||||
char *program_name;
|
|
||||||
|
|
||||||
static char cmd[1024];
|
|
||||||
static int print = 0, compress = 0, ramload = 0, stacksize = 0, ktrace = 0;
|
|
||||||
static int short_format = 0;
|
|
||||||
|
|
||||||
/****************************************************************************/
|
|
||||||
|
|
||||||
void
|
|
||||||
transferr(FILE *ifp, FILE *ofp, int count)
|
|
||||||
{
|
|
||||||
int n, num;
|
|
||||||
|
|
||||||
while (count == -1 || count > 0) {
|
|
||||||
if (count == -1 || count > sizeof(cmd))
|
|
||||||
num = sizeof(cmd);
|
|
||||||
else
|
|
||||||
num = count;
|
|
||||||
n = fread(cmd, 1, num, ifp);
|
|
||||||
if (n == 0)
|
|
||||||
break;
|
|
||||||
if (fwrite(cmd, n, 1, ofp) != 1) {
|
|
||||||
fprintf(stderr, "Write failed :-(\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (count != -1)
|
|
||||||
count -= n;
|
|
||||||
}
|
|
||||||
if (count > 0) {
|
|
||||||
fprintf(stderr, "Failed to transferr %d bytes\n", count);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************/
|
|
||||||
|
|
||||||
void
|
|
||||||
process_file(char *ifile, char *ofile)
|
|
||||||
{
|
|
||||||
int old_flags, old_stack, new_flags, new_stack;
|
|
||||||
FILE *ifp, *ofp;
|
|
||||||
int ofp_is_pipe = 0;
|
|
||||||
struct flat_hdr old_hdr, new_hdr;
|
|
||||||
char tfile[256];
|
|
||||||
char tfile2[256];
|
|
||||||
|
|
||||||
*tfile = *tfile2 = '\0';
|
|
||||||
|
|
||||||
if ((ifp = fopen(ifile, "r" BINARY_FILE_OPTS)) == NULL) {
|
|
||||||
fprintf(stderr, "Cannot open %s\n", ifile);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fread(&old_hdr, sizeof(old_hdr), 1, ifp) != 1) {
|
|
||||||
fprintf(stderr, "Cannot read header of %s\n", ifile);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strncmp(old_hdr.magic, "bFLT", 4) != 0) {
|
|
||||||
fprintf(stderr, "Cannot read header of %s\n", ifile);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
new_flags = old_flags = ntohl(old_hdr.flags);
|
|
||||||
new_stack = old_stack = ntohl(old_hdr.stack_size);
|
|
||||||
new_hdr = old_hdr;
|
|
||||||
|
|
||||||
if (compress == 1) {
|
|
||||||
new_flags |= FLAT_FLAG_GZIP;
|
|
||||||
new_flags &= ~FLAT_FLAG_GZDATA;
|
|
||||||
} else if (compress == 2) {
|
|
||||||
new_flags |= FLAT_FLAG_GZDATA;
|
|
||||||
new_flags &= ~FLAT_FLAG_GZIP;
|
|
||||||
} else if (compress < 0)
|
|
||||||
new_flags &= ~(FLAT_FLAG_GZIP|FLAT_FLAG_GZDATA);
|
|
||||||
|
|
||||||
if (ramload > 0)
|
|
||||||
new_flags |= FLAT_FLAG_RAM;
|
|
||||||
else if (ramload < 0)
|
|
||||||
new_flags &= ~FLAT_FLAG_RAM;
|
|
||||||
|
|
||||||
if (ktrace > 0)
|
|
||||||
new_flags |= FLAT_FLAG_KTRACE;
|
|
||||||
else if (ktrace < 0)
|
|
||||||
new_flags &= ~FLAT_FLAG_KTRACE;
|
|
||||||
|
|
||||||
if (stacksize)
|
|
||||||
new_stack = stacksize;
|
|
||||||
|
|
||||||
if (print == 1) {
|
|
||||||
time_t t;
|
|
||||||
|
|
||||||
printf("%s\n", ifile);
|
|
||||||
printf(" Magic: %4.4s\n", old_hdr.magic);
|
|
||||||
printf(" Rev: %d\n", ntohl(old_hdr.rev));
|
|
||||||
t = (time_t) htonl(old_hdr.build_date);
|
|
||||||
printf(" Build Date: %s", t?ctime(&t):"not specified\n");
|
|
||||||
printf(" Entry: 0x%x\n", ntohl(old_hdr.entry));
|
|
||||||
printf(" Data Start: 0x%x\n", ntohl(old_hdr.data_start));
|
|
||||||
printf(" Data End: 0x%x\n", ntohl(old_hdr.data_end));
|
|
||||||
printf(" BSS End: 0x%x\n", ntohl(old_hdr.bss_end));
|
|
||||||
printf(" Stack Size: 0x%x\n", ntohl(old_hdr.stack_size));
|
|
||||||
printf(" Reloc Start: 0x%x\n", ntohl(old_hdr.reloc_start));
|
|
||||||
printf(" Reloc Count: 0x%x\n", ntohl(old_hdr.reloc_count));
|
|
||||||
printf(" Flags: 0x%x ( ", ntohl(old_hdr.flags));
|
|
||||||
if (old_flags) {
|
|
||||||
if (old_flags & FLAT_FLAG_RAM)
|
|
||||||
printf("Load-to-Ram ");
|
|
||||||
if (old_flags & FLAT_FLAG_GOTPIC)
|
|
||||||
printf("Has-PIC-GOT ");
|
|
||||||
if (old_flags & FLAT_FLAG_GZIP)
|
|
||||||
printf("Gzip-Compressed ");
|
|
||||||
if (old_flags & FLAT_FLAG_GZDATA)
|
|
||||||
printf("Gzip-Data-Compressed ");
|
|
||||||
if (old_flags & FLAT_FLAG_KTRACE)
|
|
||||||
printf("Kernel-Traced-Load ");
|
|
||||||
printf(")\n");
|
|
||||||
}
|
|
||||||
} else if (print > 1) {
|
|
||||||
static int first = 1;
|
|
||||||
unsigned int text, data, bss, stk, rel, tot;
|
|
||||||
|
|
||||||
if (first) {
|
|
||||||
printf("Flag Rev Text Data BSS Stack Relocs RAM Filename\n");
|
|
||||||
printf("-----------------------------------------------------------\n");
|
|
||||||
first = 0;
|
|
||||||
}
|
|
||||||
*tfile = '\0';
|
|
||||||
strcat(tfile, (old_flags & FLAT_FLAG_KTRACE) ? "k" : "");
|
|
||||||
strcat(tfile, (old_flags & FLAT_FLAG_RAM) ? "r" : "");
|
|
||||||
strcat(tfile, (old_flags & FLAT_FLAG_GOTPIC) ? "p" : "");
|
|
||||||
strcat(tfile, (old_flags & FLAT_FLAG_GZIP) ? "z" :
|
|
||||||
((old_flags & FLAT_FLAG_GZDATA) ? "d" : ""));
|
|
||||||
printf("-%-3.3s ", tfile);
|
|
||||||
printf("%3d ", ntohl(old_hdr.rev));
|
|
||||||
printf("%6d ", text=ntohl(old_hdr.data_start)-sizeof(struct flat_hdr));
|
|
||||||
printf("%6d ", data=ntohl(old_hdr.data_end)-ntohl(old_hdr.data_start));
|
|
||||||
printf("%6d ", bss=ntohl(old_hdr.bss_end)-ntohl(old_hdr.data_end));
|
|
||||||
printf("%6d ", stk=ntohl(old_hdr.stack_size));
|
|
||||||
printf("%6d ", rel=ntohl(old_hdr.reloc_count) * 4);
|
|
||||||
/*
|
|
||||||
* work out how much RAM is needed per invocation, this
|
|
||||||
* calculation is dependent on the binfmt_flat implementation
|
|
||||||
*/
|
|
||||||
tot = data; /* always need data */
|
|
||||||
|
|
||||||
if (old_flags & (FLAT_FLAG_RAM|FLAT_FLAG_GZIP))
|
|
||||||
tot += text + sizeof(struct flat_hdr);
|
|
||||||
|
|
||||||
if (bss + stk > rel) /* which is bigger ? */
|
|
||||||
tot += bss + stk;
|
|
||||||
else
|
|
||||||
tot += rel;
|
|
||||||
|
|
||||||
printf("%6d ", tot);
|
|
||||||
/*
|
|
||||||
* the total depends on whether the relocs are smaller/bigger than
|
|
||||||
* the BSS
|
|
||||||
*/
|
|
||||||
printf("%s\n", ifile);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if there is nothing else to do, leave */
|
|
||||||
if (new_flags == old_flags && new_stack == old_stack)
|
|
||||||
return;
|
|
||||||
|
|
||||||
new_hdr.flags = htonl(new_flags);
|
|
||||||
new_hdr.stack_size = htonl(new_stack);
|
|
||||||
|
|
||||||
strcpy(tfile, "/tmp/flatXXXXXX");
|
|
||||||
mkstemp(tfile);
|
|
||||||
if ((ofp = fopen(tfile, "w" BINARY_FILE_OPTS)) == NULL) {
|
|
||||||
fprintf(stderr, "Failed to open %s for writing\n", tfile);
|
|
||||||
unlink(tfile);
|
|
||||||
unlink(tfile2);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fwrite(&new_hdr, sizeof(new_hdr), 1, ofp) != 1) {
|
|
||||||
fprintf(stderr, "Failed to write to %s\n", tfile);
|
|
||||||
unlink(tfile);
|
|
||||||
unlink(tfile2);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* get ourselves a fully uncompressed copy of the text/data/relocs
|
|
||||||
* so that we can manipulate it more easily
|
|
||||||
*/
|
|
||||||
if (old_flags & (FLAT_FLAG_GZIP|FLAT_FLAG_GZDATA)) {
|
|
||||||
FILE *tfp;
|
|
||||||
|
|
||||||
strcpy(tfile2, "/tmp/flat2XXXXXX");
|
|
||||||
mkstemp(tfile2);
|
|
||||||
|
|
||||||
if (old_flags & FLAT_FLAG_GZDATA) {
|
|
||||||
tfp = fopen(tfile2, "w" BINARY_FILE_OPTS);
|
|
||||||
if (!tfp) {
|
|
||||||
fprintf(stderr, "Failed to open %s for writing\n", tfile2);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
transferr(ifp, tfp, ntohl(old_hdr.data_start) -
|
|
||||||
sizeof(struct flat_hdr));
|
|
||||||
fclose(tfp);
|
|
||||||
}
|
|
||||||
|
|
||||||
sprintf(cmd, "gunzip >> %s", tfile2);
|
|
||||||
tfp = popen(cmd, "w" BINARY_FILE_OPTS);
|
|
||||||
if(!tfp) {
|
|
||||||
perror("popen");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
transferr(ifp, tfp, -1);
|
|
||||||
pclose(tfp);
|
|
||||||
|
|
||||||
fclose(ifp);
|
|
||||||
ifp = fopen(tfile2, "r" BINARY_FILE_OPTS);
|
|
||||||
if (!ifp) {
|
|
||||||
fprintf(stderr, "Failed to open %s for reading\n", tfile2);
|
|
||||||
unlink(tfile);
|
|
||||||
unlink(tfile2);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (new_flags & FLAT_FLAG_GZIP) {
|
|
||||||
printf("zflat %s --> %s\n", ifile, ofile);
|
|
||||||
fclose(ofp);
|
|
||||||
sprintf(cmd, "gzip -9 -f >> %s", tfile);
|
|
||||||
ofp = popen(cmd, "w" BINARY_FILE_OPTS);
|
|
||||||
ofp_is_pipe = 1;
|
|
||||||
} else if (new_flags & FLAT_FLAG_GZDATA) {
|
|
||||||
printf("zflat-data %s --> %s\n", ifile, ofile);
|
|
||||||
transferr(ifp, ofp, ntohl(new_hdr.data_start) -
|
|
||||||
sizeof(struct flat_hdr));
|
|
||||||
fclose(ofp);
|
|
||||||
sprintf(cmd, "gzip -9 -f >> %s", tfile);
|
|
||||||
ofp = popen(cmd, "w" BINARY_FILE_OPTS);
|
|
||||||
ofp_is_pipe = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ofp) { /* can only happen if using gzip/gunzip */
|
|
||||||
fprintf(stderr, "Can't run cmd %s\n", cmd);
|
|
||||||
unlink(tfile);
|
|
||||||
unlink(tfile2);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
transferr(ifp, ofp, -1);
|
|
||||||
|
|
||||||
if (ferror(ifp) || ferror(ofp)) {
|
|
||||||
fprintf(stderr, "Error on file pointer%s%s\n",
|
|
||||||
ferror(ifp) ? " input" : "", ferror(ofp) ? " output" : "");
|
|
||||||
unlink(tfile);
|
|
||||||
unlink(tfile2);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(ifp);
|
|
||||||
if (ofp_is_pipe)
|
|
||||||
pclose(ofp);
|
|
||||||
else
|
|
||||||
fclose(ofp);
|
|
||||||
|
|
||||||
/* cheat a little here to preserve file permissions */
|
|
||||||
sprintf(cmd, "cp %s %s", tfile, ofile);
|
|
||||||
system(cmd);
|
|
||||||
unlink(tfile);
|
|
||||||
unlink(tfile2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************/
|
|
||||||
|
|
||||||
void
|
|
||||||
usage(char *s)
|
|
||||||
{
|
|
||||||
if (s)
|
|
||||||
fprintf(stderr, "%s\n", s);
|
|
||||||
fprintf(stderr, "usage: %s [options] flat-file\n", program_name);
|
|
||||||
fprintf(stderr, " Allows you to change an existing flat file\n\n");
|
|
||||||
fprintf(stderr, " -p : print current settings\n");
|
|
||||||
fprintf(stderr, " -z : compressed flat file\n");
|
|
||||||
fprintf(stderr, " -d : compressed data-only flat file\n");
|
|
||||||
fprintf(stderr, " -Z : un-compressed flat file\n");
|
|
||||||
fprintf(stderr, " -r : ram load\n");
|
|
||||||
fprintf(stderr, " -R : do not RAM load\n");
|
|
||||||
fprintf(stderr, " -k : kernel traced load (for debug)\n");
|
|
||||||
fprintf(stderr, " -K : normal non-kernel traced load\n");
|
|
||||||
fprintf(stderr, " -s size : stack size\n");
|
|
||||||
fprintf(stderr, " -o file : output-file\n"
|
|
||||||
" (default is to modify input file)\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************/
|
|
||||||
|
|
||||||
int
|
|
||||||
main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
int c;
|
|
||||||
char *ofile = NULL, *ifile;
|
|
||||||
|
|
||||||
program_name = argv[0];
|
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "pdzZrRkKs:o:")) != EOF) {
|
|
||||||
switch (c) {
|
|
||||||
case 'p': print = 1; break;
|
|
||||||
case 'z': compress = 1; break;
|
|
||||||
case 'd': compress = 2; break;
|
|
||||||
case 'Z': compress = -1; break;
|
|
||||||
case 'r': ramload = 1; break;
|
|
||||||
case 'R': ramload = -1; break;
|
|
||||||
case 'k': ktrace = 1; break;
|
|
||||||
case 'K': ktrace = -1; break;
|
|
||||||
case 's': stacksize = atoi(optarg); break;
|
|
||||||
case 'o': ofile = optarg; break;
|
|
||||||
default:
|
|
||||||
usage("invalid option");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (optind >= argc)
|
|
||||||
usage("No input files provided");
|
|
||||||
|
|
||||||
if (ofile && argc - optind > 1)
|
|
||||||
usage("-o can only be used with a single file");
|
|
||||||
|
|
||||||
if (!print && !compress && !ramload && !stacksize) /* no args == print */
|
|
||||||
print = argc - optind; /* greater than 1 is short format */
|
|
||||||
|
|
||||||
for (c = optind; c < argc; c++) {
|
|
||||||
ifile = argv[c];
|
|
||||||
if (!ofile)
|
|
||||||
ofile = ifile;
|
|
||||||
process_file(ifile, ofile);
|
|
||||||
ofile = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************/
|
|
@ -1,251 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# install - install a program, script, or datafile
|
|
||||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
|
||||||
#
|
|
||||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
|
||||||
#
|
|
||||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
|
||||||
# documentation for any purpose is hereby granted without fee, provided that
|
|
||||||
# the above copyright notice appear in all copies and that both that
|
|
||||||
# copyright notice and this permission notice appear in supporting
|
|
||||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
|
||||||
# publicity pertaining to distribution of the software without specific,
|
|
||||||
# written prior permission. M.I.T. makes no representations about the
|
|
||||||
# suitability of this software for any purpose. It is provided "as is"
|
|
||||||
# without express or implied warranty.
|
|
||||||
#
|
|
||||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
|
||||||
# `make' implicit rules from creating a file called install from it
|
|
||||||
# when there is no Makefile.
|
|
||||||
#
|
|
||||||
# This script is compatible with the BSD install script, but was written
|
|
||||||
# from scratch. It can only install one file at a time, a restriction
|
|
||||||
# shared with many OS's install programs.
|
|
||||||
|
|
||||||
|
|
||||||
# set DOITPROG to echo to test this script
|
|
||||||
|
|
||||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
|
||||||
doit="${DOITPROG-}"
|
|
||||||
|
|
||||||
|
|
||||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
|
||||||
|
|
||||||
mvprog="${MVPROG-mv}"
|
|
||||||
cpprog="${CPPROG-cp}"
|
|
||||||
chmodprog="${CHMODPROG-chmod}"
|
|
||||||
chownprog="${CHOWNPROG-chown}"
|
|
||||||
chgrpprog="${CHGRPPROG-chgrp}"
|
|
||||||
stripprog="${STRIPPROG-strip}"
|
|
||||||
rmprog="${RMPROG-rm}"
|
|
||||||
mkdirprog="${MKDIRPROG-mkdir}"
|
|
||||||
|
|
||||||
transformbasename=""
|
|
||||||
transform_arg=""
|
|
||||||
instcmd="$mvprog"
|
|
||||||
chmodcmd="$chmodprog 0755"
|
|
||||||
chowncmd=""
|
|
||||||
chgrpcmd=""
|
|
||||||
stripcmd=""
|
|
||||||
rmcmd="$rmprog -f"
|
|
||||||
mvcmd="$mvprog"
|
|
||||||
src=""
|
|
||||||
dst=""
|
|
||||||
dir_arg=""
|
|
||||||
|
|
||||||
while [ x"$1" != x ]; do
|
|
||||||
case $1 in
|
|
||||||
-c) instcmd="$cpprog"
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-d) dir_arg=true
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-m) chmodcmd="$chmodprog $2"
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-o) chowncmd="$chownprog $2"
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-g) chgrpcmd="$chgrpprog $2"
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-s) stripcmd="$stripprog"
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
*) if [ x"$src" = x ]
|
|
||||||
then
|
|
||||||
src=$1
|
|
||||||
else
|
|
||||||
# this colon is to work around a 386BSD /bin/sh bug
|
|
||||||
:
|
|
||||||
dst=$1
|
|
||||||
fi
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ x"$src" = x ]
|
|
||||||
then
|
|
||||||
echo "install: no input file specified"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
:
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ x"$dir_arg" != x ]; then
|
|
||||||
dst=$src
|
|
||||||
src=""
|
|
||||||
|
|
||||||
if [ -d $dst ]; then
|
|
||||||
instcmd=:
|
|
||||||
chmodcmd=""
|
|
||||||
else
|
|
||||||
instcmd=$mkdirprog
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
|
|
||||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
|
||||||
# might cause directories to be created, which would be especially bad
|
|
||||||
# if $src (and thus $dsttmp) contains '*'.
|
|
||||||
|
|
||||||
if [ -f $src -o -d $src ]
|
|
||||||
then
|
|
||||||
:
|
|
||||||
else
|
|
||||||
echo "install: $src does not exist"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ x"$dst" = x ]
|
|
||||||
then
|
|
||||||
echo "install: no destination specified"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
:
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If destination is a directory, append the input filename; if your system
|
|
||||||
# does not like double slashes in filenames, you may need to add some logic
|
|
||||||
|
|
||||||
if [ -d $dst ]
|
|
||||||
then
|
|
||||||
dst="$dst"/`basename $src`
|
|
||||||
else
|
|
||||||
:
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
## this sed command emulates the dirname command
|
|
||||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
|
||||||
|
|
||||||
# Make sure that the destination directory exists.
|
|
||||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
|
||||||
|
|
||||||
# Skip lots of stat calls in the usual case.
|
|
||||||
if [ ! -d "$dstdir" ]; then
|
|
||||||
defaultIFS='
|
|
||||||
'
|
|
||||||
IFS="${IFS-${defaultIFS}}"
|
|
||||||
|
|
||||||
oIFS="${IFS}"
|
|
||||||
# Some sh's can't handle IFS=/ for some reason.
|
|
||||||
IFS='%'
|
|
||||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
|
||||||
IFS="${oIFS}"
|
|
||||||
|
|
||||||
pathcomp=''
|
|
||||||
|
|
||||||
while [ $# -ne 0 ] ; do
|
|
||||||
pathcomp="${pathcomp}${1}"
|
|
||||||
shift
|
|
||||||
|
|
||||||
if [ ! -d "${pathcomp}" ] ;
|
|
||||||
then
|
|
||||||
$mkdirprog "${pathcomp}"
|
|
||||||
else
|
|
||||||
:
|
|
||||||
fi
|
|
||||||
|
|
||||||
pathcomp="${pathcomp}/"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ x"$dir_arg" != x ]
|
|
||||||
then
|
|
||||||
$doit $instcmd $dst &&
|
|
||||||
|
|
||||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi &&
|
|
||||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi &&
|
|
||||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi &&
|
|
||||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi
|
|
||||||
else
|
|
||||||
|
|
||||||
# If we're going to rename the final executable, determine the name now.
|
|
||||||
|
|
||||||
if [ x"$transformarg" = x ]
|
|
||||||
then
|
|
||||||
dstfile=`basename $dst`
|
|
||||||
else
|
|
||||||
dstfile=`basename $dst $transformbasename |
|
|
||||||
sed $transformarg`$transformbasename
|
|
||||||
fi
|
|
||||||
|
|
||||||
# don't allow the sed command to completely eliminate the filename
|
|
||||||
|
|
||||||
if [ x"$dstfile" = x ]
|
|
||||||
then
|
|
||||||
dstfile=`basename $dst`
|
|
||||||
else
|
|
||||||
:
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Make a temp file name in the proper directory.
|
|
||||||
|
|
||||||
dsttmp=$dstdir/#inst.$$#
|
|
||||||
|
|
||||||
# Move or copy the file name to the temp name
|
|
||||||
|
|
||||||
$doit $instcmd $src $dsttmp &&
|
|
||||||
|
|
||||||
trap "rm -f ${dsttmp}" 0 &&
|
|
||||||
|
|
||||||
# and set any options; do chmod last to preserve setuid bits
|
|
||||||
|
|
||||||
# If any of these fail, we abort the whole thing. If we want to
|
|
||||||
# ignore errors from any of these, just make sure not to ignore
|
|
||||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
|
||||||
|
|
||||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi &&
|
|
||||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi &&
|
|
||||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi &&
|
|
||||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi &&
|
|
||||||
|
|
||||||
# Now rename the file to the real destination.
|
|
||||||
|
|
||||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
|
||||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
|
||||||
|
|
||||||
fi &&
|
|
||||||
|
|
||||||
|
|
||||||
exit 0
|
|
@ -1,219 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# allow us to do flat processing if the flag -Wl,-elf2flt or -elf2flt to
|
|
||||||
# the 'C' compiler or linker respectively
|
|
||||||
#
|
|
||||||
# uses the env. var FLTFLAGS as extra parameters to pass to elf2flt
|
|
||||||
# arguments given like -Wl,-elf2flt="-b 10000 -v" are given before FLTFLAGS
|
|
||||||
#
|
|
||||||
# Copyright (C) 2002,2003 David McCullough <davidm@snapgear.com>
|
|
||||||
# Copyright (C) 2000, Lineo. davidm@lineo.com
|
|
||||||
#
|
|
||||||
# This is Free Software, under the GNU Public Licence v2 or greater.
|
|
||||||
#
|
|
||||||
|
|
||||||
LINKER="$0.real" # the original renamed-linker
|
|
||||||
ELF2FLT="`expr $0 : '\(.*\)ld'`elf2flt"
|
|
||||||
NM="`expr $0 : '\(.*\)ld'`nm"
|
|
||||||
TOOLDIR="`dirname $0`" # let gcc find the tools for us
|
|
||||||
OBJCOPY="`expr $0 : '\(.*\)ld'`objcopy"
|
|
||||||
[ -f "$OBJCOPY" ] || OBJCOPY="$TOOLDIR/../../bin/@target_alias@-objcopy"
|
|
||||||
OBJDUMP="`expr $OBJCOPY : '\(.*\)objcopy'`objdump"
|
|
||||||
LDSCRIPTPATH="@binutils_ldscript_dir@" # and the scripts
|
|
||||||
SHARED_ID=""
|
|
||||||
NEWLDSCRIPT=""
|
|
||||||
|
|
||||||
# check TOOLDIR from prefix/bin/ or prefix/target-alias/bin/
|
|
||||||
[ -d "${LDSCRIPTPATH}" ] || LDSCRIPTPATH="${TOOLDIR}/../lib"
|
|
||||||
|
|
||||||
#
|
|
||||||
# if we have the elf2flt options, run it
|
|
||||||
#
|
|
||||||
|
|
||||||
if expr "$*" : ".*-elf2flt.*" > /dev/null
|
|
||||||
then
|
|
||||||
ARG1=
|
|
||||||
ARG2=
|
|
||||||
OFILE="a.out"
|
|
||||||
PIC=
|
|
||||||
SDIRS=
|
|
||||||
LDSCRIPT=
|
|
||||||
FINAL="yes"
|
|
||||||
FINAL_ONLY=
|
|
||||||
MOVDAT=
|
|
||||||
VERBOSE=
|
|
||||||
|
|
||||||
while [ $# -ne 0 ]
|
|
||||||
do
|
|
||||||
case "$1" in
|
|
||||||
|
|
||||||
-elf2flt) ;; # we already know this
|
|
||||||
-elf2flt*)FLTFLAGS="`expr \"$1\" : '-elf2flt=\(.*\)'` $FLTFLAGS";;
|
|
||||||
|
|
||||||
-move-rodata)
|
|
||||||
MOVDAT="y";; # Put rodata in ROM if possible
|
|
||||||
|
|
||||||
-shared-lib-id)
|
|
||||||
shift; SHARED_ID="$1";; # Shared library ID
|
|
||||||
|
|
||||||
-o) shift; OFILE="$1";; # the final outfile
|
|
||||||
-o*) OFILE="`expr \"$1\" : '-o\(.*\)'`";;
|
|
||||||
|
|
||||||
-T) shift; LDSCRIPT="$1";; # they have a linker script
|
|
||||||
-c) shift; LDSCRIPT="$1";;
|
|
||||||
|
|
||||||
-L) ARG1="$ARG1 $1" # remember search dirs
|
|
||||||
shift;
|
|
||||||
ARG1="$ARG1 $1"
|
|
||||||
SDIRS="$SDIRS -L$1"
|
|
||||||
;;
|
|
||||||
-L*) ARG1="$ARG1 $1"; SDIRS="$SDIRS $1";;
|
|
||||||
|
|
||||||
-EB) ARG1="$ARG1 $1"; SDIRS="$SDIRS $1";; # arm big endian
|
|
||||||
|
|
||||||
-relax) ;; # eat this for microblaze
|
|
||||||
|
|
||||||
-r|-Ur) FINAL="" # this is not a final link
|
|
||||||
ARG1="$ARG1 $1"
|
|
||||||
;;
|
|
||||||
|
|
||||||
-v) ARG1="$ARG1 $1"
|
|
||||||
VERBOSE="y"
|
|
||||||
;;
|
|
||||||
|
|
||||||
-m) shift; EMUL="-m $1";; # ld emulations for h8300
|
|
||||||
-m*) EMUL=$1;;
|
|
||||||
|
|
||||||
*) ARG1="$ARG1 $1"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "$FINAL" = "yes" ]
|
|
||||||
then
|
|
||||||
[ "$VERBOSE" = "y" ] && set -x
|
|
||||||
ARG1="$ARG1 $FINAL_ONLY"
|
|
||||||
NEWLDSCRIPT=`mktemp /tmp/flt-XXXXXX`
|
|
||||||
SEDOP=" -e s/^R_RODAT// -e /^W_RODAT/d"
|
|
||||||
OBJCOPYOP=""
|
|
||||||
if [ "$MOVDAT" ]
|
|
||||||
then
|
|
||||||
$LINKER -r -d -o "$OFILE.elf2flt" $ARG1 || exit $?
|
|
||||||
if [ "`$OBJDUMP -h "$OFILE.elf2flt" | \
|
|
||||||
egrep -A1 '[.]rodata' | grep RELOC`" ]
|
|
||||||
then
|
|
||||||
echo "warning: .rodata section contains relocations"
|
|
||||||
else
|
|
||||||
SEDOP="-e /^R_RODAT/d -e s/^W_RODAT//"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [ "$SHARED_ID" ]
|
|
||||||
then
|
|
||||||
# Massage the linker script into something useful. These
|
|
||||||
# regexps are ugly due to some bizzare shell quoting rules.
|
|
||||||
# SEDOP="$SEDOP -e \"s/ORIGIN = 0x0,/ORIGIN = 0x${SHARED_ID}000000,/\""
|
|
||||||
# SEDOP="$SEDOP -e \"s/.text 0x0 :/.text 0x${SHARED_ID}000000 :/\""
|
|
||||||
SEDOP="$SEDOP -e s/\\(ORIGIN.=.0\\)x0,/\\1x${SHARED_ID}000000,/"
|
|
||||||
SEDOP="$SEDOP -e s/\\([.]text.0\\)x0[^0-9]:/\\1x${SHARED_ID}000000:/"
|
|
||||||
|
|
||||||
if [ "$SHARED_ID" -gt 0 ]
|
|
||||||
then
|
|
||||||
# Non application modules enter via main not _start
|
|
||||||
# SEDOP="$SEDOP -e 's/ENTRY (_start)/ENTRY (main)/'"
|
|
||||||
SEDOP="$SEDOP -e s/\\(ENTRY.\\)(_start)/\1(lib_main)/"
|
|
||||||
OBJCOPYOP="--localize-hidden --weaken"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Provide the magic parameter that defines the library data segment pointer offset
|
|
||||||
case "@target_cpu@" in
|
|
||||||
h8300) GOT_OFFSET="__current_shared_library_er5_offset_";;
|
|
||||||
*) GOT_OFFSET="_current_shared_library_a5_offset_";;
|
|
||||||
esac
|
|
||||||
ARG1="$ARG1 -defsym $GOT_OFFSET=`expr ${SHARED_ID} '*' -4 - 4`"
|
|
||||||
fi
|
|
||||||
if [ "@emit_relocs@" = "yes" ]
|
|
||||||
then
|
|
||||||
SEDOP="$SEDOP -e s/^SINGLE_LINK://"
|
|
||||||
else
|
|
||||||
SEDOP="$SEDOP -e /^SINGLE_LINK:/d"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# provide a default linker script, we usually need one
|
|
||||||
[ -z "$LDSCRIPT" ] && LDSCRIPT="${LDSCRIPTPATH}/elf2flt.ld"
|
|
||||||
|
|
||||||
# if we can find the linker script we preprocess it, otherwise
|
|
||||||
# we assume the user knows what they are doing
|
|
||||||
if [ -f "$LDSCRIPT" ]; then
|
|
||||||
sed $SEDOP < "$LDSCRIPT" > "$NEWLDSCRIPT"
|
|
||||||
LDSCRIPT="$NEWLDSCRIPT"
|
|
||||||
elif [ -f "${LDSCRIPTPATH}/$LDSCRIPT" ]; then
|
|
||||||
sed $SEDOP < "${LDSCRIPTPATH}/$LDSCRIPT" > "$NEWLDSCRIPT"
|
|
||||||
LDSCRIPT="$NEWLDSCRIPT"
|
|
||||||
elif [ -f "${LDSCRIPTPATH}/ldscripts/$LDSCRIPT" ]; then
|
|
||||||
sed $SEDOP < "${LDSCRIPTPATH}/ldscripts/$LDSCRIPT" > "$NEWLDSCRIPT"
|
|
||||||
LDSCRIPT="$NEWLDSCRIPT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "@emit_relocs@" = "yes" ]
|
|
||||||
then
|
|
||||||
$LINKER $EMUL $SDIRS -T $LDSCRIPT -q -o "$OFILE.gdb" $ARG1 ||exit $?
|
|
||||||
RFILE="$OFILE.gdb"
|
|
||||||
FLTFLAGS="$FLTFLAGS -a"
|
|
||||||
else
|
|
||||||
if [ "@got_check@" = "no" ]
|
|
||||||
then
|
|
||||||
$LINKER $EMUL $SDIRS -T $LDSCRIPT -Ur -d -o "$OFILE.elf" $ARG1 ||exit $?
|
|
||||||
$LINKER $EMUL $SDIRS -T $LDSCRIPT -o "$OFILE.gdb" $ARG1 ||exit $?
|
|
||||||
else
|
|
||||||
$LINKER $EMUL -r -d -o "$OFILE.elf2flt" $ARG1 ||exit $?
|
|
||||||
$LINKER $EMUL $SDIRS -T $LDSCRIPT -Ur -o "$OFILE.elf" "$OFILE.elf2flt" ||exit $?
|
|
||||||
$LINKER $EMUL $SDIRS -T $LDSCRIPT -o "$OFILE.gdb" "$OFILE.elf2flt" ||exit $?
|
|
||||||
rm -f "$OFILE.elf2flt"
|
|
||||||
fi
|
|
||||||
RFILE="$OFILE.elf"
|
|
||||||
fi
|
|
||||||
if $NM "$OFILE.gdb" | grep _GLOBAL_OFFSET_TABLE_ > /dev/null
|
|
||||||
then
|
|
||||||
$ELF2FLT $FLTFLAGS -o "$OFILE" -p "$OFILE.gdb" "$RFILE" || exit $?
|
|
||||||
else
|
|
||||||
$ELF2FLT $FLTFLAGS -o "$OFILE" -r "$RFILE" || exit $?
|
|
||||||
fi
|
|
||||||
if [ "$OBJCOPYOP" ]
|
|
||||||
then
|
|
||||||
if $OBJCOPY $OBJCOPYOP --help > /dev/null 2>&1
|
|
||||||
then
|
|
||||||
$OBJCOPY $OBJCOPYOP "$OFILE.gdb" ||exit $?
|
|
||||||
else
|
|
||||||
case " $OBJCOPYOP " in
|
|
||||||
*" --localize-hidden "*)
|
|
||||||
SYMS=`mktemp /tmp/flt-XXXXXX`
|
|
||||||
$OBJDUMP --syms "$OFILE.gdb" > "$SYMS" ||exit $?
|
|
||||||
sed -n 's/.*\(\.hidden\|\.internal\) \(.*\)/-L \2/p' < "$SYMS" > "$SYMS.hidden" ||exit $?
|
|
||||||
if [ -s "$SYMS.hidden" ]
|
|
||||||
then
|
|
||||||
xargs ${VERBOSE:+-t} $OBJCOPY "$OFILE.gdb" < "$SYMS.hidden" ||exit $?
|
|
||||||
fi
|
|
||||||
rm -f "$SYMS" "$SYMS.hidden"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
case " $OBJCOPYOP " in
|
|
||||||
*" --weaken "*)
|
|
||||||
$OBJCOPY --weaken "$OFILE.gdb" ||exit $?
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
[ "$RFILE" = "$OFILE.gdb" ] || rm -f "$RFILE" # not needed for any reason
|
|
||||||
rm -f "$NEWLDSCRIPT"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec $LINKER -o "$OFILE" $ARG1
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# otherwise pretend we aren't here
|
|
||||||
#
|
|
||||||
|
|
||||||
exec $LINKER "$@"
|
|
@ -1,12 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
cvs_stamp=$(cut -d/ -f4 CVS/Entries | sort | tail -n 1)
|
|
||||||
stamp=$(date +%Y%m%d --date="${cvs_stamp}")
|
|
||||||
|
|
||||||
p="elf2flt-${stamp}"
|
|
||||||
rm -f elf2flt-*.tar.bz2
|
|
||||||
mkdir ../${p}
|
|
||||||
cp -r * ../${p}/ || exit 1
|
|
||||||
tar jcf ${p}.tar.bz2 --exclude .svn -C .. ${p}
|
|
||||||
rm -r ../${p} || exit 1
|
|
||||||
du -b ${p}.tar.bz2
|
|
@ -1,6 +0,0 @@
|
|||||||
#ifndef HAVE_DCGETTEXT
|
|
||||||
const char *dcgettext (const char *domain, const char *msg, int category)
|
|
||||||
{
|
|
||||||
return msg;
|
|
||||||
}
|
|
||||||
#endif /* !HAVE_DCGETTEXT */
|
|
Loading…
x
Reference in New Issue
Block a user