diff options
23 files changed, 14087 insertions, 2 deletions
| diff --git a/toolchain/Config.in b/toolchain/Config.in index ed256840a..c897f8c87 100644 --- a/toolchain/Config.in +++ b/toolchain/Config.in @@ -9,11 +9,12 @@ source "toolchain/binutils/Config.in"  source "toolchain/gcc/Config.in"  source "toolchain/ccache/Config.in"  source "toolchain/gdb/Config.in" -source "toolchain/sstrip/Config.in" - +source "toolchain/elf2flt/Config.in"  comment "Common Toolchain Options" +source "toolchain/sstrip/Config.in" +  config BR2_ENABLE_MULTILIB  	bool "Enable multilib support?"  	default y diff --git a/toolchain/elf2flt/Config.in b/toolchain/elf2flt/Config.in new file mode 100644 index 000000000..f8bdf5d71 --- /dev/null +++ b/toolchain/elf2flt/Config.in @@ -0,0 +1,12 @@ +comment "elf2flt" + +config BR2_ELF2FLT +	bool "Enable elf2flt support?" +	default n +	help +	  uCLinux uses a Binary Flat format commonly known as BFLT. It +	  is a relatively simple and lightweight executable format +	  based on the original a.out format. + +	  This option compiles the required tools and makes the required +	  modifications on your toolchain (linker). diff --git a/toolchain/elf2flt/elf2flt.mk b/toolchain/elf2flt/elf2flt.mk new file mode 100644 index 000000000..b796ed987 --- /dev/null +++ b/toolchain/elf2flt/elf2flt.mk @@ -0,0 +1,48 @@ +############################################################# +# +# elf2flt +# +############################################################# + +# we keep a local checkout of uClinux CVS +ELF2FLT_SOURCE:=$(ELF2FLT_DIR)/elf2flt +ELF2FLT_DIR:=$(TOOL_BUILD_DIR)/elf2flt +ELF2FLT_BINARY:=elf2flt + +$(ELF2FLT_DIR)/.unpacked: +	cp -r toolchain/elf2flt/elf2flt "$(TOOL_BUILD_DIR)/elf2flt" +	touch $(ELF2FLT_DIR)/.unpacked + +$(ELF2FLT_DIR)/.patched: $(ELF2FLT_DIR)/.unpacked +ifeq ($(strip $(ARCH)),nios2) +	$(SED) "s,STAGING_DIR,$(STAGING_DIR),g;" toolchain/elf2flt/elf2flt.nios2.conditional +	$(SED) "s,CROSS_COMPILE_PREFIX,$(REAL_GNU_TARGET_NAME),g;" toolchain/elf2flt/elf2flt.nios2.conditional +	toolchain/patch-kernel.sh $(ELF2FLT_DIR) toolchain/elf2flt elf2flt.nios2.conditional +endif +	touch $(ELF2FLT_DIR)/.patched + +$(ELF2FLT_DIR)/.configured: $(ELF2FLT_DIR)/.patched +	(cd $(ELF2FLT_DIR); rm -rf config.cache; \ +		$(ELF2FLT_DIR)/configure \ +		--with-bfd-include-dir=$(BINUTILS_DIR1)/bfd/ \ +		--target=$(REAL_GNU_TARGET_NAME) \ +		--with-libbfd=$(BINUTILS_DIR1)/bfd/libbfd.a \ +		--with-libiberty=$(BINUTILS_DIR1)/libiberty/libiberty.a \ +		--prefix=$(STAGING_DIR)) +	touch $(ELF2FLT_DIR)/.configured + +$(ELF2FLT_DIR)/$(ELF2FLT_BINARY): $(ELF2FLT_DIR)/.configured +	$(MAKE) -C $(ELF2FLT_DIR) all +	$(MAKE) -C $(ELF2FLT_DIR) install + +elf2flt: uclibc_target uclibc-configured binutils gcc $(ELF2FLT_DIR)/$(ELF2FLT_BINARY) + +elf2flt-clean: +	rm -rf $(ELF2FLT_SOURCE) + +elf2flt-dirclean: +	rm -rf $(ELF2FLT_SOURCE) + +ifeq ($(strip $(BR2_ELF2FLT)),y) +TARGETS+=elf2flt +endif diff --git a/toolchain/elf2flt/elf2flt.nios2.conditional b/toolchain/elf2flt/elf2flt.nios2.conditional new file mode 100644 index 000000000..42b24b8fa --- /dev/null +++ b/toolchain/elf2flt/elf2flt.nios2.conditional @@ -0,0 +1,335 @@ +--- elf2flt/Makefile.in ++++ elf2flt/Makefile.in +@@ -34,6 +34,12 @@ else  + SRC_LDFILE= elf2flt.ld + endif +  ++ifeq ($(strip $(CPU)),nios2) ++SRC_LDFILE= $(CPU)-elf2flt.ld ++else  ++SRC_LDFILE= elf2flt.ld ++endif ++ + target_bindir = $(prefix)/$(TARGET)/bin + target_libdir = $(prefix)/$(TARGET)/lib +  +--- elf2flt/elf2flt.c ++++ elf2flt/elf2flt.c +@@ -553,9 +553,11 @@ dump_symbols(symbols, number_of_symbols) + 	 *	Only relocate things in the data sections if we are PIC/GOT. + 	 *	otherwise do text as well + 	 */ +-	if (!pic_with_got && (a->flags & SEC_CODE)) ++// wentao	if (!pic_with_got && (a->flags & SEC_CODE)) ++	if (!pic_with_got && (strcmp(".text", a->name) == 0)) + 		sectionp = text + (a->vma - text_vma); +-	else if (a->flags & SEC_DATA) ++//	wentao else if (a->flags & SEC_DATA) ++	else if (strcmp(".data", a->name) == 0) + 		sectionp = data + (a->vma - data_vma); + 	else + 		continue; +@@ -926,8 +928,7 @@ dump_symbols(symbols, number_of_symbols) + 						bad_relocs++; + 						continue; + 					} +-					/* Absolute symbol done not relocation */ +-					relocation_needed = !bfd_is_abs_section(sym_section); ++					relocation_needed = 1; + 					sym_addr = (*(q->sym_ptr_ptr))->value; + 					sym_vma = bfd_section_vma(abs_bfd, sym_section); + 					sym_addr += sym_vma + q->addend; +@@ -1013,19 +1014,10 @@ dump_symbols(symbols, number_of_symbols) +  + 					/* grab any offset from the text */ + 					offset = (p[0]<<24) + (p[1] << 16) + (p[2] << 8) + (p[3]); ++					//sym_addr = (*(q->sym_ptr_ptr))->value; + 					sym_vma = bfd_section_vma(abs_bfd, sym_section); +-					/* This is a horrible kludge.  For some +-					   reason, *sometimes* the offset is in +-					   both addend and the code.  Detect +-					   it, and cancel the effect.  Otherwise +-					   the offset gets added twice - ouch. +-					   There should be a better test +-					   for this condition, based on the +-					   BFD data structures */ +-					if(offset==q->addend) +-						offset=0; +- + 					sym_addr += offset + sym_vma + q->addend; ++ + 					relocation_needed = 1; + 					break; + 				} +@@ -1848,32 +1840,27 @@ int main(int argc, char *argv[]) +   /* Group output sections into text, data, and bss, and calc their sizes.  */ +   for (s = abs_bfd->sections; s != NULL; s = s->next) { +     unsigned long *vma, *len; +-    bfd_size_type sec_size; +-    bfd_vma sec_vma; +  +-    if (s->flags & SEC_CODE) { ++	if (strcmp(s->name, ".text") == 0) /*wentao    if (s->flags & SEC_CODE)*/ { +       vma = &text_vma; +       len = &text_len; +-    } else if (s->flags & SEC_DATA) { ++    } else if (strcmp(s->name, ".data") == 0) /* wentao (s->flags & SEC_DATA)*/ { +       vma = &data_vma; +       len = &data_len; +-    } else if (s->flags & SEC_ALLOC) { ++    } else if (strcmp(s->name, ".bss") == 0) /*(s->flags & SEC_ALLOC)*/ { +       vma = &bss_vma; +       len = &bss_len; +     } else +       continue; +  +-    sec_size = bfd_section_size(abs_bfd, s); +-    sec_vma  = bfd_section_vma(abs_bfd, s); +- +-    if (sec_vma < *vma) { ++    if (s->vma < *vma) { +       if (*len > 0) +-	*len += sec_vma - *vma; ++	*len += s->vma - *vma; +       else +-	*len = sec_size; +-      *vma = sec_vma; +-    } else if (sec_vma + sec_size > *vma + *len) +-      *len = sec_vma + sec_size - *vma; ++	*len = s->_raw_size; ++      *vma = s->vma; ++    } else if (s->vma + s->_raw_size > *vma + *len) ++      *len = s->vma + s->_raw_size - *vma; +   } +  +   if (text_len == 0) { +@@ -1888,10 +1875,10 @@ int main(int argc, char *argv[]) +  +   /* Read in all text sections.  */ +   for (s = abs_bfd->sections; s != NULL; s = s->next) +-    if (s->flags & SEC_CODE)  ++    if (strcmp(s->name, ".text") == 0) /* wentao (s->flags & SEC_CODE) */ +       if (!bfd_get_section_contents(abs_bfd, s, + 				   text + (s->vma - text_vma), 0, +-				   bfd_section_size(abs_bfd, s))) ++				   s->_raw_size)) +       { + 	fprintf(stderr, "read error section %s\n", s->name); + 	exit(2); +@@ -1919,10 +1906,10 @@ int main(int argc, char *argv[]) +  +   /* Read in all data sections.  */ +   for (s = abs_bfd->sections; s != NULL; s = s->next) +-    if (s->flags & SEC_DATA)  ++    if (strcmp(s->name, ".data") == 0) /* wentao (s->flags & SEC_DATA)*/  +       if (!bfd_get_section_contents(abs_bfd, s, + 				   data + (s->vma - data_vma), 0, +-				   bfd_section_size(abs_bfd, s))) ++				   s->_raw_size)) +       { + 	fprintf(stderr, "read error section %s\n", s->name); + 	exit(2); +--- elf2flt/nios2-elf2flt.ld ++++ elf2flt/nios2-elf2flt.ld +@@ -0,0 +1,126 @@ ++ENTRY (_start) ++ ++MEMORY { ++        flatmem : ORIGIN = 0x0, LENGTH = 0xfffffff ++} ++ ++SECTIONS { ++        .text 0 : { ++		/* Avoid address 0; binfmt_flat treats it specially.  */ ++		. = . + 4 ; ++ ++                . = ALIGN(0x4) ; ++                _stext = . ; ++ ++                *(.text) ++                *(.text.*) ++                *(.gnu.warning) ++                *(.stub) ++                *(.gnu.linkonce.t*) ++				*(.jcr) ++                *(.init) ++                *(.fini) ++ ++		/* 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(0x10) ; ++		_etext = . ; ++        } > flatmem ++        .data : { ++                . = ALIGN(0x4) ; ++                _sdata = . ; ++				__data_start = . ; ++				data_start = . ; ++				*(.rela.got) ++				*(.rel.got) ++				*(.got.plt) ++				*(.got) ++				LONG(-1) ++                *(.rodata) ++                *(.rodata1) ++                *(.rodata.*) ++                *(.gnu.linkonce.r*) ++                *(.data) ++                *(.data.*) ++                *(.gnu.linkonce.d*) ++                *(.data1) ++                *(.eh_frame) ++                *(.gcc_except_table) ++				. = ALIGN(4) ; ++				*(.ctors.*) ++				*(.ctors) ++				LONG(0) ++				*(.dtors.*) ++				*(.dtors) ++				LONG(0) ++                . = ALIGN(0x10) ; ++ ++				_gp = ABSOLUTE(ALIGN(16) + 0x7ff0); ++		  		PROVIDE(gp = _gp); ++                *(.sdata)  ++                *(.sdata.*) ++                *(.sbss) ++                *(.gnu.linkonce.s.*) ++                _edata = . ; ++        } > flatmem ++        .bss : { ++                . = ALIGN(0x4) ; ++                _sbss = ALIGN(0x4) ; ++				__bss_start = . ; ++                *(.dynsbss) ++                *(.sbss) ++                *(.sbss.*) ++                *(.scommon) ++                *(.dynbss) ++                *(.bss) ++                *(.bss.*) ++                *(COMMON) ++                . = ALIGN(0x4) ; ++                _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) } ++  /* DWARF debug sections. ++     Symbols in the DWARF debugging sections are relative to the beginning ++     of the section so we begin them at 0.  */ ++  /* DWARF 1 */ ++  .debug          0 : { *(.debug) } ++  .line           0 : { *(.line) } ++  /* GNU DWARF 1 extensions */ ++  .debug_srcinfo  0 : { *(.debug_srcinfo) } ++  .debug_sfnames  0 : { *(.debug_sfnames) } ++  /* DWARF 1.1 and DWARF 2 */ ++  .debug_aranges  0 : { *(.debug_aranges) } ++  .debug_pubnames 0 : { *(.debug_pubnames) } ++  /* DWARF 2 */ ++  .debug_info     0 : { *(.debug_info) } ++  .debug_abbrev   0 : { *(.debug_abbrev) } ++  .debug_line     0 : { *(.debug_line) } ++  .debug_frame    0 : { *(.debug_frame) } ++  .debug_str      0 : { *(.debug_str) } ++  .debug_loc      0 : { *(.debug_loc) } ++  .debug_macinfo  0 : { *(.debug_macinfo) } ++  /* SGI/MIPS DWARF 2 extensions */ ++  .debug_weaknames 0 : { *(.debug_weaknames) } ++  .debug_funcnames 0 : { *(.debug_funcnames) } ++  .debug_typenames 0 : { *(.debug_typenames) } ++  .debug_varnames  0 : { *(.debug_varnames) } ++  /* These must appear regardless of  .  */         ++} +--- elf2flt/ld-elf2flt.in ++++ elf2flt/ld-elf2flt.in +@@ -15,13 +15,9 @@ + LINKER="$0.real"            # the original renamed-linker + ELF2FLT="`expr $0 : '\(.*\)ld'`elf2flt" + TOOLDIR="`dirname $0`"      # let gcc find the tools for us +-LDSCRIPTPATH="${TOOLDIR}/../@target_alias@/lib"		# and the scripts + SHARED_ID="" + NEWLDSCRIPT="" +  +-# check TOOLDIR from prefix/bin/ or prefix/target-alias/bin/ +-[ -d "${TOOLDIR}/../@target_alias@/lib" ] || LDSCRIPTPATH="${TOOLDIR}/../lib" +- + # + # if we have the elf2flt options, run it + # +@@ -77,9 +73,6 @@ then + 				  VERBOSE="y" + 				  ;; +  +-		-m)       shift; EMUL="-m $1";;        # ld emulations for h8300 +-		-m*)      EMUL=$1;; +-  + 		*)        ARG1="$ARG1 $1" + 				  ;; + 		esac +@@ -120,37 +113,33 @@ then + 			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`" ++			ARG1="$ARG1 -defsym _current_shared_library_a5_offset_=`expr ${SHARED_ID} '*' -4 - 4`" + 		fi + 		 + 		# provide a default linker script, we usually need one +-		[ -z "$LDSCRIPT" ] && LDSCRIPT="${LDSCRIPTPATH}/elf2flt.ld" ++		[ -z "$LDSCRIPT" ] && LDSCRIPT="@prefix@/@target_alias@/lib/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" ++		elif [ -f "@prefix@/@target_alias@/lib/$LDSCRIPT" ]; then ++			sed $SEDOP < "@prefix@/@target_alias@/lib/$LDSCRIPT" > "$NEWLDSCRIPT" + 			LDSCRIPT="$NEWLDSCRIPT" +-		elif [ -f "${LDSCRIPTPATH}/ldscripts/$LDSCRIPT" ]; then +-			sed $SEDOP < "${LDSCRIPTPATH}/ldscripts/$LDSCRIPT" > "$NEWLDSCRIPT" ++		elif [ -f "@prefix@/@target_alias@/lib/ldscripts/$LDSCRIPT" ]; then ++			sed $SEDOP < "@prefix@/@target_alias@/lib/ldscripts/$LDSCRIPT" > "$NEWLDSCRIPT" + 			LDSCRIPT="$NEWLDSCRIPT" + 		fi +  + 		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 $? ++		 $LINKER $SDIRS -T $LDSCRIPT -Ur -d -o "$OFILE.elf" $ARG1         ||exit $? ++		 $LINKER $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 $? ++		 $LINKER -r -d -o "$OFILE.elf2flt" $ARG1                          ||exit $? ++		 $LINKER $SDIRS -T $LDSCRIPT -Ur -o "$OFILE.elf" "$OFILE.elf2flt" ||exit $? ++		 $LINKER $SDIRS -T $LDSCRIPT -o "$OFILE.gdb" "$OFILE.elf2flt"     ||exit $? + 		 rm -f "$OFILE.elf2flt" + 		fi + 		if grep _GLOBAL_OFFSET_TABLE_ "$OFILE.gdb" > /dev/null  diff --git a/toolchain/elf2flt/elf2flt/CVS/Entries b/toolchain/elf2flt/elf2flt/CVS/Entries new file mode 100644 index 000000000..31ccf330f --- /dev/null +++ b/toolchain/elf2flt/elf2flt/CVS/Entries @@ -0,0 +1,17 @@ +/LICENSE.TXT/1.1/Tue Jan 10 04:34:09 2006// +/README/1.5/Tue Jan 10 04:34:09 2006/-ko/ +/config.guess/1.2/Tue Jan 10 04:34:08 2006/-ko/ +/configure/1.9/Tue Jan 10 04:34:08 2006/-ko/ +/configure.in/1.7/Tue Jan 10 04:34:08 2006/-ko/ +/e1-elf2flt.ld/1.1/Tue Jan 10 04:34:09 2006// +/flat.h/1.6/Tue Jan 10 04:34:08 2006/-ko/ +/install-sh/1.1.1.1/Tue Jan 10 04:34:08 2006/-ko/ +/stubs.c/1.1/Tue Jan 10 04:34:08 2006// +/config.sub/1.7/Tue Jan 10 05:00:01 2006/-ko/ +/cygwin-elf.h/1.3/Tue Jan 10 05:00:02 2006// +/flthdr.c/1.8/Tue Jan 10 05:11:20 2006/-ko/ +/Makefile.in/1.14/Tue Jan 10 05:12:31 2006/-ko/ +/elf2flt.c/1.36/Tue Jan 10 05:12:32 2006/-ko/ +/elf2flt.ld/1.12/Tue Jan 10 05:12:32 2006/-ko/ +/ld-elf2flt.in/1.10/Tue Jan 10 05:12:32 2006// +D diff --git a/toolchain/elf2flt/elf2flt/CVS/Repository b/toolchain/elf2flt/elf2flt/CVS/Repository new file mode 100644 index 000000000..61a695f7c --- /dev/null +++ b/toolchain/elf2flt/elf2flt/CVS/Repository @@ -0,0 +1 @@ +elf2flt diff --git a/toolchain/elf2flt/elf2flt/CVS/Root b/toolchain/elf2flt/elf2flt/CVS/Root new file mode 100644 index 000000000..0b9f52725 --- /dev/null +++ b/toolchain/elf2flt/elf2flt/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@cvs.uclinux.org:/var/cvs diff --git a/toolchain/elf2flt/elf2flt/LICENSE.TXT b/toolchain/elf2flt/elf2flt/LICENSE.TXT new file mode 100644 index 000000000..5b6e7c66c --- /dev/null +++ b/toolchain/elf2flt/elf2flt/LICENSE.TXT @@ -0,0 +1,340 @@ +		    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. diff --git a/toolchain/elf2flt/elf2flt/Makefile.in b/toolchain/elf2flt/elf2flt/Makefile.in new file mode 100644 index 000000000..24dd96d1e --- /dev/null +++ b/toolchain/elf2flt/elf2flt/Makefile.in @@ -0,0 +1,81 @@ +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@ -static +LIBS = @LIBS@ +INSTALL = @INSTALL@ +DEFS = @DEFS@ -DTARGET_$(CPU) +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ + +UNAME := $(shell uname -s) + +ifneq (,$(findstring MINGW,$(UNAME))) +   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) -s -m 755 $(PROG_FLTHDR) $(bindir)/$(TARGET)-$(PROG_FLTHDR) +	$(INSTALL) -s -m 755 $(PROG_FLTHDR) $(target_bindir)/$(PROG_FLTHDR) +	$(INSTALL) -s -m 755 $(PROG_ELF2FLT) $(bindir)/$(TARGET)-$(PROG_ELF2FLT) +	$(INSTALL) -s -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) + + diff --git a/toolchain/elf2flt/elf2flt/README b/toolchain/elf2flt/elf2flt/README new file mode 100644 index 000000000..6e8a687e1 --- /dev/null +++ b/toolchain/elf2flt/elf2flt/README @@ -0,0 +1,62 @@ + +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). + diff --git a/toolchain/elf2flt/elf2flt/config.guess b/toolchain/elf2flt/elf2flt/config.guess new file mode 100755 index 000000000..afcb19c1d --- /dev/null +++ b/toolchain/elf2flt/elf2flt/config.guess @@ -0,0 +1,1418 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +#   2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +timestamp='2003-10-16' + +# This file 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. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Per Bothner <per@bothner.com>. +# Please send patches to <config-patches@gnu.org>.  Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub.  If it succeeds, it prints the system name on stdout, and +# exits with 0.  Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: +  -h, --help         print this help, then exit +  -t, --time-stamp   print date of last modification, then exit +  -v, --version      print version number, then exit + +Report bugs and patches to <config-patches@gnu.org>." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions.  There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do +  case $1 in +    --time-stamp | --time* | -t ) +       echo "$timestamp" ; exit 0 ;; +    --version | -v ) +       echo "$version" ; exit 0 ;; +    --help | --h* | -h ) +       echo "$usage"; exit 0 ;; +    -- )     # Stop option processing +       shift; break ;; +    - )	# Use stdin as input. +       break ;; +    -* ) +       echo "$me: invalid option $1$help" >&2 +       exit 1 ;; +    * ) +       break ;; +  esac +done + +if test $# != 0; then +  echo "$me: too many arguments$help" >&2 +  exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,)    echo "int x;" > $dummy.c ; +	for c in cc gcc c89 c99 ; do +	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then +	     CC_FOR_BUILD="$c"; break ; +	  fi ; +	done ; +	if test x"$CC_FOR_BUILD" = x ; then +	  CC_FOR_BUILD=no_compiler_found ; +	fi +	;; + ,,*)   CC_FOR_BUILD=$CC ;; + ,*,*)  CC_FOR_BUILD=$HOST_CC ;; +esac ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then +	PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in +    *:NetBSD:*:*) +	# NetBSD (nbsd) targets should (where applicable) match one or +	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, +	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently +	# switched to ELF, *-*-netbsd* would select the old +	# object file format.  This provides both forward +	# compatibility and a consistent mechanism for selecting the +	# object file format. +	# +	# Note: NetBSD doesn't particularly care about the vendor +	# portion of the name.  We always set it to "unknown". +	sysctl="sysctl -n hw.machine_arch" +	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ +	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)` +	case "${UNAME_MACHINE_ARCH}" in +	    armeb) machine=armeb-unknown ;; +	    arm*) machine=arm-unknown ;; +	    sh3el) machine=shl-unknown ;; +	    sh3eb) machine=sh-unknown ;; +	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;; +	esac +	# The Operating System including object format, if it has switched +	# to ELF recently, or will in the future. +	case "${UNAME_MACHINE_ARCH}" in +	    arm*|i386|m68k|ns32k|sh3*|sparc|vax) +		eval $set_cc_for_build +		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ +			| grep __ELF__ >/dev/null +		then +		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). +		    # Return netbsd for either.  FIX? +		    os=netbsd +		else +		    os=netbsdelf +		fi +		;; +	    *) +	        os=netbsd +		;; +	esac +	# The OS release +	# Debian GNU/NetBSD machines have a different userland, and +	# thus, need a distinct triplet. However, they do not need +	# kernel version information, so it can be replaced with a +	# suitable tag, in the style of linux-gnu. +	case "${UNAME_VERSION}" in +	    Debian*) +		release='-gnu' +		;; +	    *) +		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` +		;; +	esac +	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: +	# contains redundant information, the shorter form: +	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. +	echo "${machine}-${os}${release}" +	exit 0 ;; +    amiga:OpenBSD:*:*) +	echo m68k-unknown-openbsd${UNAME_RELEASE} +	exit 0 ;; +    arc:OpenBSD:*:*) +	echo mipsel-unknown-openbsd${UNAME_RELEASE} +	exit 0 ;; +    hp300:OpenBSD:*:*) +	echo m68k-unknown-openbsd${UNAME_RELEASE} +	exit 0 ;; +    mac68k:OpenBSD:*:*) +	echo m68k-unknown-openbsd${UNAME_RELEASE} +	exit 0 ;; +    macppc:OpenBSD:*:*) +	echo powerpc-unknown-openbsd${UNAME_RELEASE} +	exit 0 ;; +    mvme68k:OpenBSD:*:*) +	echo m68k-unknown-openbsd${UNAME_RELEASE} +	exit 0 ;; +    mvme88k:OpenBSD:*:*) +	echo m88k-unknown-openbsd${UNAME_RELEASE} +	exit 0 ;; +    mvmeppc:OpenBSD:*:*) +	echo powerpc-unknown-openbsd${UNAME_RELEASE} +	exit 0 ;; +    pmax:OpenBSD:*:*) +	echo mipsel-unknown-openbsd${UNAME_RELEASE} +	exit 0 ;; +    sgi:OpenBSD:*:*) +	echo mipseb-unknown-openbsd${UNAME_RELEASE} +	exit 0 ;; +    sun3:OpenBSD:*:*) +	echo m68k-unknown-openbsd${UNAME_RELEASE} +	exit 0 ;; +    wgrisc:OpenBSD:*:*) +	echo mipsel-unknown-openbsd${UNAME_RELEASE} +	exit 0 ;; +    *:OpenBSD:*:*) +	echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} +	exit 0 ;; +    alpha:OSF1:*:*) +	if test $UNAME_RELEASE = "V4.0"; then +		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` +	fi +	# According to Compaq, /usr/sbin/psrinfo has been available on +	# OSF/1 and Tru64 systems produced since 1995.  I hope that +	# covers most systems running today.  This code pipes the CPU +	# types through head -n 1, so we only detect the type of CPU 0. +	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1` +	case "$ALPHA_CPU_TYPE" in +	    "EV4 (21064)") +		UNAME_MACHINE="alpha" ;; +	    "EV4.5 (21064)") +		UNAME_MACHINE="alpha" ;; +	    "LCA4 (21066/21068)") +		UNAME_MACHINE="alpha" ;; +	    "EV5 (21164)") +		UNAME_MACHINE="alphaev5" ;; +	    "EV5.6 (21164A)") +		UNAME_MACHINE="alphaev56" ;; +	    "EV5.6 (21164PC)") +		UNAME_MACHINE="alphapca56" ;; +	    "EV5.7 (21164PC)") +		UNAME_MACHINE="alphapca57" ;; +	    "EV6 (21264)") +		UNAME_MACHINE="alphaev6" ;; +	    "EV6.7 (21264A)") +		UNAME_MACHINE="alphaev67" ;; +	    "EV6.8CB (21264C)") +		UNAME_MACHINE="alphaev68" ;; +	    "EV6.8AL (21264B)") +		UNAME_MACHINE="alphaev68" ;; +	    "EV6.8CX (21264D)") +		UNAME_MACHINE="alphaev68" ;; +	    "EV6.9A (21264/EV69A)") +		UNAME_MACHINE="alphaev69" ;; +	    "EV7 (21364)") +		UNAME_MACHINE="alphaev7" ;; +	    "EV7.9 (21364A)") +		UNAME_MACHINE="alphaev79" ;; +	esac +	# A Vn.n version is a released version. +	# A Tn.n version is a released field test version. +	# A Xn.n version is an unreleased experimental baselevel. +	# 1.2 uses "1.2" for uname -r. +	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` +	exit 0 ;; +    Alpha*:OpenVMS:*:*) +	echo alpha-hp-vms +	exit 0 ;; +    Alpha\ *:Windows_NT*:*) +	# How do we know it's Interix rather than the generic POSIX subsystem? +	# Should we change UNAME_MACHINE based on the output of uname instead +	# of the specific Alpha model? +	echo alpha-pc-interix +	exit 0 ;; +    21064:Windows_NT:50:3) +	echo alpha-dec-winnt3.5 +	exit 0 ;; +    Amiga*:UNIX_System_V:4.0:*) +	echo m68k-unknown-sysv4 +	exit 0;; +    *:[Aa]miga[Oo][Ss]:*:*) +	echo ${UNAME_MACHINE}-unknown-amigaos +	exit 0 ;; +    *:[Mm]orph[Oo][Ss]:*:*) +	echo ${UNAME_MACHINE}-unknown-morphos +	exit 0 ;; +    *:OS/390:*:*) +	echo i370-ibm-openedition +	exit 0 ;; +    *:OS400:*:*) +        echo powerpc-ibm-os400 +	exit 0 ;; +    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) +	echo arm-acorn-riscix${UNAME_RELEASE} +	exit 0;; +    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) +	echo hppa1.1-hitachi-hiuxmpp +	exit 0;; +    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) +	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. +	if test "`(/bin/universe) 2>/dev/null`" = att ; then +		echo pyramid-pyramid-sysv3 +	else +		echo pyramid-pyramid-bsd +	fi +	exit 0 ;; +    NILE*:*:*:dcosx) +	echo pyramid-pyramid-svr4 +	exit 0 ;; +    DRS?6000:unix:4.0:6*) +	echo sparc-icl-nx6 +	exit 0 ;; +    DRS?6000:UNIX_SV:4.2*:7*) +	case `/usr/bin/uname -p` in +	    sparc) echo sparc-icl-nx7 && exit 0 ;; +	esac ;; +    sun4H:SunOS:5.*:*) +	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` +	exit 0 ;; +    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) +	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` +	exit 0 ;; +    i86pc:SunOS:5.*:*) +	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` +	exit 0 ;; +    sun4*:SunOS:6*:*) +	# According to config.sub, this is the proper way to canonicalize +	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but +	# it's likely to be more like Solaris than SunOS4. +	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` +	exit 0 ;; +    sun4*:SunOS:*:*) +	case "`/usr/bin/arch -k`" in +	    Series*|S4*) +		UNAME_RELEASE=`uname -v` +		;; +	esac +	# Japanese Language versions have a version number like `4.1.3-JL'. +	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` +	exit 0 ;; +    sun3*:SunOS:*:*) +	echo m68k-sun-sunos${UNAME_RELEASE} +	exit 0 ;; +    sun*:*:4.2BSD:*) +	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` +	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 +	case "`/bin/arch`" in +	    sun3) +		echo m68k-sun-sunos${UNAME_RELEASE} +		;; +	    sun4) +		echo sparc-sun-sunos${UNAME_RELEASE} +		;; +	esac +	exit 0 ;; +    aushp:SunOS:*:*) +	echo sparc-auspex-sunos${UNAME_RELEASE} +	exit 0 ;; +    # The situation for MiNT is a little confusing.  The machine name +    # can be virtually everything (everything which is not +    # "atarist" or "atariste" at least should have a processor +    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT" +    # to the lowercase version "mint" (or "freemint").  Finally +    # the system name "TOS" denotes a system which is actually not +    # MiNT.  But MiNT is downward compatible to TOS, so this should +    # be no problem. +    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) +        echo m68k-atari-mint${UNAME_RELEASE} +	exit 0 ;; +    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) +	echo m68k-atari-mint${UNAME_RELEASE} +        exit 0 ;; +    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) +        echo m68k-atari-mint${UNAME_RELEASE} +	exit 0 ;; +    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) +        echo m68k-milan-mint${UNAME_RELEASE} +        exit 0 ;; +    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) +        echo m68k-hades-mint${UNAME_RELEASE} +        exit 0 ;; +    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) +        echo m68k-unknown-mint${UNAME_RELEASE} +        exit 0 ;; +    powerpc:machten:*:*) +	echo powerpc-apple-machten${UNAME_RELEASE} +	exit 0 ;; +    RISC*:Mach:*:*) +	echo mips-dec-mach_bsd4.3 +	exit 0 ;; +    RISC*:ULTRIX:*:*) +	echo mips-dec-ultrix${UNAME_RELEASE} +	exit 0 ;; +    VAX*:ULTRIX*:*:*) +	echo vax-dec-ultrix${UNAME_RELEASE} +	exit 0 ;; +    2020:CLIX:*:* | 2430:CLIX:*:*) +	echo clipper-intergraph-clix${UNAME_RELEASE} +	exit 0 ;; +    mips:*:*:UMIPS | mips:*:*:RISCos) +	eval $set_cc_for_build +	sed 's/^	//' << EOF >$dummy.c +#ifdef __cplusplus +#include <stdio.h>  /* for printf() prototype */ +	int main (int argc, char *argv[]) { +#else +	int main (argc, argv) int argc; char *argv[]; { +#endif +	#if defined (host_mips) && defined (MIPSEB) +	#if defined (SYSTYPE_SYSV) +	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); +	#endif +	#if defined (SYSTYPE_SVR4) +	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); +	#endif +	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) +	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); +	#endif +	#endif +	  exit (-1); +	} +EOF +	$CC_FOR_BUILD -o $dummy $dummy.c \ +	  && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ +	  && exit 0 +	echo mips-mips-riscos${UNAME_RELEASE} +	exit 0 ;; +    Motorola:PowerMAX_OS:*:*) +	echo powerpc-motorola-powermax +	exit 0 ;; +    Motorola:*:4.3:PL8-*) +	echo powerpc-harris-powermax +	exit 0 ;; +    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) +	echo powerpc-harris-powermax +	exit 0 ;; +    Night_Hawk:Power_UNIX:*:*) +	echo powerpc-harris-powerunix +	exit 0 ;; +    m88k:CX/UX:7*:*) +	echo m88k-harris-cxux7 +	exit 0 ;; +    m88k:*:4*:R4*) +	echo m88k-motorola-sysv4 +	exit 0 ;; +    m88k:*:3*:R3*) +	echo m88k-motorola-sysv3 +	exit 0 ;; +    AViiON:dgux:*:*) +        # DG/UX returns AViiON for all architectures +        UNAME_PROCESSOR=`/usr/bin/uname -p` +	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] +	then +	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ +	       [ ${TARGET_BINARY_INTERFACE}x = x ] +	    then +		echo m88k-dg-dgux${UNAME_RELEASE} +	    else +		echo m88k-dg-dguxbcs${UNAME_RELEASE} +	    fi +	else +	    echo i586-dg-dgux${UNAME_RELEASE} +	fi + 	exit 0 ;; +    M88*:DolphinOS:*:*)	# DolphinOS (SVR3) +	echo m88k-dolphin-sysv3 +	exit 0 ;; +    M88*:*:R3*:*) +	# Delta 88k system running SVR3 +	echo m88k-motorola-sysv3 +	exit 0 ;; +    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) +	echo m88k-tektronix-sysv3 +	exit 0 ;; +    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) +	echo m68k-tektronix-bsd +	exit 0 ;; +    *:IRIX*:*:*) +	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` +	exit 0 ;; +    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. +	echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id +	exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX ' +    i*86:AIX:*:*) +	echo i386-ibm-aix +	exit 0 ;; +    ia64:AIX:*:*) +	if [ -x /usr/bin/oslevel ] ; then +		IBM_REV=`/usr/bin/oslevel` +	else +		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} +	fi +	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} +	exit 0 ;; +    *:AIX:2:3) +	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then +		eval $set_cc_for_build +		sed 's/^		//' << EOF >$dummy.c +		#include <sys/systemcfg.h> + +		main() +			{ +			if (!__power_pc()) +				exit(1); +			puts("powerpc-ibm-aix3.2.5"); +			exit(0); +			} +EOF +		$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 +		echo rs6000-ibm-aix3.2.5 +	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then +		echo rs6000-ibm-aix3.2.4 +	else +		echo rs6000-ibm-aix3.2 +	fi +	exit 0 ;; +    *:AIX:*:[45]) +	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` +	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then +		IBM_ARCH=rs6000 +	else +		IBM_ARCH=powerpc +	fi +	if [ -x /usr/bin/oslevel ] ; then +		IBM_REV=`/usr/bin/oslevel` +	else +		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} +	fi +	echo ${IBM_ARCH}-ibm-aix${IBM_REV} +	exit 0 ;; +    *:AIX:*:*) +	echo rs6000-ibm-aix +	exit 0 ;; +    ibmrt:4.4BSD:*|romp-ibm:BSD:*) +	echo romp-ibm-bsd4.4 +	exit 0 ;; +    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and +	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to +	exit 0 ;;                           # report: romp-ibm BSD 4.3 +    *:BOSX:*:*) +	echo rs6000-bull-bosx +	exit 0 ;; +    DPX/2?00:B.O.S.:*:*) +	echo m68k-bull-sysv3 +	exit 0 ;; +    9000/[34]??:4.3bsd:1.*:*) +	echo m68k-hp-bsd +	exit 0 ;; +    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) +	echo m68k-hp-bsd4.4 +	exit 0 ;; +    9000/[34678]??:HP-UX:*:*) +	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` +	case "${UNAME_MACHINE}" in +	    9000/31? )            HP_ARCH=m68000 ;; +	    9000/[34]?? )         HP_ARCH=m68k ;; +	    9000/[678][0-9][0-9]) +		if [ -x /usr/bin/getconf ]; then +		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` +                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` +                    case "${sc_cpu_version}" in +                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 +                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 +                      532)                      # CPU_PA_RISC2_0 +                        case "${sc_kernel_bits}" in +                          32) HP_ARCH="hppa2.0n" ;; +                          64) HP_ARCH="hppa2.0w" ;; +			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20 +                        esac ;; +                    esac +		fi +		if [ "${HP_ARCH}" = "" ]; then +		    eval $set_cc_for_build +		    sed 's/^              //' << EOF >$dummy.c + +              #define _HPUX_SOURCE +              #include <stdlib.h> +              #include <unistd.h> + +              int main () +              { +              #if defined(_SC_KERNEL_BITS) +                  long bits = sysconf(_SC_KERNEL_BITS); +              #endif +                  long cpu  = sysconf (_SC_CPU_VERSION); + +                  switch (cpu) +              	{ +              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break; +              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break; +              	case CPU_PA_RISC2_0: +              #if defined(_SC_KERNEL_BITS) +              	    switch (bits) +              		{ +              		case 64: puts ("hppa2.0w"); break; +              		case 32: puts ("hppa2.0n"); break; +              		default: puts ("hppa2.0"); break; +              		} break; +              #else  /* !defined(_SC_KERNEL_BITS) */ +              	    puts ("hppa2.0"); break; +              #endif +              	default: puts ("hppa1.0"); break; +              	} +                  exit (0); +              } +EOF +		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` +		    test -z "$HP_ARCH" && HP_ARCH=hppa +		fi ;; +	esac +	if [ ${HP_ARCH} = "hppa2.0w" ] +	then +	    # avoid double evaluation of $set_cc_for_build +	    test -n "$CC_FOR_BUILD" || eval $set_cc_for_build +	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null +	    then +		HP_ARCH="hppa2.0w" +	    else +		HP_ARCH="hppa64" +	    fi +	fi +	echo ${HP_ARCH}-hp-hpux${HPUX_REV} +	exit 0 ;; +    ia64:HP-UX:*:*) +	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` +	echo ia64-hp-hpux${HPUX_REV} +	exit 0 ;; +    3050*:HI-UX:*:*) +	eval $set_cc_for_build +	sed 's/^	//' << EOF >$dummy.c +	#include <unistd.h> +	int +	main () +	{ +	  long cpu = sysconf (_SC_CPU_VERSION); +	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns +	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct +	     results, however.  */ +	  if (CPU_IS_PA_RISC (cpu)) +	    { +	      switch (cpu) +		{ +		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; +		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; +		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; +		  default: puts ("hppa-hitachi-hiuxwe2"); break; +		} +	    } +	  else if (CPU_IS_HP_MC68K (cpu)) +	    puts ("m68k-hitachi-hiuxwe2"); +	  else puts ("unknown-hitachi-hiuxwe2"); +	  exit (0); +	} +EOF +	$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 +	echo unknown-hitachi-hiuxwe2 +	exit 0 ;; +    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) +	echo hppa1.1-hp-bsd +	exit 0 ;; +    9000/8??:4.3bsd:*:*) +	echo hppa1.0-hp-bsd +	exit 0 ;; +    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) +	echo hppa1.0-hp-mpeix +	exit 0 ;; +    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) +	echo hppa1.1-hp-osf +	exit 0 ;; +    hp8??:OSF1:*:*) +	echo hppa1.0-hp-osf +	exit 0 ;; +    i*86:OSF1:*:*) +	if [ -x /usr/sbin/sysversion ] ; then +	    echo ${UNAME_MACHINE}-unknown-osf1mk +	else +	    echo ${UNAME_MACHINE}-unknown-osf1 +	fi +	exit 0 ;; +    parisc*:Lites*:*:*) +	echo hppa1.1-hp-lites +	exit 0 ;; +    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) +	echo c1-convex-bsd +        exit 0 ;; +    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) +	if getsysinfo -f scalar_acc +	then echo c32-convex-bsd +	else echo c2-convex-bsd +	fi +        exit 0 ;; +    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) +	echo c34-convex-bsd +        exit 0 ;; +    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) +	echo c38-convex-bsd +        exit 0 ;; +    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) +	echo c4-convex-bsd +        exit 0 ;; +    CRAY*Y-MP:*:*:*) +	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' +	exit 0 ;; +    CRAY*[A-Z]90:*:*:*) +	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ +	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ +	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ +	      -e 's/\.[^.]*$/.X/' +	exit 0 ;; +    CRAY*TS:*:*:*) +	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' +	exit 0 ;; +    CRAY*T3E:*:*:*) +	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' +	exit 0 ;; +    CRAY*SV1:*:*:*) +	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' +	exit 0 ;; +    *:UNICOS/mp:*:*) +	echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' +	exit 0 ;; +    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) +	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` +        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` +        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` +        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" +        exit 0 ;; +    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) +	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} +	exit 0 ;; +    sparc*:BSD/OS:*:*) +	echo sparc-unknown-bsdi${UNAME_RELEASE} +	exit 0 ;; +    *:BSD/OS:*:*) +	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} +	exit 0 ;; +    *:FreeBSD:*:*) +	# Determine whether the default compiler uses glibc. +	eval $set_cc_for_build +	sed 's/^	//' << EOF >$dummy.c +	#include <features.h> +	#if __GLIBC__ >= 2 +	LIBC=gnu +	#else +	LIBC= +	#endif +EOF +	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` +	# GNU/KFreeBSD systems have a "k" prefix to indicate we are using +	# FreeBSD's kernel, but not the complete OS. +	case ${LIBC} in gnu) kernel_only='k' ;; esac +	echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} +	exit 0 ;; +    i*:CYGWIN*:*) +	echo ${UNAME_MACHINE}-pc-cygwin +	exit 0 ;; +    i*:MINGW*:*) +	echo ${UNAME_MACHINE}-pc-mingw32 +	exit 0 ;; +    i*:PW*:*) +	echo ${UNAME_MACHINE}-pc-pw32 +	exit 0 ;; +    x86:Interix*:[34]*) +	echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' +	exit 0 ;; +    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) +	echo i${UNAME_MACHINE}-pc-mks +	exit 0 ;; +    i*:Windows_NT*:* | Pentium*:Windows_NT*:*) +	# How do we know it's Interix rather than the generic POSIX subsystem? +	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we +	# UNAME_MACHINE based on the output of uname instead of i386? +	echo i586-pc-interix +	exit 0 ;; +    i*:UWIN*:*) +	echo ${UNAME_MACHINE}-pc-uwin +	exit 0 ;; +    p*:CYGWIN*:*) +	echo powerpcle-unknown-cygwin +	exit 0 ;; +    prep*:SunOS:5.*:*) +	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` +	exit 0 ;; +    *:GNU:*:*) +	# the GNU system +	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` +	exit 0 ;; +    *:GNU/*:*:*) +	# other systems with GNU libc and userland +	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu +	exit 0 ;; +    i*86:Minix:*:*) +	echo ${UNAME_MACHINE}-pc-minix +	exit 0 ;; +    arm*:Linux:*:*) +	echo ${UNAME_MACHINE}-unknown-linux-gnu +	exit 0 ;; +    cris:Linux:*:*) +	echo cris-axis-linux-gnu +	exit 0 ;; +    ia64:Linux:*:*) +	echo ${UNAME_MACHINE}-unknown-linux-gnu +	exit 0 ;; +    m68*:Linux:*:*) +	echo ${UNAME_MACHINE}-unknown-linux-gnu +	exit 0 ;; +    mips:Linux:*:*) +	eval $set_cc_for_build +	sed 's/^	//' << EOF >$dummy.c +	#undef CPU +	#undef mips +	#undef mipsel +	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) +	CPU=mipsel +	#else +	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) +	CPU=mips +	#else +	CPU= +	#endif +	#endif +EOF +	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` +	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 +	;; +    mips64:Linux:*:*) +	eval $set_cc_for_build +	sed 's/^	//' << EOF >$dummy.c +	#undef CPU +	#undef mips64 +	#undef mips64el +	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) +	CPU=mips64el +	#else +	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) +	CPU=mips64 +	#else +	CPU= +	#endif +	#endif +EOF +	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` +	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 +	;; +    ppc:Linux:*:*) +	echo powerpc-unknown-linux-gnu +	exit 0 ;; +    ppc64:Linux:*:*) +	echo powerpc64-unknown-linux-gnu +	exit 0 ;; +    alpha:Linux:*:*) +	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in +	  EV5)   UNAME_MACHINE=alphaev5 ;; +	  EV56)  UNAME_MACHINE=alphaev56 ;; +	  PCA56) UNAME_MACHINE=alphapca56 ;; +	  PCA57) UNAME_MACHINE=alphapca56 ;; +	  EV6)   UNAME_MACHINE=alphaev6 ;; +	  EV67)  UNAME_MACHINE=alphaev67 ;; +	  EV68*) UNAME_MACHINE=alphaev68 ;; +        esac +	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null +	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi +	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} +	exit 0 ;; +    parisc:Linux:*:* | hppa:Linux:*:*) +	# Look for CPU level +	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in +	  PA7*) echo hppa1.1-unknown-linux-gnu ;; +	  PA8*) echo hppa2.0-unknown-linux-gnu ;; +	  *)    echo hppa-unknown-linux-gnu ;; +	esac +	exit 0 ;; +    parisc64:Linux:*:* | hppa64:Linux:*:*) +	echo hppa64-unknown-linux-gnu +	exit 0 ;; +    s390:Linux:*:* | s390x:Linux:*:*) +	echo ${UNAME_MACHINE}-ibm-linux +	exit 0 ;; +    sh64*:Linux:*:*) +    	echo ${UNAME_MACHINE}-unknown-linux-gnu +	exit 0 ;; +    sh*:Linux:*:*) +	echo ${UNAME_MACHINE}-unknown-linux-gnu +	exit 0 ;; +    sparc:Linux:*:* | sparc64:Linux:*:*) +	echo ${UNAME_MACHINE}-unknown-linux-gnu +	exit 0 ;; +    x86_64:Linux:*:*) +	echo x86_64-unknown-linux-gnu +	exit 0 ;; +    i*86:Linux:*:*) +	# The BFD linker knows what the default object file format is, so +	# first see if it will tell us. cd to the root directory to prevent +	# problems with other programs or directories called `ld' in the path. +	# Set LC_ALL=C to ensure ld outputs messages in English. +	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ +			 | sed -ne '/supported targets:/!d +				    s/[ 	][ 	]*/ /g +				    s/.*supported targets: *// +				    s/ .*// +				    p'` +        case "$ld_supported_targets" in +	  elf32-i386) +		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" +		;; +	  a.out-i386-linux) +		echo "${UNAME_MACHINE}-pc-linux-gnuaout" +		exit 0 ;; +	  coff-i386) +		echo "${UNAME_MACHINE}-pc-linux-gnucoff" +		exit 0 ;; +	  "") +		# Either a pre-BFD a.out linker (linux-gnuoldld) or +		# one that does not give us useful --help. +		echo "${UNAME_MACHINE}-pc-linux-gnuoldld" +		exit 0 ;; +	esac +	# Determine whether the default compiler is a.out or elf +	eval $set_cc_for_build +	sed 's/^	//' << EOF >$dummy.c +	#include <features.h> +	#ifdef __ELF__ +	# ifdef __GLIBC__ +	#  if __GLIBC__ >= 2 +	LIBC=gnu +	#  else +	LIBC=gnulibc1 +	#  endif +	# else +	LIBC=gnulibc1 +	# endif +	#else +	#ifdef __INTEL_COMPILER +	LIBC=gnu +	#else +	LIBC=gnuaout +	#endif +	#endif +	#ifdef __dietlibc__ +	LIBC=dietlibc +	#endif +EOF +	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` +	test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 +	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 +	;; +    i*86:DYNIX/ptx:4*:*) +	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. +	# earlier versions are messed up and put the nodename in both +	# sysname and nodename. +	echo i386-sequent-sysv4 +	exit 0 ;; +    i*86:UNIX_SV:4.2MP:2.*) +        # Unixware is an offshoot of SVR4, but it has its own version +        # number series starting with 2... +        # I am not positive that other SVR4 systems won't match this, +	# I just have to hope.  -- rms. +        # Use sysv4.2uw... so that sysv4* matches it. +	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} +	exit 0 ;; +    i*86:OS/2:*:*) +	# If we were able to find `uname', then EMX Unix compatibility +	# is probably installed. +	echo ${UNAME_MACHINE}-pc-os2-emx +	exit 0 ;; +    i*86:XTS-300:*:STOP) +	echo ${UNAME_MACHINE}-unknown-stop +	exit 0 ;; +    i*86:atheos:*:*) +	echo ${UNAME_MACHINE}-unknown-atheos +	exit 0 ;; +    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) +	echo i386-unknown-lynxos${UNAME_RELEASE} +	exit 0 ;; +    i*86:*DOS:*:*) +	echo ${UNAME_MACHINE}-pc-msdosdjgpp +	exit 0 ;; +    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) +	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` +	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then +		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} +	else +		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} +	fi +	exit 0 ;; +    i*86:*:5:[78]*) +	case `/bin/uname -X | grep "^Machine"` in +	    *486*)	     UNAME_MACHINE=i486 ;; +	    *Pentium)	     UNAME_MACHINE=i586 ;; +	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;; +	esac +	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} +	exit 0 ;; +    i*86:*:3.2:*) +	if test -f /usr/options/cb.name; then +		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` +		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL +	elif /bin/uname -X 2>/dev/null >/dev/null ; then +		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` +		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 +		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ +			&& UNAME_MACHINE=i586 +		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ +			&& UNAME_MACHINE=i686 +		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ +			&& UNAME_MACHINE=i686 +		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL +	else +		echo ${UNAME_MACHINE}-pc-sysv32 +	fi +	exit 0 ;; +    pc:*:*:*) +	# Left here for compatibility: +        # uname -m prints for DJGPP always 'pc', but it prints nothing about +        # the processor, so we play safe by assuming i386. +	echo i386-pc-msdosdjgpp +        exit 0 ;; +    Intel:Mach:3*:*) +	echo i386-pc-mach3 +	exit 0 ;; +    paragon:*:*:*) +	echo i860-intel-osf1 +	exit 0 ;; +    i860:*:4.*:*) # i860-SVR4 +	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then +	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 +	else # Add other i860-SVR4 vendors below as they are discovered. +	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4 +	fi +	exit 0 ;; +    mini*:CTIX:SYS*5:*) +	# "miniframe" +	echo m68010-convergent-sysv +	exit 0 ;; +    mc68k:UNIX:SYSTEM5:3.51m) +	echo m68k-convergent-sysv +	exit 0 ;; +    M680?0:D-NIX:5.3:*) +	echo m68k-diab-dnix +	exit 0 ;; +    M68*:*:R3V[567]*:*) +	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; +    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) +	OS_REL='' +	test -r /etc/.relid \ +	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` +	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \ +	  && echo i486-ncr-sysv4.3${OS_REL} && exit 0 +	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ +	  && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; +    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) +        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ +          && echo i486-ncr-sysv4 && exit 0 ;; +    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) +	echo m68k-unknown-lynxos${UNAME_RELEASE} +	exit 0 ;; +    mc68030:UNIX_System_V:4.*:*) +	echo m68k-atari-sysv4 +	exit 0 ;; +    TSUNAMI:LynxOS:2.*:*) +	echo sparc-unknown-lynxos${UNAME_RELEASE} +	exit 0 ;; +    rs6000:LynxOS:2.*:*) +	echo rs6000-unknown-lynxos${UNAME_RELEASE} +	exit 0 ;; +    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) +	echo powerpc-unknown-lynxos${UNAME_RELEASE} +	exit 0 ;; +    SM[BE]S:UNIX_SV:*:*) +	echo mips-dde-sysv${UNAME_RELEASE} +	exit 0 ;; +    RM*:ReliantUNIX-*:*:*) +	echo mips-sni-sysv4 +	exit 0 ;; +    RM*:SINIX-*:*:*) +	echo mips-sni-sysv4 +	exit 0 ;; +    *:SINIX-*:*:*) +	if uname -p 2>/dev/null >/dev/null ; then +		UNAME_MACHINE=`(uname -p) 2>/dev/null` +		echo ${UNAME_MACHINE}-sni-sysv4 +	else +		echo ns32k-sni-sysv +	fi +	exit 0 ;; +    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort +                      # says <Richard.M.Bartel@ccMail.Census.GOV> +        echo i586-unisys-sysv4 +        exit 0 ;; +    *:UNIX_System_V:4*:FTX*) +	# From Gerald Hewes <hewes@openmarket.com>. +	# How about differentiating between stratus architectures? -djm +	echo hppa1.1-stratus-sysv4 +	exit 0 ;; +    *:*:*:FTX*) +	# From seanf@swdc.stratus.com. +	echo i860-stratus-sysv4 +	exit 0 ;; +    *:VOS:*:*) +	# From Paul.Green@stratus.com. +	echo hppa1.1-stratus-vos +	exit 0 ;; +    mc68*:A/UX:*:*) +	echo m68k-apple-aux${UNAME_RELEASE} +	exit 0 ;; +    news*:NEWS-OS:6*:*) +	echo mips-sony-newsos6 +	exit 0 ;; +    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) +	if [ -d /usr/nec ]; then +	        echo mips-nec-sysv${UNAME_RELEASE} +	else +	        echo mips-unknown-sysv${UNAME_RELEASE} +	fi +        exit 0 ;; +    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only. +	echo powerpc-be-beos +	exit 0 ;; +    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only. +	echo powerpc-apple-beos +	exit 0 ;; +    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible. +	echo i586-pc-beos +	exit 0 ;; +    SX-4:SUPER-UX:*:*) +	echo sx4-nec-superux${UNAME_RELEASE} +	exit 0 ;; +    SX-5:SUPER-UX:*:*) +	echo sx5-nec-superux${UNAME_RELEASE} +	exit 0 ;; +    SX-6:SUPER-UX:*:*) +	echo sx6-nec-superux${UNAME_RELEASE} +	exit 0 ;; +    Power*:Rhapsody:*:*) +	echo powerpc-apple-rhapsody${UNAME_RELEASE} +	exit 0 ;; +    *:Rhapsody:*:*) +	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} +	exit 0 ;; +    *:Darwin:*:*) +	case `uname -p` in +	    *86) UNAME_PROCESSOR=i686 ;; +	    powerpc) UNAME_PROCESSOR=powerpc ;; +	esac +	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} +	exit 0 ;; +    *:procnto*:*:* | *:QNX:[0123456789]*:*) +	UNAME_PROCESSOR=`uname -p` +	if test "$UNAME_PROCESSOR" = "x86"; then +		UNAME_PROCESSOR=i386 +		UNAME_MACHINE=pc +	fi +	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} +	exit 0 ;; +    *:QNX:*:4*) +	echo i386-pc-qnx +	exit 0 ;; +    NSR-[DGKLNPTVWY]:NONSTOP_KERNEL:*:*) +	echo nsr-tandem-nsk${UNAME_RELEASE} +	exit 0 ;; +    *:NonStop-UX:*:*) +	echo mips-compaq-nonstopux +	exit 0 ;; +    BS2000:POSIX*:*:*) +	echo bs2000-siemens-sysv +	exit 0 ;; +    DS/*:UNIX_System_V:*:*) +	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} +	exit 0 ;; +    *:Plan9:*:*) +	# "uname -m" is not consistent, so use $cputype instead. 386 +	# is converted to i386 for consistency with other x86 +	# operating systems. +	if test "$cputype" = "386"; then +	    UNAME_MACHINE=i386 +	else +	    UNAME_MACHINE="$cputype" +	fi +	echo ${UNAME_MACHINE}-unknown-plan9 +	exit 0 ;; +    *:TOPS-10:*:*) +	echo pdp10-unknown-tops10 +	exit 0 ;; +    *:TENEX:*:*) +	echo pdp10-unknown-tenex +	exit 0 ;; +    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) +	echo pdp10-dec-tops20 +	exit 0 ;; +    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) +	echo pdp10-xkl-tops20 +	exit 0 ;; +    *:TOPS-20:*:*) +	echo pdp10-unknown-tops20 +	exit 0 ;; +    *:ITS:*:*) +	echo pdp10-unknown-its +	exit 0 ;; +    SEI:*:*:SEIUX) +        echo mips-sei-seiux${UNAME_RELEASE} +	exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c <<EOF +#ifdef _SEQUENT_ +# include <sys/types.h> +# include <sys/utsname.h> +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) +  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed, +     I don't know....  */ +  printf ("mips-sony-bsd\n"); exit (0); +#else +#include <sys/param.h> +  printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 +          "4" +#else +	  "" +#endif +         ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) +  printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) +  printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif +  int version; +  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; +  if (version < 4) +    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); +  else +    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); +  exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) +  printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) +  printf ("ns32k-encore-mach\n"); exit (0); +#else +  printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) +  printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) +  printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) +  printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) +    struct utsname un; + +    uname(&un); + +    if (strncmp(un.version, "V2", 2) == 0) { +	printf ("i386-sequent-ptx2\n"); exit (0); +    } +    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ +	printf ("i386-sequent-ptx1\n"); exit (0); +    } +    printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +#  include <sys/param.h> +#  if defined (BSD) +#   if BSD == 43 +      printf ("vax-dec-bsd4.3\n"); exit (0); +#   else +#    if BSD == 199006 +      printf ("vax-dec-bsd4.3reno\n"); exit (0); +#    else +      printf ("vax-dec-bsd\n"); exit (0); +#    endif +#   endif +#  else +    printf ("vax-dec-bsd\n"); exit (0); +#  endif +# else +    printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) +  printf ("i860-alliant-bsd\n"); exit (0); +#endif + +  exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then +    case `getsysinfo -f cpu_type` in +    c1*) +	echo c1-convex-bsd +	exit 0 ;; +    c2*) +	if getsysinfo -f scalar_acc +	then echo c32-convex-bsd +	else echo c2-convex-bsd +	fi +	exit 0 ;; +    c34*) +	echo c34-convex-bsd +	exit 0 ;; +    c38*) +	echo c38-convex-bsd +	exit 0 ;; +    c4*) +	echo c4-convex-bsd +	exit 0 ;; +    esac +fi + +cat >&2 <<EOF +$0: unable to guess system type + +This script, last modified $timestamp, has failed to recognize +the operating system you are using. It is advised that you +download the most up to date version of the config scripts from + +    ftp://ftp.gnu.org/pub/gnu/config/ + +If the version you run ($0) is already up to date, please +send the following data and any information you think might be +pertinent to <config-patches@gnu.org> in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X     = `(/bin/uname -X) 2>/dev/null` + +hostinfo               = `(hostinfo) 2>/dev/null` +/bin/universe          = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch              = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM  = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/toolchain/elf2flt/elf2flt/config.sub b/toolchain/elf2flt/elf2flt/config.sub new file mode 100755 index 000000000..4279c8491 --- /dev/null +++ b/toolchain/elf2flt/elf2flt/config.sub @@ -0,0 +1,1577 @@ +#! /bin/sh +# Configuration validation subroutine script. +#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + +timestamp='2005-04-22' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine.  It does not imply ALL GNU software can. +# +# This file 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. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Please send patches to <config-patches@gnu.org>.  Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support.  The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS +       $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: +  -h, --help         print this help, then exit +  -t, --time-stamp   print date of last modification, then exit +  -v, --version      print version number, then exit + +Report bugs and patches to <config-patches@gnu.org>." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions.  There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do +  case $1 in +    --time-stamp | --time* | -t ) +       echo "$timestamp" ; exit 0 ;; +    --version | -v ) +       echo "$version" ; exit 0 ;; +    --help | --h* | -h ) +       echo "$usage"; exit 0 ;; +    -- )     # Stop option processing +       shift; break ;; +    - )	# Use stdin as input. +       break ;; +    -* ) +       echo "$me: invalid option $1$help" +       exit 1 ;; + +    *local*) +       # First pass through any local machine types. +       echo $1 +       exit 0;; + +    * ) +       break ;; +  esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 +    exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 +    exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in +  nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ +  kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) +    os=-$maybe_os +    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` +    ;; +  *) +    basic_machine=`echo $1 | sed 's/-[^-]*$//'` +    if [ $basic_machine != $1 ] +    then os=`echo $1 | sed 's/.*-/-/'` +    else os=; fi +    ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work.  We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in +	-sun*os*) +		# Prevent following clause from handling this invalid input. +		;; +	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ +	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ +	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ +	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ +	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ +	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ +	-apple | -axis | -knuth | -cray) +		os= +		basic_machine=$1 +		;; +	-sim | -cisco | -oki | -wec | -winbond) +		os= +		basic_machine=$1 +		;; +	-scout) +		;; +	-wrs) +		os=-vxworks +		basic_machine=$1 +		;; +	-chorusos*) +		os=-chorusos +		basic_machine=$1 +		;; + 	-chorusrdb) + 		os=-chorusrdb +		basic_machine=$1 + 		;; +	-hiux*) +		os=-hiuxwe2 +		;; +	-sco5) +		os=-sco3.2v5 +		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` +		;; +	-sco4) +		os=-sco3.2v4 +		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` +		;; +	-sco3.2.[4-9]*) +		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` +		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` +		;; +	-sco3.2v[4-9]*) +		# Don't forget version if it is 3.2v4 or newer. +		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` +		;; +	-sco*) +		os=-sco3.2v2 +		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` +		;; +	-udk*) +		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` +		;; +	-isc) +		os=-isc2.2 +		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` +		;; +	-clix*) +		basic_machine=clipper-intergraph +		;; +	-isc*) +		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` +		;; +	-lynx*) +		os=-lynxos +		;; +	-ptx*) +		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` +		;; +	-windowsnt*) +		os=`echo $os | sed -e 's/windowsnt/winnt/'` +		;; +	-psos*) +		os=-psos +		;; +	-mint | -mint[0-9]*) +		basic_machine=m68k-atari +		os=-mint +		;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in +	# Recognize the basic CPU types without company name. +	# Some are omitted here because they have special meanings below. +	1750a | 580 \ +	| a29k \ +	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ +	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ +	| am33_2.0 \ +	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ +	| bfin \ +	| c4x | clipper \ +	| d10v | d30v | dlx | dsp16xx \ +	| fr30 | frv \ +	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ +	| i370 | i860 | i960 | ia64 \ +	| ip2k | iq2000 \ +	| m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \ +	| mips | mipsbe | mipseb | mipsel | mipsle \ +	| mips16 \ +	| mips64 | mips64el \ +	| mips64vr | mips64vrel \ +	| mips64orion | mips64orionel \ +	| mips64vr4100 | mips64vr4100el \ +	| mips64vr4300 | mips64vr4300el \ +	| mips64vr5000 | mips64vr5000el \ +	| mipsisa32 | mipsisa32el \ +	| mipsisa32r2 | mipsisa32r2el \ +	| mipsisa64 | mipsisa64el \ +	| mipsisa64r2 | mipsisa64r2el \ +	| mipsisa64sb1 | mipsisa64sb1el \ +	| mipsisa64sr71k | mipsisa64sr71kel \ +	| mipstx39 | mipstx39el \ +	| mn10200 | mn10300 \ +	| msp430 \ +	| nios | nios2 \ +	| ns16k | ns32k \ +	| openrisc | or32 \ +	| pdp10 | pdp11 | pj | pjl \ +	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ +	| pyramid \ +	| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ +	| sh64 | sh64le \ +	| sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \ +	| sparcv8 | sparcv9 | sparcv9b \ +	| strongarm \ +	| tahoe | thumb | tic4x | tic80 | tron \ +	| v850 | v850e \ +	| microblaze \ +	| we32k \ +	| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ +	| z8k) +		basic_machine=$basic_machine-unknown +		;; +	m32c) +		basic_machine=$basic_machine-unknown +		;; +	m6811 | m68hc11 | m6812 | m68hc12) +		# Motorola 68HC11/12. +		basic_machine=$basic_machine-unknown +		os=-none +		;; +	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) +		;; + +	# We use `pc' rather than `unknown' +	# because (1) that's what they normally are, and +	# (2) the word "unknown" tends to confuse beginning users. +	i*86 | x86_64) +	  basic_machine=$basic_machine-pc +	  ;; +	# Object if more than one company name word. +	*-*-*) +		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 +		exit 1 +		;; +	# Recognize the basic CPU types with company name. +	580-* \ +	| a29k-* \ +	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ +	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ +	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ +	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \ +	| avr-* \ +	| bfin-* | bs2000-* \ +	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ +	| clipper-* | craynv-* | cydra-* \ +	| d10v-* | d30v-* | dlx-* \ +	| elxsi-* \ +	| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ +	| h8300-* | h8500-* \ +	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ +	| i*86-* | i860-* | i960-* | ia64-* \ +	| ip2k-* | iq2000-* \ +	| m32r-* | m32rle-* \ +	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ +	| m88110-* | m88k-* | maxq-* | mcore-* \ +	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ +	| mips16-* \ +	| mips64-* | mips64el-* \ +	| mips64vr-* | mips64vrel-* \ +	| mips64orion-* | mips64orionel-* \ +	| mips64vr4100-* | mips64vr4100el-* \ +	| mips64vr4300-* | mips64vr4300el-* \ +	| mips64vr5000-* | mips64vr5000el-* \ +	| mipsisa32-* | mipsisa32el-* \ +	| mipsisa32r2-* | mipsisa32r2el-* \ +	| mipsisa64-* | mipsisa64el-* \ +	| mipsisa64r2-* | mipsisa64r2el-* \ +	| mipsisa64sb1-* | mipsisa64sb1el-* \ +	| mipsisa64sr71k-* | mipsisa64sr71kel-* \ +	| mipstx39-* | mipstx39el-* \ +	| mmix-* \ +	| msp430-* \ +	| nios-* | nios2-* \ +	| none-* | np1-* | ns16k-* | ns32k-* \ +	| orion-* \ +	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ +	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ +	| pyramid-* \ +	| romp-* | rs6000-* \ +	| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ +	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ +	| sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \ +	| sparclite-* \ +	| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ +	| tahoe-* | thumb-* \ +	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ +	| tron-* \ +	| v850-* | v850e-* | vax-* \ +	| we32k-* \ +	| x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ +	| xstormy16-* | xtensa-* \ +	| ymp-* \ +	| z8k-*) +		;; +	m32c-*) +		;; +	# Recognize the various machine names and aliases which stand +	# for a CPU type and a company and sometimes even an OS. +	386bsd) +		basic_machine=i386-unknown +		os=-bsd +		;; +	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) +		basic_machine=m68000-att +		;; +	3b*) +		basic_machine=we32k-att +		;; +	a29khif) +		basic_machine=a29k-amd +		os=-udi +		;; +    	abacus) +		basic_machine=abacus-unknown +		;; +	adobe68k) +		basic_machine=m68010-adobe +		os=-scout +		;; +	alliant | fx80) +		basic_machine=fx80-alliant +		;; +	altos | altos3068) +		basic_machine=m68k-altos +		;; +	am29k) +		basic_machine=a29k-none +		os=-bsd +		;; +	amd64) +		basic_machine=x86_64-pc +		;; +	amd64-*) +		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` +		;; +	amdahl) +		basic_machine=580-amdahl +		os=-sysv +		;; +	amiga | amiga-*) +		basic_machine=m68k-unknown +		;; +	amigaos | amigados) +		basic_machine=m68k-unknown +		os=-amigaos +		;; +	amigaunix | amix) +		basic_machine=m68k-unknown +		os=-sysv4 +		;; +	apollo68) +		basic_machine=m68k-apollo +		os=-sysv +		;; +	apollo68bsd) +		basic_machine=m68k-apollo +		os=-bsd +		;; +	aux) +		basic_machine=m68k-apple +		os=-aux +		;; +	balance) +		basic_machine=ns32k-sequent +		os=-dynix +		;; +	c90) +		basic_machine=c90-cray +		os=-unicos +		;; +	convex-c1) +		basic_machine=c1-convex +		os=-bsd +		;; +	convex-c2) +		basic_machine=c2-convex +		os=-bsd +		;; +	convex-c32) +		basic_machine=c32-convex +		os=-bsd +		;; +	convex-c34) +		basic_machine=c34-convex +		os=-bsd +		;; +	convex-c38) +		basic_machine=c38-convex +		os=-bsd +		;; +	cray | j90) +		basic_machine=j90-cray +		os=-unicos +		;; +	craynv) +		basic_machine=craynv-cray +		os=-unicosmp +		;; +	cr16c) +		basic_machine=cr16c-unknown +		os=-elf +		;; +	crds | unos) +		basic_machine=m68k-crds +		;; +	crisv32 | crisv32-* | etraxfs*) +		basic_machine=crisv32-axis +		;; +	cris | cris-* | etrax*) +		basic_machine=cris-axis +		;; +	crx) +		basic_machine=crx-unknown +		os=-elf +		;; +	da30 | da30-*) +		basic_machine=m68k-da30 +		;; +	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) +		basic_machine=mips-dec +		;; +	decsystem10* | dec10*) +		basic_machine=pdp10-dec +		os=-tops10 +		;; +	decsystem20* | dec20*) +		basic_machine=pdp10-dec +		os=-tops20 +		;; +	delta | 3300 | motorola-3300 | motorola-delta \ +	      | 3300-motorola | delta-motorola) +		basic_machine=m68k-motorola +		;; +	delta88) +		basic_machine=m88k-motorola +		os=-sysv3 +		;; +	djgpp) +		basic_machine=i586-pc +		os=-msdosdjgpp +		;; +	dpx20 | dpx20-*) +		basic_machine=rs6000-bull +		os=-bosx +		;; +	dpx2* | dpx2*-bull) +		basic_machine=m68k-bull +		os=-sysv3 +		;; +	ebmon29k) +		basic_machine=a29k-amd +		os=-ebmon +		;; +	elxsi) +		basic_machine=elxsi-elxsi +		os=-bsd +		;; +	encore | umax | mmax) +		basic_machine=ns32k-encore +		;; +	es1800 | OSE68k | ose68k | ose | OSE) +		basic_machine=m68k-ericsson +		os=-ose +		;; +	fx2800) +		basic_machine=i860-alliant +		;; +	genix) +		basic_machine=ns32k-ns +		;; +	gmicro) +		basic_machine=tron-gmicro +		os=-sysv +		;; +	go32) +		basic_machine=i386-pc +		os=-go32 +		;; +	h3050r* | hiux*) +		basic_machine=hppa1.1-hitachi +		os=-hiuxwe2 +		;; +	h8300hms) +		basic_machine=h8300-hitachi +		os=-hms +		;; +	h8300xray) +		basic_machine=h8300-hitachi +		os=-xray +		;; +	h8500hms) +		basic_machine=h8500-hitachi +		os=-hms +		;; +	harris) +		basic_machine=m88k-harris +		os=-sysv3 +		;; +	hp300-*) +		basic_machine=m68k-hp +		;; +	hp300bsd) +		basic_machine=m68k-hp +		os=-bsd +		;; +	hp300hpux) +		basic_machine=m68k-hp +		os=-hpux +		;; +	hp3k9[0-9][0-9] | hp9[0-9][0-9]) +		basic_machine=hppa1.0-hp +		;; +	hp9k2[0-9][0-9] | hp9k31[0-9]) +		basic_machine=m68000-hp +		;; +	hp9k3[2-9][0-9]) +		basic_machine=m68k-hp +		;; +	hp9k6[0-9][0-9] | hp6[0-9][0-9]) +		basic_machine=hppa1.0-hp +		;; +	hp9k7[0-79][0-9] | hp7[0-79][0-9]) +		basic_machine=hppa1.1-hp +		;; +	hp9k78[0-9] | hp78[0-9]) +		# FIXME: really hppa2.0-hp +		basic_machine=hppa1.1-hp +		;; +	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) +		# FIXME: really hppa2.0-hp +		basic_machine=hppa1.1-hp +		;; +	hp9k8[0-9][13679] | hp8[0-9][13679]) +		basic_machine=hppa1.1-hp +		;; +	hp9k8[0-9][0-9] | hp8[0-9][0-9]) +		basic_machine=hppa1.0-hp +		;; +	hppa-next) +		os=-nextstep3 +		;; +	hppaosf) +		basic_machine=hppa1.1-hp +		os=-osf +		;; +	hppro) +		basic_machine=hppa1.1-hp +		os=-proelf +		;; +	i370-ibm* | ibm*) +		basic_machine=i370-ibm +		;; +# I'm not sure what "Sysv32" means.  Should this be sysv3.2? +	i*86v32) +		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` +		os=-sysv32 +		;; +	i*86v4*) +		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` +		os=-sysv4 +		;; +	i*86v) +		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` +		os=-sysv +		;; +	i*86sol2) +		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` +		os=-solaris2 +		;; +	i386mach) +		basic_machine=i386-mach +		os=-mach +		;; +	i386-vsta | vsta) +		basic_machine=i386-unknown +		os=-vsta +		;; +	iris | iris4d) +		basic_machine=mips-sgi +		case $os in +		    -irix*) +			;; +		    *) +			os=-irix4 +			;; +		esac +		;; +	isi68 | isi) +		basic_machine=m68k-isi +		os=-sysv +		;; +	m88k-omron*) +		basic_machine=m88k-omron +		;; +	magnum | m3230) +		basic_machine=mips-mips +		os=-sysv +		;; +	merlin) +		basic_machine=ns32k-utek +		os=-sysv +		;; +	mingw32) +		basic_machine=i386-pc +		os=-mingw32 +		;; +	miniframe) +		basic_machine=m68000-convergent +		;; +	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) +		basic_machine=m68k-atari +		os=-mint +		;; +	mips3*-*) +		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` +		;; +	mips3*) +		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown +		;; +	monitor) +		basic_machine=m68k-rom68k +		os=-coff +		;; +	morphos) +		basic_machine=powerpc-unknown +		os=-morphos +		;; +	msdos) +		basic_machine=i386-pc +		os=-msdos +		;; +	mvs) +		basic_machine=i370-ibm +		os=-mvs +		;; +	ncr3000) +		basic_machine=i486-ncr +		os=-sysv4 +		;; +	netbsd386) +		basic_machine=i386-unknown +		os=-netbsd +		;; +	netwinder) +		basic_machine=armv4l-rebel +		os=-linux +		;; +	news | news700 | news800 | news900) +		basic_machine=m68k-sony +		os=-newsos +		;; +	news1000) +		basic_machine=m68030-sony +		os=-newsos +		;; +	news-3600 | risc-news) +		basic_machine=mips-sony +		os=-newsos +		;; +	necv70) +		basic_machine=v70-nec +		os=-sysv +		;; +	next | m*-next ) +		basic_machine=m68k-next +		case $os in +		    -nextstep* ) +			;; +		    -ns2*) +		      os=-nextstep2 +			;; +		    *) +		      os=-nextstep3 +			;; +		esac +		;; +	nh3000) +		basic_machine=m68k-harris +		os=-cxux +		;; +	nh[45]000) +		basic_machine=m88k-harris +		os=-cxux +		;; +	nindy960) +		basic_machine=i960-intel +		os=-nindy +		;; +	mon960) +		basic_machine=i960-intel +		os=-mon960 +		;; +	nonstopux) +		basic_machine=mips-compaq +		os=-nonstopux +		;; +	np1) +		basic_machine=np1-gould +		;; +	nsr-tandem) +		basic_machine=nsr-tandem +		;; +	op50n-* | op60c-*) +		basic_machine=hppa1.1-oki +		os=-proelf +		;; +	or32 | or32-*) +		basic_machine=or32-unknown +		os=-coff +		;; +	os400) +		basic_machine=powerpc-ibm +		os=-os400 +		;; +	OSE68000 | ose68000) +		basic_machine=m68000-ericsson +		os=-ose +		;; +	os68k) +		basic_machine=m68k-none +		os=-os68k +		;; +	pa-hitachi) +		basic_machine=hppa1.1-hitachi +		os=-hiuxwe2 +		;; +	paragon) +		basic_machine=i860-intel +		os=-osf +		;; +	pbd) +		basic_machine=sparc-tti +		;; +	pbb) +		basic_machine=m68k-tti +		;; +	pc532 | pc532-*) +		basic_machine=ns32k-pc532 +		;; +	pentium | p5 | k5 | k6 | nexgen | viac3) +		basic_machine=i586-pc +		;; +	pentiumpro | p6 | 6x86 | athlon | athlon_*) +		basic_machine=i686-pc +		;; +	pentiumii | pentium2 | pentiumiii | pentium3) +		basic_machine=i686-pc +		;; +	pentium4) +		basic_machine=i786-pc +		;; +	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) +		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` +		;; +	pentiumpro-* | p6-* | 6x86-* | athlon-*) +		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` +		;; +	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) +		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` +		;; +	pentium4-*) +		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` +		;; +	pn) +		basic_machine=pn-gould +		;; +	power)	basic_machine=power-ibm +		;; +	ppc)	basic_machine=powerpc-unknown +		;; +	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` +		;; +	ppcle | powerpclittle | ppc-le | powerpc-little) +		basic_machine=powerpcle-unknown +		;; +	ppcle-* | powerpclittle-*) +		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` +		;; +	ppc64)	basic_machine=powerpc64-unknown +		;; +	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` +		;; +	ppc64le | powerpc64little | ppc64-le | powerpc64-little) +		basic_machine=powerpc64le-unknown +		;; +	ppc64le-* | powerpc64little-*) +		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` +		;; +	ps2) +		basic_machine=i386-ibm +		;; +	pw32) +		basic_machine=i586-unknown +		os=-pw32 +		;; +	rom68k) +		basic_machine=m68k-rom68k +		os=-coff +		;; +	rm[46]00) +		basic_machine=mips-siemens +		;; +	rtpc | rtpc-*) +		basic_machine=romp-ibm +		;; +	s390 | s390-*) +		basic_machine=s390-ibm +		;; +	s390x | s390x-*) +		basic_machine=s390x-ibm +		;; +	sa29200) +		basic_machine=a29k-amd +		os=-udi +		;; +	sb1) +		basic_machine=mipsisa64sb1-unknown +		;; +	sb1el) +		basic_machine=mipsisa64sb1el-unknown +		;; +	sei) +		basic_machine=mips-sei +		os=-seiux +		;; +	sequent) +		basic_machine=i386-sequent +		;; +	sh) +		basic_machine=sh-hitachi +		os=-hms +		;; +	sh64) +		basic_machine=sh64-unknown +		;; +	sparclite-wrs | simso-wrs) +		basic_machine=sparclite-wrs +		os=-vxworks +		;; +	sps7) +		basic_machine=m68k-bull +		os=-sysv2 +		;; +	spur) +		basic_machine=spur-unknown +		;; +	st2000) +		basic_machine=m68k-tandem +		;; +	stratus) +		basic_machine=i860-stratus +		os=-sysv4 +		;; +	sun2) +		basic_machine=m68000-sun +		;; +	sun2os3) +		basic_machine=m68000-sun +		os=-sunos3 +		;; +	sun2os4) +		basic_machine=m68000-sun +		os=-sunos4 +		;; +	sun3os3) +		basic_machine=m68k-sun +		os=-sunos3 +		;; +	sun3os4) +		basic_machine=m68k-sun +		os=-sunos4 +		;; +	sun4os3) +		basic_machine=sparc-sun +		os=-sunos3 +		;; +	sun4os4) +		basic_machine=sparc-sun +		os=-sunos4 +		;; +	sun4sol2) +		basic_machine=sparc-sun +		os=-solaris2 +		;; +	sun3 | sun3-*) +		basic_machine=m68k-sun +		;; +	sun4) +		basic_machine=sparc-sun +		;; +	sun386 | sun386i | roadrunner) +		basic_machine=i386-sun +		;; +	sv1) +		basic_machine=sv1-cray +		os=-unicos +		;; +	symmetry) +		basic_machine=i386-sequent +		os=-dynix +		;; +	t3e) +		basic_machine=alphaev5-cray +		os=-unicos +		;; +	t90) +		basic_machine=t90-cray +		os=-unicos +		;; +	tic54x | c54x*) +		basic_machine=tic54x-unknown +		os=-coff +		;; +	tic55x | c55x*) +		basic_machine=tic55x-unknown +		os=-coff +		;; +	tic6x | c6x*) +		basic_machine=tic6x-unknown +		os=-coff +		;; +	tx39) +		basic_machine=mipstx39-unknown +		;; +	tx39el) +		basic_machine=mipstx39el-unknown +		;; +	toad1) +		basic_machine=pdp10-xkl +		os=-tops20 +		;; +	tower | tower-32) +		basic_machine=m68k-ncr +		;; +	tpf) +		basic_machine=s390x-ibm +		os=-tpf +		;; +	udi29k) +		basic_machine=a29k-amd +		os=-udi +		;; +	ultra3) +		basic_machine=a29k-nyu +		os=-sym1 +		;; +	v810 | necv810) +		basic_machine=v810-nec +		os=-none +		;; +	vaxv) +		basic_machine=vax-dec +		os=-sysv +		;; +	vms) +		basic_machine=vax-dec +		os=-vms +		;; +	vpp*|vx|vx-*) +		basic_machine=f301-fujitsu +		;; +	vxworks960) +		basic_machine=i960-wrs +		os=-vxworks +		;; +	vxworks68) +		basic_machine=m68k-wrs +		os=-vxworks +		;; +	vxworks29k) +		basic_machine=a29k-wrs +		os=-vxworks +		;; +	w65*) +		basic_machine=w65-wdc +		os=-none +		;; +	w89k-*) +		basic_machine=hppa1.1-winbond +		os=-proelf +		;; +	xbox) +		basic_machine=i686-pc +		os=-mingw32 +		;; +	xps | xps100) +		basic_machine=xps100-honeywell +		;; +	ymp) +		basic_machine=ymp-cray +		os=-unicos +		;; +	z8k-*-coff) +		basic_machine=z8k-unknown +		os=-sim +		;; +	none) +		basic_machine=none-none +		os=-none +		;; + +# Here we handle the default manufacturer of certain CPU types.  It is in +# some cases the only manufacturer, in others, it is the most popular. +	w89k) +		basic_machine=hppa1.1-winbond +		;; +	op50n) +		basic_machine=hppa1.1-oki +		;; +	op60c) +		basic_machine=hppa1.1-oki +		;; +	romp) +		basic_machine=romp-ibm +		;; +	mmix) +		basic_machine=mmix-knuth +		;; +	rs6000) +		basic_machine=rs6000-ibm +		;; +	vax) +		basic_machine=vax-dec +		;; +	pdp10) +		# there are many clones, so DEC is not a safe bet +		basic_machine=pdp10-unknown +		;; +	pdp11) +		basic_machine=pdp11-dec +		;; +	we32k) +		basic_machine=we32k-att +		;; +	sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) +		basic_machine=sh-unknown +		;; +	sh64) +		basic_machine=sh64-unknown +		;; +	sparc | sparcv8 | sparcv9 | sparcv9b) +		basic_machine=sparc-sun +		;; +	cydra) +		basic_machine=cydra-cydrome +		;; +	orion) +		basic_machine=orion-highlevel +		;; +	orion105) +		basic_machine=clipper-highlevel +		;; +	mac | mpw | mac-mpw) +		basic_machine=m68k-apple +		;; +	pmac | pmac-mpw) +		basic_machine=powerpc-apple +		;; +	*-unknown) +		# Make sure to match an already-canonicalized machine name. +		;; +	*) +		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 +		exit 1 +		;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in +	*-digital*) +		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` +		;; +	*-commodore*) +		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` +		;; +	*) +		;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in +        # First match some system type aliases +        # that might get confused with valid system types. +	# -solaris* is a basic system type, with this one exception. +	-solaris1 | -solaris1.*) +		os=`echo $os | sed -e 's|solaris1|sunos4|'` +		;; +	-solaris) +		os=-solaris2 +		;; +	-svr4*) +		os=-sysv4 +		;; +	-unixware*) +		os=-sysv4.2uw +		;; +	-gnu/linux*) +		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` +		;; +	# First accept the basic system types. +	# The portable systems comes first. +	# Each alternative MUST END IN A *, to match a version number. +	# -sysv* is not here because it comes later, after sysvr4. +	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ +	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ +	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ +	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ +	      | -aos* \ +	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ +	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ +	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ +	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ +	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ +	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ +	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ +	      | -chorusos* | -chorusrdb* \ +	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ +	      | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ +	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ +	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ +	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ +	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ +	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ +	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*) +	# Remember, each alternative MUST END IN *, to match a version number. +		;; +	-qnx*) +		case $basic_machine in +		    x86-* | i*86-*) +			;; +		    *) +			os=-nto$os +			;; +		esac +		;; +	-nto-qnx*) +		;; +	-nto*) +		os=`echo $os | sed -e 's|nto|nto-qnx|'` +		;; +	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ +	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ +	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) +		;; +	-mac*) +		os=`echo $os | sed -e 's|mac|macos|'` +		;; +	-linux-dietlibc) +		os=-linux-dietlibc +		;; +	-linux*) +		os=`echo $os | sed -e 's|linux|linux-gnu|'` +		;; +	-sunos5*) +		os=`echo $os | sed -e 's|sunos5|solaris2|'` +		;; +	-sunos6*) +		os=`echo $os | sed -e 's|sunos6|solaris3|'` +		;; +	-opened*) +		os=-openedition +		;; +        -os400*) +		os=-os400 +		;; +	-wince*) +		os=-wince +		;; +	-osfrose*) +		os=-osfrose +		;; +	-osf*) +		os=-osf +		;; +	-utek*) +		os=-bsd +		;; +	-dynix*) +		os=-bsd +		;; +	-acis*) +		os=-aos +		;; +	-atheos*) +		os=-atheos +		;; +	-syllable*) +		os=-syllable +		;; +	-386bsd) +		os=-bsd +		;; +	-ctix* | -uts*) +		os=-sysv +		;; +	-nova*) +		os=-rtmk-nova +		;; +	-ns2 ) +		os=-nextstep2 +		;; +	-nsk*) +		os=-nsk +		;; +	# Preserve the version number of sinix5. +	-sinix5.*) +		os=`echo $os | sed -e 's|sinix|sysv|'` +		;; +	-sinix*) +		os=-sysv4 +		;; +        -tpf*) +		os=-tpf +		;; +	-triton*) +		os=-sysv3 +		;; +	-oss*) +		os=-sysv3 +		;; +	-svr4) +		os=-sysv4 +		;; +	-svr3) +		os=-sysv3 +		;; +	-sysvr4) +		os=-sysv4 +		;; +	# This must come after -sysvr4. +	-sysv*) +		;; +	-ose*) +		os=-ose +		;; +	-es1800*) +		os=-ose +		;; +	-xenix) +		os=-xenix +		;; +	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) +		os=-mint +		;; +	-aros*) +		os=-aros +		;; +	-kaos*) +		os=-kaos +		;; +	-zvmoe) +		os=-zvmoe +		;; +	-none) +		;; +	*) +		# Get rid of the `-' at the beginning of $os. +		os=`echo $os | sed 's/[^-]*-//'` +		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 +		exit 1 +		;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system.  Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in +	*-acorn) +		os=-riscix1.2 +		;; +	arm*-rebel) +		os=-linux +		;; +	arm*-semi) +		os=-aout +		;; +    c4x-* | tic4x-*) +        os=-coff +        ;; +	# This must come before the *-dec entry. +	pdp10-*) +		os=-tops20 +		;; +	pdp11-*) +		os=-none +		;; +	*-dec | vax-*) +		os=-ultrix4.2 +		;; +	m68*-apollo) +		os=-domain +		;; +	i386-sun) +		os=-sunos4.0.2 +		;; +	m68000-sun) +		os=-sunos3 +		# This also exists in the configure program, but was not the +		# default. +		# os=-sunos4 +		;; +	m68*-cisco) +		os=-aout +		;; +	mips*-cisco) +		os=-elf +		;; +	mips*-*) +		os=-elf +		;; +	or32-*) +		os=-coff +		;; +	*-tti)	# must be before sparc entry or we get the wrong os. +		os=-sysv3 +		;; +	sparc-* | *-sun) +		os=-sunos4.1.1 +		;; +	*-be) +		os=-beos +		;; +	*-ibm) +		os=-aix +		;; +    	*-knuth) +		os=-mmixware +		;; +	*-wec) +		os=-proelf +		;; +	*-winbond) +		os=-proelf +		;; +	*-oki) +		os=-proelf +		;; +	*-hp) +		os=-hpux +		;; +	*-hitachi) +		os=-hiux +		;; +	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) +		os=-sysv +		;; +	*-cbm) +		os=-amigaos +		;; +	*-dg) +		os=-dgux +		;; +	*-dolphin) +		os=-sysv3 +		;; +	m68k-ccur) +		os=-rtu +		;; +	m88k-omron*) +		os=-luna +		;; +	*-next ) +		os=-nextstep +		;; +	*-sequent) +		os=-ptx +		;; +	*-crds) +		os=-unos +		;; +	*-ns) +		os=-genix +		;; +	i370-*) +		os=-mvs +		;; +	*-next) +		os=-nextstep3 +		;; +	*-gould) +		os=-sysv +		;; +	*-highlevel) +		os=-bsd +		;; +	*-encore) +		os=-bsd +		;; +	*-sgi) +		os=-irix +		;; +	*-siemens) +		os=-sysv4 +		;; +	*-masscomp) +		os=-rtu +		;; +	f30[01]-fujitsu | f700-fujitsu) +		os=-uxpv +		;; +	*-rom68k) +		os=-coff +		;; +	*-*bug) +		os=-coff +		;; +	*-apple) +		os=-macos +		;; +	*-atari*) +		os=-mint +		;; +	*) +		os=-none +		;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer.  We pick the logical manufacturer. +vendor=unknown +case $basic_machine in +	*-unknown) +		case $os in +			-riscix*) +				vendor=acorn +				;; +			-sunos*) +				vendor=sun +				;; +			-aix*) +				vendor=ibm +				;; +			-beos*) +				vendor=be +				;; +			-hpux*) +				vendor=hp +				;; +			-mpeix*) +				vendor=hp +				;; +			-hiux*) +				vendor=hitachi +				;; +			-unos*) +				vendor=crds +				;; +			-dgux*) +				vendor=dg +				;; +			-luna*) +				vendor=omron +				;; +			-genix*) +				vendor=ns +				;; +			-mvs* | -opened*) +				vendor=ibm +				;; +			-os400*) +				vendor=ibm +				;; +			-ptx*) +				vendor=sequent +				;; +			-tpf*) +				vendor=ibm +				;; +			-vxsim* | -vxworks* | -windiss*) +				vendor=wrs +				;; +			-aux*) +				vendor=apple +				;; +			-hms*) +				vendor=hitachi +				;; +			-mpw* | -macos*) +				vendor=apple +				;; +			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) +				vendor=atari +				;; +			-vos*) +				vendor=stratus +				;; +		esac +		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` +		;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/toolchain/elf2flt/elf2flt/configure b/toolchain/elf2flt/elf2flt/configure new file mode 100755 index 000000000..ef5c394ca --- /dev/null +++ b/toolchain/elf2flt/elf2flt/configure @@ -0,0 +1,4429 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.57. +# +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization.  ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then +  emulate sh +  NULLCMD=: +  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which +  # is contrary to our usage.  Disable this feature. +  alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then +  set -o posix +fi + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then +  as_unset=unset +else +  as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ +  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ +  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ +  LC_TELEPHONE LC_TIME +do +  if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then +    eval $as_var=C; export $as_var +  else +    $as_unset $as_var +  fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then +  as_expr=expr +else +  as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then +  as_basename=basename +else +  as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ +	 X"$0" : 'X\(//\)$' \| \ +	 X"$0" : 'X\(/\)$' \| \ +	 .     : '\(.\)' 2>/dev/null || +echo X/"$0" | +    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } +  	  /^X\/\(\/\/\)$/{ s//\1/; q; } +  	  /^X\/\(\/\).*/{ s//\1/; q; } +  	  s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then +  echo "#! /bin/sh" >conf$$.sh +  echo  "exit 0"   >>conf$$.sh +  chmod +x conf$$.sh +  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then +    PATH_SEPARATOR=';' +  else +    PATH_SEPARATOR=: +  fi +  rm -f conf$$.sh +fi + + +  as_lineno_1=$LINENO +  as_lineno_2=$LINENO +  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` +  test "x$as_lineno_1" != "x$as_lineno_2" && +  test "x$as_lineno_3"  = "x$as_lineno_2"  || { +  # Find who we are.  Look in the path if we contain no path at all +  # relative or not. +  case $0 in +    *[\\/]* ) as_myself=$0 ;; +    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do +  IFS=$as_save_IFS +  test -z "$as_dir" && as_dir=. +  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + +       ;; +  esac +  # We did not find ourselves, most probably we were run as `sh COMMAND' +  # in which case we are not to be found in the path. +  if test "x$as_myself" = x; then +    as_myself=$0 +  fi +  if test ! -f "$as_myself"; then +    { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 +   { (exit 1); exit 1; }; } +  fi +  case $CONFIG_SHELL in +  '') +    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do +  IFS=$as_save_IFS +  test -z "$as_dir" && as_dir=. +  for as_base in sh bash ksh sh5; do +	 case $as_dir in +	 /*) +	   if ("$as_dir/$as_base" -c ' +  as_lineno_1=$LINENO +  as_lineno_2=$LINENO +  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` +  test "x$as_lineno_1" != "x$as_lineno_2" && +  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then +	     $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } +	     $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } +	     CONFIG_SHELL=$as_dir/$as_base +	     export CONFIG_SHELL +	     exec "$CONFIG_SHELL" "$0" ${1+"$@"} +	   fi;; +	 esac +       done +done +;; +  esac + +  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO +  # uniformly replaced by the line number.  The first 'sed' inserts a +  # line-number line before each line; the second 'sed' does the real +  # work.  The second script uses 'N' to pair each line-number line +  # with the numbered line, and appends trailing '-' during +  # substitution so that $LINENO is not a special case at line end. +  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the +  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-) +  sed '=' <$as_myself | +    sed ' +      N +      s,$,-, +      : loop +      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, +      t loop +      s,-$,, +      s,^['$as_cr_digits']*\n,, +    ' >$as_me.lineno && +  chmod +x $as_me.lineno || +    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 +   { (exit 1); exit 1; }; } + +  # Don't try to exec as it changes $[0], causing all sort of problems +  # (the dirname of $[0] is not the place where we might find the +  # original and so on.  Autoconf is especially sensible to this). +  . ./$as_me.lineno +  # Exit status is that of the last command. +  exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in +  *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T='	' ;; +  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;; +  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then +  as_expr=expr +else +  as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then +  # We could just check for DJGPP; but this test a) works b) is more generic +  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). +  if test -f conf$$.exe; then +    # Don't use ln at all; we don't have any links +    as_ln_s='cp -p' +  else +    as_ln_s='ln -s' +  fi +elif ln conf$$.file conf$$ 2>/dev/null; then +  as_ln_s=ln +else +  as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then +  as_mkdir_p=: +else +  as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" 	$as_nl" + +# CDPATH. +$as_unset CDPATH + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete.  It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_unique_file="elf2flt.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include <stdio.h> +#if HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#if HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#else +# if HAVE_STDLIB_H +#  include <stdlib.h> +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +#  include <memory.h> +# endif +# include <string.h> +#endif +#if HAVE_STRINGS_H +# include <strings.h> +#endif +#if HAVE_INTTYPES_H +# include <inttypes.h> +#else +# if HAVE_STDINT_H +#  include <stdint.h> +# endif +#endif +#if HAVE_UNISTD_H +# include <unistd.h> +#endif" + +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CPP EGREP bfd_include_dir binutils_include_dir got_check LIBOBJS LTLIBOBJS' +ac_subst_files='' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +for ac_option +do +  # If the previous option needs an argument, assign it. +  if test -n "$ac_prev"; then +    eval "$ac_prev=\$ac_option" +    ac_prev= +    continue +  fi + +  ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + +  # Accept the important Cygnus configure options, so we can diagnose typos. + +  case $ac_option in + +  -bindir | --bindir | --bindi | --bind | --bin | --bi) +    ac_prev=bindir ;; +  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) +    bindir=$ac_optarg ;; + +  -build | --build | --buil | --bui | --bu) +    ac_prev=build_alias ;; +  -build=* | --build=* | --buil=* | --bui=* | --bu=*) +    build_alias=$ac_optarg ;; + +  -cache-file | --cache-file | --cache-fil | --cache-fi \ +  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) +    ac_prev=cache_file ;; +  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ +  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) +    cache_file=$ac_optarg ;; + +  --config-cache | -C) +    cache_file=config.cache ;; + +  -datadir | --datadir | --datadi | --datad | --data | --dat | --da) +    ac_prev=datadir ;; +  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ +  | --da=*) +    datadir=$ac_optarg ;; + +  -disable-* | --disable-*) +    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` +    # Reject names that are not valid shell variable names. +    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && +      { echo "$as_me: error: invalid feature name: $ac_feature" >&2 +   { (exit 1); exit 1; }; } +    ac_feature=`echo $ac_feature | sed 's/-/_/g'` +    eval "enable_$ac_feature=no" ;; + +  -enable-* | --enable-*) +    ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` +    # Reject names that are not valid shell variable names. +    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && +      { echo "$as_me: error: invalid feature name: $ac_feature" >&2 +   { (exit 1); exit 1; }; } +    ac_feature=`echo $ac_feature | sed 's/-/_/g'` +    case $ac_option in +      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; +      *) ac_optarg=yes ;; +    esac +    eval "enable_$ac_feature='$ac_optarg'" ;; + +  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ +  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ +  | --exec | --exe | --ex) +    ac_prev=exec_prefix ;; +  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ +  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ +  | --exec=* | --exe=* | --ex=*) +    exec_prefix=$ac_optarg ;; + +  -gas | --gas | --ga | --g) +    # Obsolete; use --with-gas. +    with_gas=yes ;; + +  -help | --help | --hel | --he | -h) +    ac_init_help=long ;; +  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) +    ac_init_help=recursive ;; +  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) +    ac_init_help=short ;; + +  -host | --host | --hos | --ho) +    ac_prev=host_alias ;; +  -host=* | --host=* | --hos=* | --ho=*) +    host_alias=$ac_optarg ;; + +  -includedir | --includedir | --includedi | --included | --include \ +  | --includ | --inclu | --incl | --inc) +    ac_prev=includedir ;; +  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ +  | --includ=* | --inclu=* | --incl=* | --inc=*) +    includedir=$ac_optarg ;; + +  -infodir | --infodir | --infodi | --infod | --info | --inf) +    ac_prev=infodir ;; +  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) +    infodir=$ac_optarg ;; + +  -libdir | --libdir | --libdi | --libd) +    ac_prev=libdir ;; +  -libdir=* | --libdir=* | --libdi=* | --libd=*) +    libdir=$ac_optarg ;; + +  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ +  | --libexe | --libex | --libe) +    ac_prev=libexecdir ;; +  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ +  | --libexe=* | --libex=* | --libe=*) +    libexecdir=$ac_optarg ;; + +  -localstatedir | --localstatedir | --localstatedi | --localstated \ +  | --localstate | --localstat | --localsta | --localst \ +  | --locals | --local | --loca | --loc | --lo) +    ac_prev=localstatedir ;; +  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ +  | --localstate=* | --localstat=* | --localsta=* | --localst=* \ +  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) +    localstatedir=$ac_optarg ;; + +  -mandir | --mandir | --mandi | --mand | --man | --ma | --m) +    ac_prev=mandir ;; +  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) +    mandir=$ac_optarg ;; + +  -nfp | --nfp | --nf) +    # Obsolete; use --without-fp. +    with_fp=no ;; + +  -no-create | --no-create | --no-creat | --no-crea | --no-cre \ +  | --no-cr | --no-c | -n) +    no_create=yes ;; + +  -no-recursion | --no-recursion | --no-recursio | --no-recursi \ +  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) +    no_recursion=yes ;; + +  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ +  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ +  | --oldin | --oldi | --old | --ol | --o) +    ac_prev=oldincludedir ;; +  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ +  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ +  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) +    oldincludedir=$ac_optarg ;; + +  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) +    ac_prev=prefix ;; +  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) +    prefix=$ac_optarg ;; + +  -program-prefix | --program-prefix | --program-prefi | --program-pref \ +  | --program-pre | --program-pr | --program-p) +    ac_prev=program_prefix ;; +  -program-prefix=* | --program-prefix=* | --program-prefi=* \ +  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) +    program_prefix=$ac_optarg ;; + +  -program-suffix | --program-suffix | --program-suffi | --program-suff \ +  | --program-suf | --program-su | --program-s) +    ac_prev=program_suffix ;; +  -program-suffix=* | --program-suffix=* | --program-suffi=* \ +  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) +    program_suffix=$ac_optarg ;; + +  -program-transform-name | --program-transform-name \ +  | --program-transform-nam | --program-transform-na \ +  | --program-transform-n | --program-transform- \ +  | --program-transform | --program-transfor \ +  | --program-transfo | --program-transf \ +  | --program-trans | --program-tran \ +  | --progr-tra | --program-tr | --program-t) +    ac_prev=program_transform_name ;; +  -program-transform-name=* | --program-transform-name=* \ +  | --program-transform-nam=* | --program-transform-na=* \ +  | --program-transform-n=* | --program-transform-=* \ +  | --program-transform=* | --program-transfor=* \ +  | --program-transfo=* | --program-transf=* \ +  | --program-trans=* | --program-tran=* \ +  | --progr-tra=* | --program-tr=* | --program-t=*) +    program_transform_name=$ac_optarg ;; + +  -q | -quiet | --quiet | --quie | --qui | --qu | --q \ +  | -silent | --silent | --silen | --sile | --sil) +    silent=yes ;; + +  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) +    ac_prev=sbindir ;; +  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ +  | --sbi=* | --sb=*) +    sbindir=$ac_optarg ;; + +  -sharedstatedir | --sharedstatedir | --sharedstatedi \ +  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ +  | --sharedst | --shareds | --shared | --share | --shar \ +  | --sha | --sh) +    ac_prev=sharedstatedir ;; +  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ +  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ +  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ +  | --sha=* | --sh=*) +    sharedstatedir=$ac_optarg ;; + +  -site | --site | --sit) +    ac_prev=site ;; +  -site=* | --site=* | --sit=*) +    site=$ac_optarg ;; + +  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) +    ac_prev=srcdir ;; +  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) +    srcdir=$ac_optarg ;; + +  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ +  | --syscon | --sysco | --sysc | --sys | --sy) +    ac_prev=sysconfdir ;; +  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ +  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) +    sysconfdir=$ac_optarg ;; + +  -target | --target | --targe | --targ | --tar | --ta | --t) +    ac_prev=target_alias ;; +  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) +    target_alias=$ac_optarg ;; + +  -v | -verbose | --verbose | --verbos | --verbo | --verb) +    verbose=yes ;; + +  -version | --version | --versio | --versi | --vers | -V) +    ac_init_version=: ;; + +  -with-* | --with-*) +    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` +    # Reject names that are not valid shell variable names. +    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && +      { echo "$as_me: error: invalid package name: $ac_package" >&2 +   { (exit 1); exit 1; }; } +    ac_package=`echo $ac_package| sed 's/-/_/g'` +    case $ac_option in +      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; +      *) ac_optarg=yes ;; +    esac +    eval "with_$ac_package='$ac_optarg'" ;; + +  -without-* | --without-*) +    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` +    # Reject names that are not valid shell variable names. +    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && +      { echo "$as_me: error: invalid package name: $ac_package" >&2 +   { (exit 1); exit 1; }; } +    ac_package=`echo $ac_package | sed 's/-/_/g'` +    eval "with_$ac_package=no" ;; + +  --x) +    # Obsolete; use --with-x. +    with_x=yes ;; + +  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ +  | --x-incl | --x-inc | --x-in | --x-i) +    ac_prev=x_includes ;; +  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ +  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) +    x_includes=$ac_optarg ;; + +  -x-libraries | --x-libraries | --x-librarie | --x-librari \ +  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) +    ac_prev=x_libraries ;; +  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ +  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) +    x_libraries=$ac_optarg ;; + +  -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 +   { (exit 1); exit 1; }; } +    ;; + +  *=*) +    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` +    # Reject names that are not valid shell variable names. +    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && +      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 +   { (exit 1); exit 1; }; } +    ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` +    eval "$ac_envvar='$ac_optarg'" +    export $ac_envvar ;; + +  *) +    # FIXME: should be removed in autoconf 3.0. +    echo "$as_me: WARNING: you should use --build, --host, --target" >&2 +    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && +      echo "$as_me: WARNING: invalid host type: $ac_option" >&2 +    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} +    ;; + +  esac +done + +if test -n "$ac_prev"; then +  ac_option=--`echo $ac_prev | sed 's/_/-/g'` +  { echo "$as_me: error: missing argument to $ac_option" >&2 +   { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do +  eval ac_val=$`echo $ac_var` +  case $ac_val in +    [\\/$]* | ?:[\\/]* | NONE | '' ) ;; +    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 +   { (exit 1); exit 1; }; };; +  esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ +              localstatedir libdir includedir oldincludedir infodir mandir +do +  eval ac_val=$`echo $ac_var` +  case $ac_val in +    [\\/$]* | ?:[\\/]* ) ;; +    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 +   { (exit 1); exit 1; }; };; +  esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then +  if test "x$build_alias" = x; then +    cross_compiling=maybe +    echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. +    If a cross compiler is detected then cross compile mode will be used." >&2 +  elif test "x$build_alias" != "x$host_alias"; then +    cross_compiling=yes +  fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then +  ac_srcdir_defaulted=yes +  # Try the directory containing this script, then its parent. +  ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ +         X"$0" : 'X\(//\)[^/]' \| \ +         X"$0" : 'X\(//\)$' \| \ +         X"$0" : 'X\(/\)' \| \ +         .     : '\(.\)' 2>/dev/null || +echo X"$0" | +    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } +  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; } +  	  /^X\(\/\/\)$/{ s//\1/; q; } +  	  /^X\(\/\).*/{ s//\1/; q; } +  	  s/.*/./; q'` +  srcdir=$ac_confdir +  if test ! -r $srcdir/$ac_unique_file; then +    srcdir=.. +  fi +else +  ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then +  if test "$ac_srcdir_defaulted" = yes; then +    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 +   { (exit 1); exit 1; }; } +  else +    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 +   { (exit 1); exit 1; }; } +  fi +fi +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || +  { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 +   { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then +  # Omit some internal or obsolete options to make the list less imposing. +  # This message is too long to be a string in the A/UX 3.1 sh. +  cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE.  See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: +  -h, --help              display this help and exit +      --help=short        display options specific to this package +      --help=recursive    display the short help of all the included packages +  -V, --version           display version information and exit +  -q, --quiet, --silent   do not print \`checking...' messages +      --cache-file=FILE   cache test results in FILE [disabled] +  -C, --config-cache      alias for \`--cache-file=config.cache' +  -n, --no-create         do not create output files +      --srcdir=DIR        find the sources in DIR [configure dir or \`..'] + +_ACEOF + +  cat <<_ACEOF +Installation directories: +  --prefix=PREFIX         install architecture-independent files in PREFIX +                          [$ac_default_prefix] +  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX +                          [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: +  --bindir=DIR           user executables [EPREFIX/bin] +  --sbindir=DIR          system admin executables [EPREFIX/sbin] +  --libexecdir=DIR       program executables [EPREFIX/libexec] +  --datadir=DIR          read-only architecture-independent data [PREFIX/share] +  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc] +  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com] +  --localstatedir=DIR    modifiable single-machine data [PREFIX/var] +  --libdir=DIR           object code libraries [EPREFIX/lib] +  --includedir=DIR       C header files [PREFIX/include] +  --oldincludedir=DIR    C header files for non-gcc [/usr/include] +  --infodir=DIR          info documentation [PREFIX/info] +  --mandir=DIR           man documentation [PREFIX/man] +_ACEOF + +  cat <<\_ACEOF + +System types: +  --build=BUILD     configure for building on BUILD [guessed] +  --host=HOST       cross-compile to build programs to run on HOST [BUILD] +  --target=TARGET   configure for building compilers for TARGET [HOST] +_ACEOF +fi + +if test -n "$ac_init_help"; then + +  cat <<\_ACEOF + +Optional Features: +  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no) +  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes] + --disable-got-check - disable check for GOT (needed on H8) + +Optional Packages: +  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes] +  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no) + --with-libbfd=<file>  path to libbfd.a library to use + --with-libiberty=<file>  path to libiberty.a library to use + --with-bfd-include-dir=<dir>  include path for correct bfd.h + --with-binutils-include-dir=<dir>  include path for binutils headers + +Some influential environment variables: +  CC          C compiler command +  CFLAGS      C compiler flags +  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a +              nonstandard directory <lib dir> +  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have +              headers in a nonstandard directory <include dir> +  CPP         C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then +  # If there are subdirs, report their specific --help. +  ac_popdir=`pwd` +  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue +    test -d $ac_dir || continue +    ac_builddir=. + +if test "$ac_dir" != .; then +  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` +  # A "../" for each directory in $ac_dir_suffix. +  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else +  ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in +  .)  # No --srcdir option.  We are building in place. +    ac_srcdir=. +    if test -z "$ac_top_builddir"; then +       ac_top_srcdir=. +    else +       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` +    fi ;; +  [\\/]* | ?:[\\/]* )  # Absolute path. +    ac_srcdir=$srcdir$ac_dir_suffix; +    ac_top_srcdir=$srcdir ;; +  *) # Relative path. +    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix +    ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + +    cd $ac_dir +    # Check for guested configure; otherwise get Cygnus style configure. +    if test -f $ac_srcdir/configure.gnu; then +      echo +      $SHELL $ac_srcdir/configure.gnu  --help=recursive +    elif test -f $ac_srcdir/configure; then +      echo +      $SHELL $ac_srcdir/configure  --help=recursive +    elif test -f $ac_srcdir/configure.ac || +           test -f $ac_srcdir/configure.in; then +      echo +      $ac_configure --help +    else +      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 +    fi +    cd $ac_popdir +  done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then +  cat <<\_ACEOF + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF +  exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.57.  Invocation command line was + +  $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown` + +/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown` +/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo               = `(hostinfo) 2>/dev/null               || echo unknown` +/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown` +/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown` +/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do +  IFS=$as_save_IFS +  test -z "$as_dir" && as_dir=. +  echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do +  for ac_arg +  do +    case $ac_arg in +    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; +    -q | -quiet | --quiet | --quie | --qui | --qu | --q \ +    | -silent | --silent | --silen | --sile | --sil) +      continue ;; +    *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) +      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; +    esac +    case $ac_pass in +    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; +    2) +      ac_configure_args1="$ac_configure_args1 '$ac_arg'" +      if test $ac_must_keep_next = true; then +        ac_must_keep_next=false # Got value, back to normal. +      else +        case $ac_arg in +          *=* | --config-cache | -C | -disable-* | --disable-* \ +          | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ +          | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ +          | -with-* | --with-* | -without-* | --without-* | --x) +            case "$ac_configure_args0 " in +              "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; +            esac +            ;; +          -* ) ac_must_keep_next=true ;; +        esac +      fi +      ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" +      # Get rid of the leading space. +      ac_sep=" " +      ;; +    esac +  done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log.  We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? +  # Save into config.log some information that might help in debugging. +  { +    echo + +    cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX +    echo +    # The following way of writing the cache mishandles newlines in values, +{ +  (set) 2>&1 | +    case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in +    *ac_space=\ *) +      sed -n \ +        "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; +    	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" +      ;; +    *) +      sed -n \ +        "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" +      ;; +    esac; +} +    echo + +    cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX +    echo +    for ac_var in $ac_subst_vars +    do +      eval ac_val=$`echo $ac_var` +      echo "$ac_var='"'"'$ac_val'"'"'" +    done | sort +    echo + +    if test -n "$ac_subst_files"; then +      cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX +      echo +      for ac_var in $ac_subst_files +      do +	eval ac_val=$`echo $ac_var` +        echo "$ac_var='"'"'$ac_val'"'"'" +      done | sort +      echo +    fi + +    if test -s confdefs.h; then +      cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX +      echo +      sed "/^$/d" confdefs.h | sort +      echo +    fi +    test "$ac_signal" != 0 && +      echo "$as_me: caught signal $ac_signal" +    echo "$as_me: exit $exit_status" +  } >&5 +  rm -f core core.* *.core && +  rm -rf conftest* confdefs* conf$$* $ac_clean_files && +    exit $exit_status +     ' 0 +for ac_signal in 1 2 13 15; do +  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then +  if test "x$prefix" != xNONE; then +    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" +  else +    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" +  fi +fi +for ac_site_file in $CONFIG_SITE; do +  if test -r "$ac_site_file"; then +    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} +    sed 's/^/| /' "$ac_site_file" >&5 +    . "$ac_site_file" +  fi +done + +if test -r "$cache_file"; then +  # Some versions of bash will fail to source /dev/null (special +  # files actually), so we avoid doing that. +  if test -f "$cache_file"; then +    { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} +    case $cache_file in +      [\\/]* | ?:[\\/]* ) . $cache_file;; +      *)                      . ./$cache_file;; +    esac +  fi +else +  { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} +  >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | +               sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do +  eval ac_old_set=\$ac_cv_env_${ac_var}_set +  eval ac_new_set=\$ac_env_${ac_var}_set +  eval ac_old_val="\$ac_cv_env_${ac_var}_value" +  eval ac_new_val="\$ac_env_${ac_var}_value" +  case $ac_old_set,$ac_new_set in +    set,) +      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} +      ac_cache_corrupted=: ;; +    ,set) +      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} +      ac_cache_corrupted=: ;; +    ,);; +    *) +      if test "x$ac_old_val" != "x$ac_new_val"; then +        { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} +        { echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5 +echo "$as_me:   former value:  $ac_old_val" >&2;} +        { echo "$as_me:$LINENO:   current value: $ac_new_val" >&5 +echo "$as_me:   current value: $ac_new_val" >&2;} +        ac_cache_corrupted=: +      fi;; +  esac +  # Pass precious variables to config.status. +  if test "$ac_new_set" = set; then +    case $ac_new_val in +    *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) +      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; +    *) ac_arg=$ac_var=$ac_new_val ;; +    esac +    case " $ac_configure_args " in +      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy. +      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; +    esac +  fi +done +if $ac_cache_corrupted; then +  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} +  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} +   { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + + + + + + +# Check whether --with-libbfd or --without-libbfd was given. +if test "${with_libbfd+set}" = set; then +  withval="$with_libbfd" +   ac_libbfd=$withval +else +   ac_libbfd=NONE + +fi; + + +# Check whether --with-libiberty or --without-libiberty was given. +if test "${with_libiberty+set}" = set; then +  withval="$with_libiberty" +   ac_libiberty=$withval +else +   ac_libiberty=NONE + +fi; + + +# Check whether --with-bfd-include-dir or --without-bfd-include-dir was given. +if test "${with_bfd_include_dir+set}" = set; then +  withval="$with_bfd_include_dir" +   ac_bfd_include_dir=$withval +else +   ac_bfd_include_dir=NONE + +fi; + + +# Check whether --with-binutils-include-dir or --without-binutils-include-dir was given. +if test "${with_binutils_include_dir+set}" = set; then +  withval="$with_binutils_include_dir" +   ac_binutils_include_dir=$withval +else +   ac_binutils_include_dir=NONE + +fi; + +# Check whether --enable-got-check or --disable-got-check was given. +if test "${enable_got_check+set}" = set; then +  enableval="$enable_got_check" +   got_check=$enableval +else +   got_check=yes + +fi; + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do +  if test -f $ac_dir/install-sh; then +    ac_aux_dir=$ac_dir +    ac_install_sh="$ac_aux_dir/install-sh -c" +    break +  elif test -f $ac_dir/install.sh; then +    ac_aux_dir=$ac_dir +    ac_install_sh="$ac_aux_dir/install.sh -c" +    break +  elif test -f $ac_dir/shtool; then +    ac_aux_dir=$ac_dir +    ac_install_sh="$ac_aux_dir/shtool install -c" +    break +  fi +done +if test -z "$ac_aux_dir"; then +  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} +   { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || +  { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} +   { (exit 1); exit 1; }; } + +echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then +  echo $ECHO_N "(cached) $ECHO_C" >&6 +else +  ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && +  ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && +  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} +   { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || +  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} +   { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then +  echo $ECHO_N "(cached) $ECHO_C" >&6 +else +  ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && +  ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || +  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} +   { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking target system type" >&5 +echo $ECHO_N "checking target system type... $ECHO_C" >&6 +if test "${ac_cv_target+set}" = set; then +  echo $ECHO_N "(cached) $ECHO_C" >&6 +else +  ac_cv_target_alias=$target_alias +test "x$ac_cv_target_alias" = "x" && +  ac_cv_target_alias=$ac_cv_host_alias +ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || +  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;} +   { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_target" >&5 +echo "${ECHO_T}$ac_cv_target" >&6 +target=$ac_cv_target +target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && +  test "$program_prefix$program_suffix$program_transform_name" = \ +    NONENONEs,x,x, && +  program_prefix=${target_alias}- + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then +  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then +  echo $ECHO_N "(cached) $ECHO_C" >&6 +else +  if test -n "$CC"; then +  ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do +  IFS=$as_save_IFS +  test -z "$as_dir" && as_dir=. +  for ac_exec_ext in '' $ac_executable_extensions; do +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +    ac_cv_prog_CC="${ac_tool_prefix}gcc" +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 +    break 2 +  fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then +  echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else +  echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then +  ac_ct_CC=$CC +  # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then +  echo $ECHO_N "(cached) $ECHO_C" >&6 +else +  if test -n "$ac_ct_CC"; then +  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do +  IFS=$as_save_IFS +  test -z "$as_dir" && as_dir=. +  for ac_exec_ext in '' $ac_executable_extensions; do +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +    ac_cv_prog_ac_ct_CC="gcc" +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 +    break 2 +  fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then +  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else +  echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +  CC=$ac_ct_CC +else +  CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then +  if test -n "$ac_tool_prefix"; then +  # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then +  echo $ECHO_N "(cached) $ECHO_C" >&6 +else +  if test -n "$CC"; then +  ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do +  IFS=$as_save_IFS +  test -z "$as_dir" && as_dir=. +  for ac_exec_ext in '' $ac_executable_extensions; do +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +    ac_cv_prog_CC="${ac_tool_prefix}cc" +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 +    break 2 +  fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then +  echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else +  echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then +  ac_ct_CC=$CC +  # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then +  echo $ECHO_N "(cached) $ECHO_C" >&6 +else +  if test -n "$ac_ct_CC"; then +  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do +  IFS=$as_save_IFS +  test -z "$as_dir" && as_dir=. +  for ac_exec_ext in '' $ac_executable_extensions; do +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +    ac_cv_prog_ac_ct_CC="cc" +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 +    break 2 +  fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then +  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else +  echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +  CC=$ac_ct_CC +else +  CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then +  # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then +  echo $ECHO_N "(cached) $ECHO_C" >&6 +else +  if test -n "$CC"; then +  ac_cv_prog_CC="$CC" # Let the user override the test. +else +  ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do +  IFS=$as_save_IFS +  test -z "$as_dir" && as_dir=. +  for ac_exec_ext in '' $ac_executable_extensions; do +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then +       ac_prog_rejected=yes +       continue +     fi +    ac_cv_prog_CC="cc" +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 +    break 2 +  fi +done +done + +if test $ac_prog_rejected = yes; then +  # We found a bogon in the path, so make sure we never use it. +  set dummy $ac_cv_prog_CC +  shift +  if test $# != 0; then +    # We chose a different compiler from the bogus one. +    # However, it has the same basename, so the bogon will be chosen +    # first if we set CC to just the basename; use the full file name. +    shift +    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" +  fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then +  echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else +  echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then +  if test -n "$ac_tool_prefix"; then +  for ac_prog in cl +  do +    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then +  echo $ECHO_N "(cached) $ECHO_C" >&6 +else +  if test -n "$CC"; then +  ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do +  IFS=$as_save_IFS +  test -z "$as_dir" && as_dir=. +  for ac_exec_ext in '' $ac_executable_extensions; do +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +    ac_cv_prog_CC="$ac_tool_prefix$ac_prog" +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 +    break 2 +  fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then +  echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else +  echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +    test -n "$CC" && break +  done +fi +if test -z "$CC"; then +  ac_ct_CC=$CC +  for ac_prog in cl +do +  # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then +  echo $ECHO_N "(cached) $ECHO_C" >&6 +else +  if test -n "$ac_ct_CC"; then +  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do +  IFS=$as_save_IFS +  test -z "$as_dir" && as_dir=. +  for ac_exec_ext in '' $ac_executable_extensions; do +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +    ac_cv_prog_ac_ct_CC="$ac_prog" +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 +    break 2 +  fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then +  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else +  echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +  test -n "$ac_ct_CC" && break +done + +  CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} +   { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ +     "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5 +  (eval $ac_compiler --version </dev/null >&5) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5 +  (eval $ac_compiler -v </dev/null >&5) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5 +  (eval $ac_compiler -V </dev/null >&5) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h.  */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h.  */ + +int +main () +{ + +  ; +  return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 +  (eval $ac_link_default) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); }; then +  # Find the output, starting from the most likely.  This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do +  test -f "$ac_file" || continue +  case $ac_file in +    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) +        ;; +    conftest.$ac_ext ) +        # This is the source file. +        ;; +    [ab].out ) +        # We found the default executable, but exeext='' is most +        # certainly right. +        break;; +    *.* ) +        ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` +        # FIXME: I believe we export ac_cv_exeext for Libtool, +        # but it would be cool to find out if it's true.  Does anybody +        # maintain Libtool? --akim. +        export ac_cv_exeext +        break;; +    * ) +        break;; +  esac +done +else +  echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} +   { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run.  If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then +  if { ac_try='./$ac_file' +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 +  (eval $ac_try) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); }; }; then +    cross_compiling=no +  else +    if test "$cross_compiling" = maybe; then +	cross_compiling=yes +    else +	{ { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} +   { (exit 1); exit 1; }; } +    fi +  fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run.  If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +  (eval $ac_link) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); }; then +  # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do +  test -f "$ac_file" || continue +  case $ac_file in +    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; +    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` +          export ac_cv_exeext +          break;; +    * ) break;; +  esac +done +else +  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} +   { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then +  echo $ECHO_N "(cached) $ECHO_C" >&6 +else +  cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h.  */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h.  */ + +int +main () +{ + +  ; +  return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 +  (eval $ac_compile) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); }; then +  for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do +  case $ac_file in +    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; +    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` +       break;; +  esac +done +else +  echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} +   { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then +  echo $ECHO_N "(cached) $ECHO_C" >&6 +else +  cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h.  */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h.  */ + +int +main () +{ +#ifndef __GNUC__ +       choke me +#endif + +  ; +  return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 +  (eval $ac_compile) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); } && +         { ac_try='test -s conftest.$ac_objext' +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 +  (eval $ac_try) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); }; }; then +  ac_compiler_gnu=yes +else +  echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then +  echo $ECHO_N "(cached) $ECHO_C" >&6 +else +  cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h.  */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h.  */ + +int +main () +{ + +  ; +  return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 +  (eval $ac_compile) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); } && +         { ac_try='test -s conftest.$ac_objext' +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 +  (eval $ac_try) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); }; }; then +  ac_cv_prog_cc_g=yes +else +  echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then +  CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then +  if test "$GCC" = yes; then +    CFLAGS="-g -O2" +  else +    CFLAGS="-g" +  fi +else +  if test "$GCC" = yes; then +    CFLAGS="-O2" +  else +    CFLAGS= +  fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then +  echo $ECHO_N "(cached) $ECHO_C" >&6 +else +  ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h.  */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h.  */ +#include <stdarg.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) +     char **p; +     int i; +{ +  return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ +  char *s; +  va_list v; +  va_start (v,p); +  s = g (p, va_arg (v,int)); +  va_end (v); +  return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1]; +  ; +  return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX			-qlanglvl=ansi +# Ultrix and OSF/1	-std1 +# HP-UX 10.20 and later	-Ae +# HP-UX older versions	-Aa -D_HPUX_SOURCE +# SVR4			-Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do +  CC="$ac_save_CC $ac_arg" +  rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 +  (eval $ac_compile) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); } && +         { ac_try='test -s conftest.$ac_objext' +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 +  (eval $ac_try) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); }; }; then +  ac_cv_prog_cc_stdc=$ac_arg +break +else +  echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in +  x|xno) +    echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; +  *) +    echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 +    CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C.  Since we use `exit', +# in C++ we need to declare it.  In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus +  choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 +  (eval $ac_compile) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); } && +         { ac_try='test -s conftest.$ac_objext' +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 +  (eval $ac_try) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); }; }; then +  for ac_declaration in \ +   ''\ +   'extern "C" void std::exit (int) throw (); using std::exit;' \ +   'extern "C" void std::exit (int); using std::exit;' \ +   'extern "C" void exit (int) throw ();' \ +   'extern "C" void exit (int);' \ +   'void exit (int);' \ +   '#include <stdlib.h>' +do +  cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h.  */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h.  */ +#include <stdlib.h> +$ac_declaration +int +main () +{ +exit (42); +  ; +  return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 +  (eval $ac_compile) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); } && +         { ac_try='test -s conftest.$ac_objext' +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 +  (eval $ac_try) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); }; }; then +  : +else +  echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext +  cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h.  */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h.  */ +$ac_declaration +int +main () +{ +exit (42); +  ; +  return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 +  (eval $ac_compile) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); } && +         { ac_try='test -s conftest.$ac_objext' +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 +  (eval $ac_try) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); }; }; then +  break +else +  echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then +  echo '#ifdef __cplusplus' >>confdefs.h +  echo $ac_declaration      >>confdefs.h +  echo '#endif'             >>confdefs.h +fi + +else +  echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +# Find a good install program.  We prefer a C program (faster), +# so one script is as good as another.  But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then +  echo $ECHO_N "(cached) $ECHO_C" >&6 +else +  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do +  IFS=$as_save_IFS +  test -z "$as_dir" && as_dir=. +  # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in +  ./ | .// | /cC/* | \ +  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ +  /usr/ucb/* ) ;; +  *) +    # OSF1 and SCO ODT 3.0 have their own names for install. +    # Don't use installbsd from OSF since it installs stuff as root +    # by default. +    for ac_prog in ginstall scoinst install; do +      for ac_exec_ext in '' $ac_executable_extensions; do +        if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then +          if test $ac_prog = install && +            grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then +            # AIX install.  It has an incompatible calling convention. +            : +          elif test $ac_prog = install && +            grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then +            # program-specific install script used by HP pwplus--don't use. +            : +          else +            ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" +            break 3 +          fi +        fi +      done +    done +    ;; +esac +done + + +fi +  if test "${ac_cv_path_install+set}" = set; then +    INSTALL=$ac_cv_path_install +  else +    # As a last resort, use the slow shell script.  We don't cache a +    # path for INSTALL within a source directory, because that will +    # break other packages using the cache if that directory is +    # removed, or if the path is relative. +    INSTALL=$ac_install_sh +  fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +if test "$ac_libiberty" = "NONE"; then + + +echo "$as_me:$LINENO: checking for objalloc_create in -liberty" >&5 +echo $ECHO_N "checking for objalloc_create in -liberty... $ECHO_C" >&6 +if test "${ac_cv_lib_iberty_objalloc_create+set}" = set; then +  echo $ECHO_N "(cached) $ECHO_C" >&6 +else +  ac_check_lib_save_LIBS=$LIBS +LIBS="-liberty  $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h.  */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h.  */ + +/* Override any gcc2 internal prototype to avoid an error.  */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 +   builtin and then its argument prototype would still apply.  */ +char objalloc_create (); +int +main () +{ +objalloc_create (); +  ; +  return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +  (eval $ac_link) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); } && +         { ac_try='test -s conftest$ac_exeext' +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 +  (eval $ac_try) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); }; }; then +  ac_cv_lib_iberty_objalloc_create=yes +else +  echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_iberty_objalloc_create=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_iberty_objalloc_create" >&5 +echo "${ECHO_T}$ac_cv_lib_iberty_objalloc_create" >&6 +if test $ac_cv_lib_iberty_objalloc_create = yes; then +  cat >>confdefs.h <<_ACEOF +#define HAVE_LIBIBERTY 1 +_ACEOF + +  LIBS="-liberty $LIBS" + +fi + +  ac_libiberty=auto +else +  LIBS="$ac_libiberty $LIBS" +fi +if test "$ac_libbfd" = "NONE"; then + +echo "$as_me:$LINENO: checking for bfd_openr in -lbfd" >&5 +echo $ECHO_N "checking for bfd_openr in -lbfd... $ECHO_C" >&6 +if test "${ac_cv_lib_bfd_bfd_openr+set}" = set; then +  echo $ECHO_N "(cached) $ECHO_C" >&6 +else +  ac_check_lib_save_LIBS=$LIBS +LIBS="-lbfd  $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h.  */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h.  */ + +/* Override any gcc2 internal prototype to avoid an error.  */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 +   builtin and then its argument prototype would still apply.  */ +char bfd_openr (); +int +main () +{ +bfd_openr (); +  ; +  return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +  (eval $ac_link) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); } && +         { ac_try='test -s conftest$ac_exeext' +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 +  (eval $ac_try) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); }; }; then +  ac_cv_lib_bfd_bfd_openr=yes +else +  echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_bfd_bfd_openr=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_bfd_bfd_openr" >&5 +echo "${ECHO_T}$ac_cv_lib_bfd_bfd_openr" >&6 +if test $ac_cv_lib_bfd_bfd_openr = yes; then +  cat >>confdefs.h <<_ACEOF +#define HAVE_LIBBFD 1 +_ACEOF + +  LIBS="-lbfd $LIBS" + +fi + +  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 + +if test "$ac_libbfd" = "NONE" -o "$ac_libiberty" = "NONE" ; then +	echo +	echo "You need to specify the location of the libfd.a and libiberty.a" +	echo "host libraries from the binutils package." +	echo +	echo "Run configure again specifying these options:" +	echo +	echo "  ./configure --target=<ARCH> --with-bfd-include-dir=<dir> --with-libbfd=<libbfd.a> --with-libiberty=<libiberty.a>" +	echo +	exit 1 +fi + +if test "$ac_bfd_include_dir" = "NONE" ; then +	echo +	echo "You need to specify the location of the bfd.h header from a" +	echo "configured/compiled version of the binutils package for your target." +	echo "Without this your elf2flt may crash as it will try to use the" +	echo "systems bfd.h which may be from a different binutils package." +	echo +	echo "Run configure again specifying these options:" +	echo +	echo "  ./configure --target=<ARCH> --with-bfd-include-dir=<dir> --with-libbfd=<libbfd.a> --with-libiberty=<libiberty.a>" +	echo +	exit 1 +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then +  CPP= +fi +if test -z "$CPP"; then +  if test "${ac_cv_prog_CPP+set}" = set; then +  echo $ECHO_N "(cached) $ECHO_C" >&6 +else +      # Double quotes because CPP needs to be expanded +    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" +    do +      ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do +  # Use a header file that comes with gcc, so configuring glibc +  # with a fresh cross-compiler works. +  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since +  # <limits.h> exists even on freestanding compilers. +  # On the NeXT, cc -E runs the code through the compiler's parser, +  # not just through cpp. "Syntax error" is here to catch this case. +  cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h.  */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h.  */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif +                     Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 +  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 +  ac_status=$? +  grep -v '^ *+' conftest.er1 >conftest.err +  rm -f conftest.er1 +  cat conftest.err >&5 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); } >/dev/null; then +  if test -s conftest.err; then +    ac_cpp_err=$ac_c_preproc_warn_flag +  else +    ac_cpp_err= +  fi +else +  ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then +  : +else +  echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +  # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + +  # OK, works on sane cases.  Now check whether non-existent headers +  # can be detected and how. +  cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h.  */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h.  */ +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 +  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 +  ac_status=$? +  grep -v '^ *+' conftest.er1 >conftest.err +  rm -f conftest.er1 +  cat conftest.err >&5 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); } >/dev/null; then +  if test -s conftest.err; then +    ac_cpp_err=$ac_c_preproc_warn_flag +  else +    ac_cpp_err= +  fi +else +  ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then +  # Broken: success on invalid input. +continue +else +  echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +  # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then +  break +fi + +    done +    ac_cv_prog_CPP=$CPP + +fi +  CPP=$ac_cv_prog_CPP +else +  ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do +  # Use a header file that comes with gcc, so configuring glibc +  # with a fresh cross-compiler works. +  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since +  # <limits.h> exists even on freestanding compilers. +  # On the NeXT, cc -E runs the code through the compiler's parser, +  # not just through cpp. "Syntax error" is here to catch this case. +  cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h.  */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h.  */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif +                     Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 +  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 +  ac_status=$? +  grep -v '^ *+' conftest.er1 >conftest.err +  rm -f conftest.er1 +  cat conftest.err >&5 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); } >/dev/null; then +  if test -s conftest.err; then +    ac_cpp_err=$ac_c_preproc_warn_flag +  else +    ac_cpp_err= +  fi +else +  ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then +  : +else +  echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +  # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + +  # OK, works on sane cases.  Now check whether non-existent headers +  # can be detected and how. +  cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h.  */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h.  */ +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 +  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 +  ac_status=$? +  grep -v '^ *+' conftest.er1 >conftest.err +  rm -f conftest.er1 +  cat conftest.err >&5 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); } >/dev/null; then +  if test -s conftest.err; then +    ac_cpp_err=$ac_c_preproc_warn_flag +  else +    ac_cpp_err= +  fi +else +  ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then +  # Broken: success on invalid input. +continue +else +  echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +  # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then +  : +else +  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} +   { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then +  echo $ECHO_N "(cached) $ECHO_C" >&6 +else +  if echo a | (grep -E '(a|b)') >/dev/null 2>&1 +    then ac_cv_prog_egrep='grep -E' +    else ac_cv_prog_egrep='egrep' +    fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then +  echo $ECHO_N "(cached) $ECHO_C" >&6 +else +  cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h.  */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h.  */ +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> + +int +main () +{ + +  ; +  return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 +  (eval $ac_compile) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); } && +         { ac_try='test -s conftest.$ac_objext' +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 +  (eval $ac_try) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); }; }; then +  ac_cv_header_stdc=yes +else +  echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then +  # SunOS 4.x string.h does not declare mem*, contrary to ANSI. +  cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h.  */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h.  */ +#include <string.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +  $EGREP "memchr" >/dev/null 2>&1; then +  : +else +  ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then +  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. +  cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h.  */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h.  */ +#include <stdlib.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +  $EGREP "free" >/dev/null 2>&1; then +  : +else +  ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then +  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. +  if test "$cross_compiling" = yes; then +  : +else +  cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h.  */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h.  */ +#include <ctype.h> +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ +                   (('a' <= (c) && (c) <= 'i') \ +                     || ('j' <= (c) && (c) <= 'r') \ +                     || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ +  int i; +  for (i = 0; i < 256; i++) +    if (XOR (islower (i), ISLOWER (i)) +        || toupper (i) != TOUPPER (i)) +      exit(2); +  exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +  (eval $ac_link) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); } && { ac_try='./conftest$ac_exeext' +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 +  (eval $ac_try) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); }; }; then +  : +else +  echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ +                  inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then +  echo $ECHO_N "(cached) $ECHO_C" >&6 +else +  cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h.  */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h.  */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 +  (eval $ac_compile) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); } && +         { ac_try='test -s conftest.$ac_objext' +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 +  (eval $ac_try) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); }; }; then +  eval "$as_ac_Header=yes" +else +  echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then +  cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + +for ac_header in fcntl.h unistd.h bfd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then +  echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then +  echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else +  # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h.  */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h.  */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 +  (eval $ac_compile) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); } && +         { ac_try='test -s conftest.$ac_objext' +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 +  (eval $ac_try) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); }; }; then +  ac_header_compiler=yes +else +  echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h.  */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h.  */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 +  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 +  ac_status=$? +  grep -v '^ *+' conftest.er1 >conftest.err +  rm -f conftest.er1 +  cat conftest.err >&5 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); } >/dev/null; then +  if test -s conftest.err; then +    ac_cpp_err=$ac_c_preproc_warn_flag +  else +    ac_cpp_err= +  fi +else +  ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then +  ac_header_preproc=yes +else +  echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +  ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So?  What about this header? +case $ac_header_compiler:$ac_header_preproc in +  yes:no ) +    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} +    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} +    ( +      cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX +    ) | +      sed "s/^/$as_me: WARNING:     /" >&2 +    ;; +  no:yes ) +    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} +    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} +    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} +    ( +      cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX +    ) | +      sed "s/^/$as_me: WARNING:     /" >&2 +    ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then +  echo $ECHO_N "(cached) $ECHO_C" >&6 +else +  eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then +  cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 +if test "${ac_cv_c_const+set}" = set; then +  echo $ECHO_N "(cached) $ECHO_C" >&6 +else +  cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h.  */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h.  */ + +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus +  /* Ultrix mips cc rejects this.  */ +  typedef int charset[2]; +  const charset x; +  /* SunOS 4.1.1 cc rejects this.  */ +  char const *const *ccp; +  char **p; +  /* NEC SVR4.0.2 mips cc rejects this.  */ +  struct point {int x, y;}; +  static struct point const zero = {0,0}; +  /* AIX XL C 1.02.0.0 rejects this. +     It does not let you subtract one const X* pointer from another in +     an arm of an if-expression whose if-part is not a constant +     expression */ +  const char *g = "string"; +  ccp = &g + (g ? g-g : 0); +  /* HPUX 7.0 cc rejects these. */ +  ++ccp; +  p = (char**) ccp; +  ccp = (char const *const *) p; +  { /* SCO 3.2v4 cc rejects this.  */ +    char *t; +    char const *s = 0 ? (char *) 0 : (char const *) 0; + +    *t++ = 0; +  } +  { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */ +    int x[] = {25, 17}; +    const int *foo = &x[0]; +    ++foo; +  } +  { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ +    typedef const int *iptr; +    iptr p = 0; +    ++p; +  } +  { /* AIX XL C 1.02.0.0 rejects this saying +       "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ +    struct s { int j; const int *ap[3]; }; +    struct s *b; b->j = 5; +  } +  { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ +    const int foo = 10; +  } +#endif + +  ; +  return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 +  (eval $ac_compile) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); } && +         { ac_try='test -s conftest.$ac_objext' +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 +  (eval $ac_try) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); }; }; then +  ac_cv_c_const=yes +else +  echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_const=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6 +if test $ac_cv_c_const = no; then + +cat >>confdefs.h <<\_ACEOF +#define const +_ACEOF + +fi + + + +for ac_func in vprintf +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then +  echo $ECHO_N "(cached) $ECHO_C" >&6 +else +  cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h.  */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h.  */ +/* System header to define __stub macros and hopefully few prototypes, +    which can conflict with char $ac_func (); below. +    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since +    <limits.h> exists even on freestanding compilers.  */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif +/* Override any gcc2 internal prototype to avoid an error.  */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 +   builtin and then its argument prototype would still apply.  */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements +    to always fail with ENOSYS.  Some functions are actually named +    something starting with __ and the normal name is an alias.  */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; +  ; +  return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +  (eval $ac_link) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); } && +         { ac_try='test -s conftest$ac_exeext' +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 +  (eval $ac_try) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); }; }; then +  eval "$as_ac_var=yes" +else +  echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then +  cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +echo "$as_me:$LINENO: checking for _doprnt" >&5 +echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6 +if test "${ac_cv_func__doprnt+set}" = set; then +  echo $ECHO_N "(cached) $ECHO_C" >&6 +else +  cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h.  */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h.  */ +/* System header to define __stub macros and hopefully few prototypes, +    which can conflict with char _doprnt (); below. +    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since +    <limits.h> exists even on freestanding compilers.  */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif +/* Override any gcc2 internal prototype to avoid an error.  */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 +   builtin and then its argument prototype would still apply.  */ +char _doprnt (); +/* The GNU C library defines this for functions which it implements +    to always fail with ENOSYS.  Some functions are actually named +    something starting with __ and the normal name is an alias.  */ +#if defined (__stub__doprnt) || defined (__stub____doprnt) +choke me +#else +char (*f) () = _doprnt; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != _doprnt; +  ; +  return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +  (eval $ac_link) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); } && +         { ac_try='test -s conftest$ac_exeext' +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 +  (eval $ac_try) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); }; }; then +  ac_cv_func__doprnt=yes +else +  echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func__doprnt=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5 +echo "${ECHO_T}$ac_cv_func__doprnt" >&6 +if test $ac_cv_func__doprnt = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DOPRNT 1 +_ACEOF + +fi + +fi +done + + + + +for ac_func in dcgettext +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then +  echo $ECHO_N "(cached) $ECHO_C" >&6 +else +  cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h.  */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h.  */ +/* System header to define __stub macros and hopefully few prototypes, +    which can conflict with char $ac_func (); below. +    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since +    <limits.h> exists even on freestanding compilers.  */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif +/* Override any gcc2 internal prototype to avoid an error.  */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 +   builtin and then its argument prototype would still apply.  */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements +    to always fail with ENOSYS.  Some functions are actually named +    something starting with __ and the normal name is an alias.  */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; +  ; +  return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +  (eval $ac_link) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); } && +         { ac_try='test -s conftest$ac_exeext' +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 +  (eval $ac_try) 2>&5 +  ac_status=$? +  echo "$as_me:$LINENO: \$? = $ac_status" >&5 +  (exit $ac_status); }; }; then +  eval "$as_ac_var=yes" +else +  echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then +  cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + + + + + + + + + +                    ac_config_files="$ac_config_files Makefile ld-elf2flt" +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems.  If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ +  (set) 2>&1 | +    case `(ac_space=' '; set | grep ac_space) 2>&1` in +    *ac_space=\ *) +      # `set' does not quote correctly, so add quotes (double-quote +      # substitution turns \\\\ into \\, and sed turns \\ into \). +      sed -n \ +        "s/'/'\\\\''/g; +    	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" +      ;; +    *) +      # `set' quotes correctly as required by POSIX, so do not add quotes. +      sed -n \ +        "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" +      ;; +    esac; +} | +  sed ' +     t clear +     : clear +     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ +     t end +     /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ +     : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else +  if test -w $cache_file; then +    test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" +    cat confcache >$cache_file +  else +    echo "not updating unwritable cache $cache_file" +  fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then +  ac_vpsub='/^[ 	]*VPATH[ 	]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ 	]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ 	]*$//; +}' +fi + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then we branch to the quote section.  Otherwise, +# look for a macro that doesn't take arguments. +cat >confdef2opt.sed <<\_ACEOF +t clear +: clear +s,^[ 	]*#[ 	]*define[ 	][ 	]*\([^ 	(][^ 	(]*([^)]*)\)[ 	]*\(.*\),-D\1=\2,g +t quote +s,^[ 	]*#[ 	]*define[ 	][ 	]*\([^ 	][^ 	]*\)[ 	]*\(.*\),-D\1=\2,g +t quote +d +: quote +s,[ 	`~#$^&*(){}\\|;'"<>?],\\&,g +s,\[,\\&,g +s,\],\\&,g +s,\$,$$,g +p +_ACEOF +# We use echo to avoid assuming a particular line-breaking character. +# The extra dot is to prevent the shell from consuming trailing +# line-breaks from the sub-command output.  A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` +DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` +rm -f confdef2opt.sed + + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue +  # 1. Remove the extension, and $U if already installed. +  ac_i=`echo "$ac_i" | +         sed 's/\$U\././;s/\.o$//;s/\.obj$//'` +  # 2. Add them. +  ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" +  ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization.  ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then +  emulate sh +  NULLCMD=: +  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which +  # is contrary to our usage.  Disable this feature. +  alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then +  set -o posix +fi + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then +  as_unset=unset +else +  as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ +  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ +  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ +  LC_TELEPHONE LC_TIME +do +  if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then +    eval $as_var=C; export $as_var +  else +    $as_unset $as_var +  fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then +  as_expr=expr +else +  as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then +  as_basename=basename +else +  as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ +	 X"$0" : 'X\(//\)$' \| \ +	 X"$0" : 'X\(/\)$' \| \ +	 .     : '\(.\)' 2>/dev/null || +echo X/"$0" | +    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } +  	  /^X\/\(\/\/\)$/{ s//\1/; q; } +  	  /^X\/\(\/\).*/{ s//\1/; q; } +  	  s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then +  echo "#! /bin/sh" >conf$$.sh +  echo  "exit 0"   >>conf$$.sh +  chmod +x conf$$.sh +  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then +    PATH_SEPARATOR=';' +  else +    PATH_SEPARATOR=: +  fi +  rm -f conf$$.sh +fi + + +  as_lineno_1=$LINENO +  as_lineno_2=$LINENO +  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` +  test "x$as_lineno_1" != "x$as_lineno_2" && +  test "x$as_lineno_3"  = "x$as_lineno_2"  || { +  # Find who we are.  Look in the path if we contain no path at all +  # relative or not. +  case $0 in +    *[\\/]* ) as_myself=$0 ;; +    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do +  IFS=$as_save_IFS +  test -z "$as_dir" && as_dir=. +  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + +       ;; +  esac +  # We did not find ourselves, most probably we were run as `sh COMMAND' +  # in which case we are not to be found in the path. +  if test "x$as_myself" = x; then +    as_myself=$0 +  fi +  if test ! -f "$as_myself"; then +    { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} +   { (exit 1); exit 1; }; } +  fi +  case $CONFIG_SHELL in +  '') +    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do +  IFS=$as_save_IFS +  test -z "$as_dir" && as_dir=. +  for as_base in sh bash ksh sh5; do +	 case $as_dir in +	 /*) +	   if ("$as_dir/$as_base" -c ' +  as_lineno_1=$LINENO +  as_lineno_2=$LINENO +  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` +  test "x$as_lineno_1" != "x$as_lineno_2" && +  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then +	     $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } +	     $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } +	     CONFIG_SHELL=$as_dir/$as_base +	     export CONFIG_SHELL +	     exec "$CONFIG_SHELL" "$0" ${1+"$@"} +	   fi;; +	 esac +       done +done +;; +  esac + +  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO +  # uniformly replaced by the line number.  The first 'sed' inserts a +  # line-number line before each line; the second 'sed' does the real +  # work.  The second script uses 'N' to pair each line-number line +  # with the numbered line, and appends trailing '-' during +  # substitution so that $LINENO is not a special case at line end. +  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the +  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-) +  sed '=' <$as_myself | +    sed ' +      N +      s,$,-, +      : loop +      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, +      t loop +      s,-$,, +      s,^['$as_cr_digits']*\n,, +    ' >$as_me.lineno && +  chmod +x $as_me.lineno || +    { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} +   { (exit 1); exit 1; }; } + +  # Don't try to exec as it changes $[0], causing all sort of problems +  # (the dirname of $[0] is not the place where we might find the +  # original and so on.  Autoconf is especially sensible to this). +  . ./$as_me.lineno +  # Exit status is that of the last command. +  exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in +  *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T='	' ;; +  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;; +  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then +  as_expr=expr +else +  as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then +  # We could just check for DJGPP; but this test a) works b) is more generic +  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). +  if test -f conf$$.exe; then +    # Don't use ln at all; we don't have any links +    as_ln_s='cp -p' +  else +    as_ln_s='ln -s' +  fi +elif ln conf$$.file conf$$ 2>/dev/null; then +  as_ln_s=ln +else +  as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then +  as_mkdir_p=: +else +  as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" 	$as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling.  Logging --version etc. is OK. +exec 5>>config.log +{ +  echo +  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by $as_me, which was +generated by GNU Autoconf 2.57.  Invocation command line was + +  CONFIG_FILES    = $CONFIG_FILES +  CONFIG_HEADERS  = $CONFIG_HEADERS +  CONFIG_LINKS    = $CONFIG_LINKS +  CONFIG_COMMANDS = $CONFIG_COMMANDS +  $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then +  echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then +  echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then +  echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then +  echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + +  -h, --help       print this help, then exit +  -V, --version    print version number, then exit +  -q, --quiet      do not print progress messages +  -d, --debug      don't remove temporary files +      --recheck    update $as_me by reconfiguring in the same conditions +  --file=FILE[:TEMPLATE] +                   instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to <bug-autoconf@gnu.org>." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.57, +  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value.  By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do +  case $1 in +  --*=*) +    ac_option=`expr "x$1" : 'x\([^=]*\)='` +    ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` +    ac_shift=: +    ;; +  -*) +    ac_option=$1 +    ac_optarg=$2 +    ac_shift=shift +    ;; +  *) # This is not an option, so the user has probably given explicit +     # arguments. +     ac_option=$1 +     ac_need_defaults=false;; +  esac + +  case $ac_option in +  # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) +    ac_cs_recheck=: ;; +  --version | --vers* | -V ) +    echo "$ac_cs_version"; exit 0 ;; +  --he | --h) +    # Conflict between --help and --header +    { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} +   { (exit 1); exit 1; }; };; +  --help | --hel | -h ) +    echo "$ac_cs_usage"; exit 0 ;; +  --debug | --d* | -d ) +    debug=: ;; +  --file | --fil | --fi | --f ) +    $ac_shift +    CONFIG_FILES="$CONFIG_FILES $ac_optarg" +    ac_need_defaults=false;; +  --header | --heade | --head | --hea ) +    $ac_shift +    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" +    ac_need_defaults=false;; +  -q | -quiet | --quiet | --quie | --qui | --qu | --q \ +  | -silent | --silent | --silen | --sile | --sil | --si | --s) +    ac_cs_silent=: ;; + +  # This is an error. +  -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} +   { (exit 1); exit 1; }; } ;; + +  *) ac_config_targets="$ac_config_targets $1" ;; + +  esac +  shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then +  exec 6>/dev/null +  ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then +  echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 +  exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + + + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do +  case "$ac_config_target" in +  # Handling of arguments. +  "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; +  "ld-elf2flt" ) CONFIG_FILES="$CONFIG_FILES ld-elf2flt" ;; +  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} +   { (exit 1); exit 1; }; };; +  esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used.  Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then +  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Have a temporary directory for convenience.  Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ +  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 +  trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ +  tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && +  test -n "$tmp" && test -d "$tmp" +}  || +{ +  tmp=./confstat$$-$RANDOM +  (umask 077 && mkdir $tmp) +} || +{ +   echo "$me: cannot create a temporary directory in ." >&2 +   { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then +  # Protect against being on the right side of a sed subst in config.status. +  sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; +   s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@target@,$target,;t t +s,@target_cpu@,$target_cpu,;t t +s,@target_vendor@,$target_vendor,;t t +s,@target_os@,$target_os,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@CPP@,$CPP,;t t +s,@EGREP@,$EGREP,;t t +s,@bfd_include_dir@,$bfd_include_dir,;t t +s,@binutils_include_dir@,$binutils_include_dir,;t t +s,@got_check@,$got_check,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + +  cat >>$CONFIG_STATUS <<\_ACEOF +  # Split the substitutions into bite-sized pieces for seds with +  # small command number limits, like on Digital OSF/1 and HP-UX. +  ac_max_sed_lines=48 +  ac_sed_frag=1 # Number of current file. +  ac_beg=1 # First line for current file. +  ac_end=$ac_max_sed_lines # Line after last line for current file. +  ac_more_lines=: +  ac_sed_cmds= +  while $ac_more_lines; do +    if test $ac_beg -gt 1; then +      sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag +    else +      sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag +    fi +    if test ! -s $tmp/subs.frag; then +      ac_more_lines=false +    else +      # The purpose of the label and of the branching condition is to +      # speed up the sed processing (if there are no `@' at all, there +      # is no need to browse any of the substitutions). +      # These are the two extra sed commands mentioned above. +      (echo ':t +  /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed +      if test -z "$ac_sed_cmds"; then +  	ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" +      else +  	ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" +      fi +      ac_sed_frag=`expr $ac_sed_frag + 1` +      ac_beg=$ac_end +      ac_end=`expr $ac_end + $ac_max_sed_lines` +    fi +  done +  if test -z "$ac_sed_cmds"; then +    ac_sed_cmds=cat +  fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue +  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". +  case $ac_file in +  - | *:- | *:-:* ) # input from stdin +        cat >$tmp/stdin +        ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` +        ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; +  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` +        ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; +  * )   ac_file_in=$ac_file.in ;; +  esac + +  # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. +  ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ +         X"$ac_file" : 'X\(//\)[^/]' \| \ +         X"$ac_file" : 'X\(//\)$' \| \ +         X"$ac_file" : 'X\(/\)' \| \ +         .     : '\(.\)' 2>/dev/null || +echo X"$ac_file" | +    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } +  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; } +  	  /^X\(\/\/\)$/{ s//\1/; q; } +  	  /^X\(\/\).*/{ s//\1/; q; } +  	  s/.*/./; q'` +  { if $as_mkdir_p; then +    mkdir -p "$ac_dir" +  else +    as_dir="$ac_dir" +    as_dirs= +    while test ! -d "$as_dir"; do +      as_dirs="$as_dir $as_dirs" +      as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ +         X"$as_dir" : 'X\(//\)[^/]' \| \ +         X"$as_dir" : 'X\(//\)$' \| \ +         X"$as_dir" : 'X\(/\)' \| \ +         .     : '\(.\)' 2>/dev/null || +echo X"$as_dir" | +    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } +  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; } +  	  /^X\(\/\/\)$/{ s//\1/; q; } +  	  /^X\(\/\).*/{ s//\1/; q; } +  	  s/.*/./; q'` +    done +    test ! -n "$as_dirs" || mkdir $as_dirs +  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} +   { (exit 1); exit 1; }; }; } + +  ac_builddir=. + +if test "$ac_dir" != .; then +  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` +  # A "../" for each directory in $ac_dir_suffix. +  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else +  ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in +  .)  # No --srcdir option.  We are building in place. +    ac_srcdir=. +    if test -z "$ac_top_builddir"; then +       ac_top_srcdir=. +    else +       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` +    fi ;; +  [\\/]* | ?:[\\/]* )  # Absolute path. +    ac_srcdir=$srcdir$ac_dir_suffix; +    ac_top_srcdir=$srcdir ;; +  *) # Relative path. +    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix +    ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + +  case $INSTALL in +  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; +  *) ac_INSTALL=$ac_top_builddir$INSTALL ;; +  esac + +  if test x"$ac_file" != x-; then +    { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} +    rm -f "$ac_file" +  fi +  # Let's still pretend it is `configure' which instantiates (i.e., don't +  # use $as_me), people would be surprised to read: +  #    /* config.h.  Generated by config.status.  */ +  if test x"$ac_file" = x-; then +    configure_input= +  else +    configure_input="$ac_file.  " +  fi +  configure_input=$configure_input"Generated from `echo $ac_file_in | +                                     sed 's,.*/,,'` by configure." + +  # First look for the input files in the build tree, otherwise in the +  # src tree. +  ac_file_inputs=`IFS=: +    for f in $ac_file_in; do +      case $f in +      -) echo $tmp/stdin ;; +      [\\/$]*) +         # Absolute (can't be DOS-style, as IFS=:) +         test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} +   { (exit 1); exit 1; }; } +         echo $f;; +      *) # Relative +         if test -f "$f"; then +           # Build tree +           echo $f +         elif test -f "$srcdir/$f"; then +           # Source tree +           echo $srcdir/$f +         else +           # /dev/null tree +           { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} +   { (exit 1); exit 1; }; } +         fi;; +      esac +    done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +  sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out +  rm -f $tmp/stdin +  if test x"$ac_file" != x-; then +    mv $tmp/out $ac_file +  else +    cat $tmp/out +    rm -f $tmp/out +  fi + +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded.  So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status.  When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then +  ac_cs_success=: +  ac_config_status_args= +  test "$silent" = yes && +    ac_config_status_args="$ac_config_status_args --quiet" +  exec 5>/dev/null +  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false +  exec 5>>config.log +  # Use ||, not &&, to avoid exiting from the if with $? = 1, which +  # would make configure fail if this is the last instruction. +  $ac_cs_success || { (exit 1); exit 1; } +fi + + diff --git a/toolchain/elf2flt/elf2flt/configure.in b/toolchain/elf2flt/elf2flt/configure.in new file mode 100644 index 000000000..b0335d77c --- /dev/null +++ b/toolchain/elf2flt/elf2flt/configure.in @@ -0,0 +1,114 @@ +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_ENABLE(got-check, +	[ --disable-got-check - disable check for GOT (needed on H8) ], +	[ got_check=$enableval ], +	[ got_check=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 + +if test "$ac_libbfd" = "NONE" -o "$ac_libiberty" = "NONE" ; then +	echo +	echo "You need to specify the location of the libfd.a and libiberty.a" +	echo "host libraries from the binutils package." +	echo +	echo "Run configure again specifying these options:" +	echo +	echo "  ./configure --target=<ARCH> --with-bfd-include-dir=<dir> --with-libbfd=<libbfd.a> --with-libiberty=<libiberty.a>" +	echo +	exit 1 +fi + +if test "$ac_bfd_include_dir" = "NONE" ; then +	echo +	echo "You need to specify the location of the bfd.h header from a" +	echo "configured/compiled version of the binutils package for your target." +	echo "Without this your elf2flt may crash as it will try to use the" +	echo "systems bfd.h which may be from a different binutils package." +	echo +	echo "Run configure again specifying these options:" +	echo +	echo "  ./configure --target=<ARCH> --with-bfd-include-dir=<dir> --with-libbfd=<libbfd.a> --with-libiberty=<libiberty.a>" +	echo +	exit 1 +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(got_check) + +AC_OUTPUT(Makefile ld-elf2flt) + diff --git a/toolchain/elf2flt/elf2flt/cygwin-elf.h b/toolchain/elf2flt/elf2flt/cygwin-elf.h new file mode 100644 index 000000000..2523c0e04 --- /dev/null +++ b/toolchain/elf2flt/elf2flt/cygwin-elf.h @@ -0,0 +1,2171 @@ +/* This file defines standard ELF types, structures, and macros. +   Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. +   This file is part of the GNU C Library. + +   The GNU C Library is free software; you can redistribute it and/or +   modify it under the terms of the GNU Lesser General Public +   License as published by the Free Software Foundation; either +   version 2.1 of the License, or (at your option) any later version. + +   The GNU C Library 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 +   Lesser General Public License for more details. + +   You should have received a copy of the GNU Lesser General Public +   License along with the GNU C Library; if not, write to the Free +   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +   02111-1307 USA.  */ + +#ifndef _ELF_H +#define	_ELF_H 1 + +#if	defined(__MINGW32__) +#include <stdint.h> +typedef uint16_t u_int16_t; +typedef uint32_t u_int32_t; +typedef uint64_t u_int64_t; +#else +#include <features.h> +#endif +/* Standard ELF types.  */ + +#include <sys/types.h> + +/* Type for a 16-bit quantity.  */ +typedef u_int16_t Elf32_Half; +typedef u_int16_t Elf64_Half; + +/* Types for signed and unsigned 32-bit quantities.  */ +typedef u_int32_t Elf32_Word; +typedef	int32_t  Elf32_Sword; +typedef u_int32_t Elf64_Word; +typedef	int32_t  Elf64_Sword; + +/* Types for signed and unsigned 64-bit quantities.  */ +typedef u_int64_t Elf32_Xword; +typedef	int64_t  Elf32_Sxword; +typedef u_int64_t Elf64_Xword; +typedef	int64_t  Elf64_Sxword; + +/* Type of addresses.  */ +typedef u_int32_t Elf32_Addr; +typedef u_int64_t Elf64_Addr; + +/* Type of file offsets.  */ +typedef u_int32_t Elf32_Off; +typedef u_int64_t Elf64_Off; + +/* Type for section indices, which are 16-bit quantities.  */ +typedef u_int16_t Elf32_Section; +typedef u_int16_t Elf64_Section; + +/* Type for version symbol information.  */ +typedef Elf32_Half Elf32_Versym; +typedef Elf64_Half Elf64_Versym; + + +/* The ELF file header.  This appears at the start of every ELF file.  */ + +#define EI_NIDENT (16) + +typedef struct +{ +  unsigned char	e_ident[EI_NIDENT];	/* Magic number and other info */ +  Elf32_Half	e_type;			/* Object file type */ +  Elf32_Half	e_machine;		/* Architecture */ +  Elf32_Word	e_version;		/* Object file version */ +  Elf32_Addr	e_entry;		/* Entry point virtual address */ +  Elf32_Off	e_phoff;		/* Program header table file offset */ +  Elf32_Off	e_shoff;		/* Section header table file offset */ +  Elf32_Word	e_flags;		/* Processor-specific flags */ +  Elf32_Half	e_ehsize;		/* ELF header size in bytes */ +  Elf32_Half	e_phentsize;		/* Program header table entry size */ +  Elf32_Half	e_phnum;		/* Program header table entry count */ +  Elf32_Half	e_shentsize;		/* Section header table entry size */ +  Elf32_Half	e_shnum;		/* Section header table entry count */ +  Elf32_Half	e_shstrndx;		/* Section header string table index */ +} Elf32_Ehdr; + +typedef struct +{ +  unsigned char	e_ident[EI_NIDENT];	/* Magic number and other info */ +  Elf64_Half	e_type;			/* Object file type */ +  Elf64_Half	e_machine;		/* Architecture */ +  Elf64_Word	e_version;		/* Object file version */ +  Elf64_Addr	e_entry;		/* Entry point virtual address */ +  Elf64_Off	e_phoff;		/* Program header table file offset */ +  Elf64_Off	e_shoff;		/* Section header table file offset */ +  Elf64_Word	e_flags;		/* Processor-specific flags */ +  Elf64_Half	e_ehsize;		/* ELF header size in bytes */ +  Elf64_Half	e_phentsize;		/* Program header table entry size */ +  Elf64_Half	e_phnum;		/* Program header table entry count */ +  Elf64_Half	e_shentsize;		/* Section header table entry size */ +  Elf64_Half	e_shnum;		/* Section header table entry count */ +  Elf64_Half	e_shstrndx;		/* Section header string table index */ +} Elf64_Ehdr; + +/* Fields in the e_ident array.  The EI_* macros are indices into the +   array.  The macros under each EI_* macro are the values the byte +   may have.  */ + +#define EI_MAG0		0		/* File identification byte 0 index */ +#define ELFMAG0		0x7f		/* Magic number byte 0 */ + +#define EI_MAG1		1		/* File identification byte 1 index */ +#define ELFMAG1		'E'		/* Magic number byte 1 */ + +#define EI_MAG2		2		/* File identification byte 2 index */ +#define ELFMAG2		'L'		/* Magic number byte 2 */ + +#define EI_MAG3		3		/* File identification byte 3 index */ +#define ELFMAG3		'F'		/* Magic number byte 3 */ + +/* Conglomeration of the identification bytes, for easy testing as a word.  */ +#define	ELFMAG		"\177ELF" +#define	SELFMAG		4 + +#define EI_CLASS	4		/* File class byte index */ +#define ELFCLASSNONE	0		/* Invalid class */ +#define ELFCLASS32	1		/* 32-bit objects */ +#define ELFCLASS64	2		/* 64-bit objects */ +#define ELFCLASSNUM	3 + +#define EI_DATA		5		/* Data encoding byte index */ +#define ELFDATANONE	0		/* Invalid data encoding */ +#define ELFDATA2LSB	1		/* 2's complement, little endian */ +#define ELFDATA2MSB	2		/* 2's complement, big endian */ +#define ELFDATANUM	3 + +#define EI_VERSION	6		/* File version byte index */ +					/* Value must be EV_CURRENT */ + +#define EI_OSABI	7		/* OS ABI identification */ +#define ELFOSABI_SYSV		0	/* UNIX System V ABI */ +#define ELFOSABI_HPUX		1	/* HP-UX */ +#define ELFOSABI_ARM		97	/* ARM */ +#define ELFOSABI_STANDALONE	255	/* Standalone (embedded) application */ + +#define EI_ABIVERSION	8		/* ABI version */ + +#define EI_PAD		9		/* Byte index of padding bytes */ + +/* Legal values for e_type (object file type).  */ + +#define ET_NONE		0		/* No file type */ +#define ET_REL		1		/* Relocatable file */ +#define ET_EXEC		2		/* Executable file */ +#define ET_DYN		3		/* Shared object file */ +#define ET_CORE		4		/* Core file */ +#define	ET_NUM		5		/* Number of defined types */ +#define ET_LOOS		0xfe00		/* OS-specific range start */ +#define ET_HIOS		0xfeff		/* OS-specific range end */ +#define ET_LOPROC	0xff00		/* Processor-specific range start */ +#define ET_HIPROC	0xffff		/* Processor-specific range end */ + +/* Legal values for e_machine (architecture).  */ + +#define EM_NONE		 0		/* No machine */ +#define EM_M32		 1		/* AT&T WE 32100 */ +#define EM_SPARC	 2		/* SUN SPARC */ +#define EM_386		 3		/* Intel 80386 */ +#define EM_68K		 4		/* Motorola m68k family */ +#define EM_88K		 5		/* Motorola m88k family */ +#define EM_860		 7		/* Intel 80860 */ +#define EM_MIPS		 8		/* MIPS R3000 big-endian */ +#define EM_S370		 9		/* IBM System/370 */ +#define EM_MIPS_RS3_LE	10		/* MIPS R3000 little-endian */ + +#define EM_PARISC	15		/* HPPA */ +#define EM_VPP500	17		/* Fujitsu VPP500 */ +#define EM_SPARC32PLUS	18		/* Sun's "v8plus" */ +#define EM_960		19		/* Intel 80960 */ +#define EM_PPC		20		/* PowerPC */ +#define EM_PPC64	21		/* PowerPC 64-bit */ +#define EM_S390		22		/* IBM S390 */ + +#define EM_V800		36		/* NEC V800 series */ +#define EM_FR20		37		/* Fujitsu FR20 */ +#define EM_RH32		38		/* TRW RH-32 */ +#define EM_RCE		39		/* Motorola RCE */ +#define EM_ARM		40		/* ARM */ +#define EM_FAKE_ALPHA	41		/* Digital Alpha */ +#define EM_SH		42		/* Hitachi SH */ +#define EM_SPARCV9	43		/* SPARC v9 64-bit */ +#define EM_TRICORE	44		/* Siemens Tricore */ +#define EM_ARC		45		/* Argonaut RISC Core */ +#define EM_H8_300	46		/* Hitachi H8/300 */ +#define EM_H8_300H	47		/* Hitachi H8/300H */ +#define EM_H8S		48		/* Hitachi H8S */ +#define EM_H8_500	49		/* Hitachi H8/500 */ +#define EM_IA_64	50		/* Intel Merced */ +#define EM_MIPS_X	51		/* Stanford MIPS-X */ +#define EM_COLDFIRE	52		/* Motorola Coldfire */ +#define EM_68HC12	53		/* Motorola M68HC12 */ +#define EM_MMA		54		/* Fujitsu MMA Multimedia Accelerator*/ +#define EM_PCP		55		/* Siemens PCP */ +#define EM_NCPU		56		/* Sony nCPU embeeded RISC */ +#define EM_NDR1		57		/* Denso NDR1 microprocessor */ +#define EM_STARCORE	58		/* Motorola Start*Core processor */ +#define EM_ME16		59		/* Toyota ME16 processor */ +#define EM_ST100	60		/* STMicroelectronic ST100 processor */ +#define EM_TINYJ	61		/* Advanced Logic Corp. Tinyj emb.fam*/ +#define EM_X86_64	62		/* AMD x86-64 architecture */ +#define EM_PDSP		63		/* Sony DSP Processor */ + +#define EM_FX66		66		/* Siemens FX66 microcontroller */ +#define EM_ST9PLUS	67		/* STMicroelectronics ST9+ 8/16 mc */ +#define EM_ST7		68		/* STmicroelectronics ST7 8 bit mc */ +#define EM_68HC16	69		/* Motorola MC68HC16 microcontroller */ +#define EM_68HC11	70		/* Motorola MC68HC11 microcontroller */ +#define EM_68HC08	71		/* Motorola MC68HC08 microcontroller */ +#define EM_68HC05	72		/* Motorola MC68HC05 microcontroller */ +#define EM_SVX		73		/* Silicon Graphics SVx */ +#define EM_AT19		74		/* STMicroelectronics ST19 8 bit mc */ +#define EM_VAX		75		/* Digital VAX */ +#define EM_CRIS		76		/* Axis Communications 32-bit embedded processor */ +#define EM_JAVELIN	77		/* Infineon Technologies 32-bit embedded processor */ +#define EM_FIREPATH	78		/* Element 14 64-bit DSP Processor */ +#define EM_ZSP		79		/* LSI Logic 16-bit DSP Processor */ +#define EM_MMIX		80		/* Donald Knuth's educational 64-bit processor */ +#define EM_HUANY	81		/* Harvard University machine-independent object files */ +#define EM_PRISM	82		/* SiTera Prism */ +#define EM_AVR		83		/* Atmel AVR 8-bit microcontroller */ +#define EM_FR30		84		/* Fujitsu FR30 */ +#define EM_D10V		85		/* Mitsubishi D10V */ +#define EM_D30V		86		/* Mitsubishi D30V */ +#define EM_V850		87		/* NEC v850 */ +#define EM_M32R		88		/* Mitsubishi M32R */ +#define EM_MN10300	89		/* Matsushita MN10300 */ +#define EM_MN10200	90		/* Matsushita MN10200 */ +#define EM_PJ		91		/* picoJava */ +#define EM_OPENRISC	92		/* OpenRISC 32-bit embedded processor */ +#define EM_ARC_A5	93		/* ARC Cores Tangent-A5 */ +#define EM_XTENSA	94		/* Tensilica Xtensa Architecture */ +#define EM_NUM		95 + +/* If it is necessary to assign new unofficial EM_* values, please +   pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the +   chances of collision with official or non-GNU unofficial values.  */ + +#define EM_ALPHA	0x9026 + +/* Legal values for e_version (version).  */ + +#define EV_NONE		0		/* Invalid ELF version */ +#define EV_CURRENT	1		/* Current version */ +#define EV_NUM		2 + +/* Section header.  */ + +typedef struct +{ +  Elf32_Word	sh_name;		/* Section name (string tbl index) */ +  Elf32_Word	sh_type;		/* Section type */ +  Elf32_Word	sh_flags;		/* Section flags */ +  Elf32_Addr	sh_addr;		/* Section virtual addr at execution */ +  Elf32_Off	sh_offset;		/* Section file offset */ +  Elf32_Word	sh_size;		/* Section size in bytes */ +  Elf32_Word	sh_link;		/* Link to another section */ +  Elf32_Word	sh_info;		/* Additional section information */ +  Elf32_Word	sh_addralign;		/* Section alignment */ +  Elf32_Word	sh_entsize;		/* Entry size if section holds table */ +} Elf32_Shdr; + +typedef struct +{ +  Elf64_Word	sh_name;		/* Section name (string tbl index) */ +  Elf64_Word	sh_type;		/* Section type */ +  Elf64_Xword	sh_flags;		/* Section flags */ +  Elf64_Addr	sh_addr;		/* Section virtual addr at execution */ +  Elf64_Off	sh_offset;		/* Section file offset */ +  Elf64_Xword	sh_size;		/* Section size in bytes */ +  Elf64_Word	sh_link;		/* Link to another section */ +  Elf64_Word	sh_info;		/* Additional section information */ +  Elf64_Xword	sh_addralign;		/* Section alignment */ +  Elf64_Xword	sh_entsize;		/* Entry size if section holds table */ +} Elf64_Shdr; + +/* Special section indices.  */ + +#define SHN_UNDEF	0		/* Undefined section */ +#define SHN_LORESERVE	0xff00		/* Start of reserved indices */ +#define SHN_LOPROC	0xff00		/* Start of processor-specific */ +#define SHN_HIPROC	0xff1f		/* End of processor-specific */ +#define SHN_LOOS	0xff20		/* Start of OS-specific */ +#define SHN_HIOS	0xff3f		/* End of OS-specific */ +#define SHN_ABS		0xfff1		/* Associated symbol is absolute */ +#define SHN_COMMON	0xfff2		/* Associated symbol is common */ +#define SHN_XINDEX	0xffff		/* Index is in extra table.  */ +#define SHN_HIRESERVE	0xffff		/* End of reserved indices */ + +/* Legal values for sh_type (section type).  */ + +#define SHT_NULL	  0		/* Section header table entry unused */ +#define SHT_PROGBITS	  1		/* Program data */ +#define SHT_SYMTAB	  2		/* Symbol table */ +#define SHT_STRTAB	  3		/* String table */ +#define SHT_RELA	  4		/* Relocation entries with addends */ +#define SHT_HASH	  5		/* Symbol hash table */ +#define SHT_DYNAMIC	  6		/* Dynamic linking information */ +#define SHT_NOTE	  7		/* Notes */ +#define SHT_NOBITS	  8		/* Program space with no data (bss) */ +#define SHT_REL		  9		/* Relocation entries, no addends */ +#define SHT_SHLIB	  10		/* Reserved */ +#define SHT_DYNSYM	  11		/* Dynamic linker symbol table */ +#define SHT_INIT_ARRAY	  14		/* Array of constructors */ +#define SHT_FINI_ARRAY	  15		/* Array of destructors */ +#define SHT_PREINIT_ARRAY 16		/* Array of pre-constructors */ +#define SHT_GROUP	  17		/* Section group */ +#define SHT_SYMTAB_SHNDX  18		/* Extended section indeces */ +#define	SHT_NUM		  19		/* Number of defined types.  */ +#define SHT_LOOS	  0x60000000	/* Start OS-specific */ +#define SHT_CHECKSUM	  0x6ffffff8	/* Checksum for DSO content.  */ +#define SHT_LOSUNW	  0x6ffffffa	/* Sun-specific low bound.  */ +#define SHT_SUNW_move	  0x6ffffffa +#define SHT_SUNW_COMDAT   0x6ffffffb +#define SHT_SUNW_syminfo  0x6ffffffc +#define SHT_GNU_verdef	  0x6ffffffd	/* Version definition section.  */ +#define SHT_GNU_verneed	  0x6ffffffe	/* Version needs section.  */ +#define SHT_GNU_versym	  0x6fffffff	/* Version symbol table.  */ +#define SHT_HISUNW	  0x6fffffff	/* Sun-specific high bound.  */ +#define SHT_HIOS	  0x6fffffff	/* End OS-specific type */ +#define SHT_LOPROC	  0x70000000	/* Start of processor-specific */ +#define SHT_HIPROC	  0x7fffffff	/* End of processor-specific */ +#define SHT_LOUSER	  0x80000000	/* Start of application-specific */ +#define SHT_HIUSER	  0x8fffffff	/* End of application-specific */ + +/* Legal values for sh_flags (section flags).  */ + +#define SHF_WRITE	     (1 << 0)	/* Writable */ +#define SHF_ALLOC	     (1 << 1)	/* Occupies memory during execution */ +#define SHF_EXECINSTR	     (1 << 2)	/* Executable */ +#define SHF_MERGE	     (1 << 4)	/* Might be merged */ +#define SHF_STRINGS	     (1 << 5)	/* Contains nul-terminated strings */ +#define SHF_INFO_LINK	     (1 << 6)	/* `sh_info' contains SHT index */ +#define SHF_LINK_ORDER	     (1 << 7)	/* Preserve order after combining */ +#define SHF_OS_NONCONFORMING (1 << 8)	/* Non-standard OS specific handling +					   required */ +#define SHF_MASKOS	     0x0ff00000	/* OS-specific.  */ +#define SHF_MASKPROC	     0xf0000000	/* Processor-specific */ + +/* Section group handling.  */ +#define GRP_COMDAT	0x1		/* Mark group as COMDAT.  */ + +/* Symbol table entry.  */ + +typedef struct +{ +  Elf32_Word	st_name;		/* Symbol name (string tbl index) */ +  Elf32_Addr	st_value;		/* Symbol value */ +  Elf32_Word	st_size;		/* Symbol size */ +  unsigned char	st_info;		/* Symbol type and binding */ +  unsigned char	st_other;		/* Symbol visibility */ +  Elf32_Section	st_shndx;		/* Section index */ +} Elf32_Sym; + +typedef struct +{ +  Elf64_Word	st_name;		/* Symbol name (string tbl index) */ +  unsigned char	st_info;		/* Symbol type and binding */ +  unsigned char st_other;		/* Symbol visibility */ +  Elf64_Section	st_shndx;		/* Section index */ +  Elf64_Addr	st_value;		/* Symbol value */ +  Elf64_Xword	st_size;		/* Symbol size */ +} Elf64_Sym; + +/* The syminfo section if available contains additional information about +   every dynamic symbol.  */ + +typedef struct +{ +  Elf32_Half si_boundto;		/* Direct bindings, symbol bound to */ +  Elf32_Half si_flags;			/* Per symbol flags */ +} Elf32_Syminfo; + +typedef struct +{ +  Elf64_Half si_boundto;		/* Direct bindings, symbol bound to */ +  Elf64_Half si_flags;			/* Per symbol flags */ +} Elf64_Syminfo; + +/* Possible values for si_boundto.  */ +#define SYMINFO_BT_SELF		0xffff	/* Symbol bound to self */ +#define SYMINFO_BT_PARENT	0xfffe	/* Symbol bound to parent */ +#define SYMINFO_BT_LOWRESERVE	0xff00	/* Beginning of reserved entries */ + +/* Possible bitmasks for si_flags.  */ +#define SYMINFO_FLG_DIRECT	0x0001	/* Direct bound symbol */ +#define SYMINFO_FLG_PASSTHRU	0x0002	/* Pass-thru symbol for translator */ +#define SYMINFO_FLG_COPY	0x0004	/* Symbol is a copy-reloc */ +#define SYMINFO_FLG_LAZYLOAD	0x0008	/* Symbol bound to object to be lazy +					   loaded */ +/* Syminfo version values.  */ +#define SYMINFO_NONE		0 +#define SYMINFO_CURRENT		1 +#define SYMINFO_NUM		2 + + +/* Special section index.  */ + +#define SHN_UNDEF	0		/* No section, undefined symbol.  */ + +/* How to extract and insert information held in the st_info field.  */ + +#define ELF32_ST_BIND(val)		(((unsigned char) (val)) >> 4) +#define ELF32_ST_TYPE(val)		((val) & 0xf) +#define ELF32_ST_INFO(bind, type)	(((bind) << 4) + ((type) & 0xf)) + +/* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field.  */ +#define ELF64_ST_BIND(val)		ELF32_ST_BIND (val) +#define ELF64_ST_TYPE(val)		ELF32_ST_TYPE (val) +#define ELF64_ST_INFO(bind, type)	ELF32_ST_INFO ((bind), (type)) + +/* Legal values for ST_BIND subfield of st_info (symbol binding).  */ + +#define STB_LOCAL	0		/* Local symbol */ +#define STB_GLOBAL	1		/* Global symbol */ +#define STB_WEAK	2		/* Weak symbol */ +#define	STB_NUM		3		/* Number of defined types.  */ +#define STB_LOOS	10		/* Start of OS-specific */ +#define STB_HIOS	12		/* End of OS-specific */ +#define STB_LOPROC	13		/* Start of processor-specific */ +#define STB_HIPROC	15		/* End of processor-specific */ + +/* Legal values for ST_TYPE subfield of st_info (symbol type).  */ + +#define STT_NOTYPE	0		/* Symbol type is unspecified */ +#define STT_OBJECT	1		/* Symbol is a data object */ +#define STT_FUNC	2		/* Symbol is a code object */ +#define STT_SECTION	3		/* Symbol associated with a section */ +#define STT_FILE	4		/* Symbol's name is file name */ +#define STT_COMMON	5		/* Symbol is a common data object */ +#define	STT_NUM		6		/* Number of defined types.  */ +#define STT_LOOS	10		/* Start of OS-specific */ +#define STT_HIOS	12		/* End of OS-specific */ +#define STT_LOPROC	13		/* Start of processor-specific */ +#define STT_HIPROC	15		/* End of processor-specific */ + + +/* Symbol table indices are found in the hash buckets and chain table +   of a symbol hash table section.  This special index value indicates +   the end of a chain, meaning no further symbols are found in that bucket.  */ + +#define STN_UNDEF	0		/* End of a chain.  */ + + +/* How to extract and insert information held in the st_other field.  */ + +#define ELF32_ST_VISIBILITY(o)	((o) & 0x03) + +/* For ELF64 the definitions are the same.  */ +#define ELF64_ST_VISIBILITY(o)	ELF32_ST_VISIBILITY (o) + +/* Symbol visibility specification encoded in the st_other field.  */ +#define STV_DEFAULT	0		/* Default symbol visibility rules */ +#define STV_INTERNAL	1		/* Processor specific hidden class */ +#define STV_HIDDEN	2		/* Sym unavailable in other modules */ +#define STV_PROTECTED	3		/* Not preemptible, not exported */ + + +/* Relocation table entry without addend (in section of type SHT_REL).  */ + +typedef struct +{ +  Elf32_Addr	r_offset;		/* Address */ +  Elf32_Word	r_info;			/* Relocation type and symbol index */ +} Elf32_Rel; + +/* I have seen two different definitions of the Elf64_Rel and +   Elf64_Rela structures, so we'll leave them out until Novell (or +   whoever) gets their act together.  */ +/* The following, at least, is used on Sparc v9, MIPS, and Alpha.  */ + +typedef struct +{ +  Elf64_Addr	r_offset;		/* Address */ +  Elf64_Xword	r_info;			/* Relocation type and symbol index */ +} Elf64_Rel; + +/* Relocation table entry with addend (in section of type SHT_RELA).  */ + +typedef struct +{ +  Elf32_Addr	r_offset;		/* Address */ +  Elf32_Word	r_info;			/* Relocation type and symbol index */ +  Elf32_Sword	r_addend;		/* Addend */ +} Elf32_Rela; + +typedef struct +{ +  Elf64_Addr	r_offset;		/* Address */ +  Elf64_Xword	r_info;			/* Relocation type and symbol index */ +  Elf64_Sxword	r_addend;		/* Addend */ +} Elf64_Rela; + +/* How to extract and insert information held in the r_info field.  */ + +#define ELF32_R_SYM(val)		((val) >> 8) +#define ELF32_R_TYPE(val)		((val) & 0xff) +#define ELF32_R_INFO(sym, type)		(((sym) << 8) + ((type) & 0xff)) + +#define ELF64_R_SYM(i)			((i) >> 32) +#define ELF64_R_TYPE(i)			((i) & 0xffffffff) +#define ELF64_R_INFO(sym,type)		((((Elf64_Xword) (sym)) << 32) + (type)) + +/* Program segment header.  */ + +typedef struct +{ +  Elf32_Word	p_type;			/* Segment type */ +  Elf32_Off	p_offset;		/* Segment file offset */ +  Elf32_Addr	p_vaddr;		/* Segment virtual address */ +  Elf32_Addr	p_paddr;		/* Segment physical address */ +  Elf32_Word	p_filesz;		/* Segment size in file */ +  Elf32_Word	p_memsz;		/* Segment size in memory */ +  Elf32_Word	p_flags;		/* Segment flags */ +  Elf32_Word	p_align;		/* Segment alignment */ +} Elf32_Phdr; + +typedef struct +{ +  Elf64_Word	p_type;			/* Segment type */ +  Elf64_Word	p_flags;		/* Segment flags */ +  Elf64_Off	p_offset;		/* Segment file offset */ +  Elf64_Addr	p_vaddr;		/* Segment virtual address */ +  Elf64_Addr	p_paddr;		/* Segment physical address */ +  Elf64_Xword	p_filesz;		/* Segment size in file */ +  Elf64_Xword	p_memsz;		/* Segment size in memory */ +  Elf64_Xword	p_align;		/* Segment alignment */ +} Elf64_Phdr; + +/* Legal values for p_type (segment type).  */ + +#define	PT_NULL		0		/* Program header table entry unused */ +#define PT_LOAD		1		/* Loadable program segment */ +#define PT_DYNAMIC	2		/* Dynamic linking information */ +#define PT_INTERP	3		/* Program interpreter */ +#define PT_NOTE		4		/* Auxiliary information */ +#define PT_SHLIB	5		/* Reserved */ +#define PT_PHDR		6		/* Entry for header table itself */ +#define	PT_NUM		7		/* Number of defined types */ +#define PT_LOOS		0x60000000	/* Start of OS-specific */ +#define PT_HIOS		0x6fffffff	/* End of OS-specific */ +#define PT_LOPROC	0x70000000	/* Start of processor-specific */ +#define PT_HIPROC	0x7fffffff	/* End of processor-specific */ + +/* Legal values for p_flags (segment flags).  */ + +#define PF_X		(1 << 0)	/* Segment is executable */ +#define PF_W		(1 << 1)	/* Segment is writable */ +#define PF_R		(1 << 2)	/* Segment is readable */ +#define PF_MASKOS	0x0ff00000	/* OS-specific */ +#define PF_MASKPROC	0xf0000000	/* Processor-specific */ + +/* Legal values for note segment descriptor types for core files. */ + +#define NT_PRSTATUS	1		/* Contains copy of prstatus struct */ +#define NT_FPREGSET	2		/* Contains copy of fpregset struct */ +#define NT_PRPSINFO	3		/* Contains copy of prpsinfo struct */ +#define NT_PRXREG	4		/* Contains copy of prxregset struct */ +#define NT_PLATFORM	5		/* String from sysinfo(SI_PLATFORM) */ +#define NT_AUXV		6		/* Contains copy of auxv array */ +#define NT_GWINDOWS	7		/* Contains copy of gwindows struct */ +#define NT_PSTATUS	10		/* Contains copy of pstatus struct */ +#define NT_PSINFO	13		/* Contains copy of psinfo struct */ +#define NT_PRCRED	14		/* Contains copy of prcred struct */ +#define NT_UTSNAME	15		/* Contains copy of utsname struct */ +#define NT_LWPSTATUS	16		/* Contains copy of lwpstatus struct */ +#define NT_LWPSINFO	17		/* Contains copy of lwpinfo struct */ +#define NT_PRFPXREG	20		/* Contains copy of fprxregset struct*/ + +/* Legal values for the note segment descriptor types for object files.  */ + +#define NT_VERSION	1		/* Contains a version string.  */ + + +/* Dynamic section entry.  */ + +typedef struct +{ +  Elf32_Sword	d_tag;			/* Dynamic entry type */ +  union +    { +      Elf32_Word d_val;			/* Integer value */ +      Elf32_Addr d_ptr;			/* Address value */ +    } d_un; +} Elf32_Dyn; + +typedef struct +{ +  Elf64_Sxword	d_tag;			/* Dynamic entry type */ +  union +    { +      Elf64_Xword d_val;		/* Integer value */ +      Elf64_Addr d_ptr;			/* Address value */ +    } d_un; +} Elf64_Dyn; + +/* Legal values for d_tag (dynamic entry type).  */ + +#define DT_NULL		0		/* Marks end of dynamic section */ +#define DT_NEEDED	1		/* Name of needed library */ +#define DT_PLTRELSZ	2		/* Size in bytes of PLT relocs */ +#define DT_PLTGOT	3		/* Processor defined value */ +#define DT_HASH		4		/* Address of symbol hash table */ +#define DT_STRTAB	5		/* Address of string table */ +#define DT_SYMTAB	6		/* Address of symbol table */ +#define DT_RELA		7		/* Address of Rela relocs */ +#define DT_RELASZ	8		/* Total size of Rela relocs */ +#define DT_RELAENT	9		/* Size of one Rela reloc */ +#define DT_STRSZ	10		/* Size of string table */ +#define DT_SYMENT	11		/* Size of one symbol table entry */ +#define DT_INIT		12		/* Address of init function */ +#define DT_FINI		13		/* Address of termination function */ +#define DT_SONAME	14		/* Name of shared object */ +#define DT_RPATH	15		/* Library search path (deprecated) */ +#define DT_SYMBOLIC	16		/* Start symbol search here */ +#define DT_REL		17		/* Address of Rel relocs */ +#define DT_RELSZ	18		/* Total size of Rel relocs */ +#define DT_RELENT	19		/* Size of one Rel reloc */ +#define DT_PLTREL	20		/* Type of reloc in PLT */ +#define DT_DEBUG	21		/* For debugging; unspecified */ +#define DT_TEXTREL	22		/* Reloc might modify .text */ +#define DT_JMPREL	23		/* Address of PLT relocs */ +#define	DT_BIND_NOW	24		/* Process relocations of object */ +#define	DT_INIT_ARRAY	25		/* Array with addresses of init fct */ +#define	DT_FINI_ARRAY	26		/* Array with addresses of fini fct */ +#define	DT_INIT_ARRAYSZ	27		/* Size in bytes of DT_INIT_ARRAY */ +#define	DT_FINI_ARRAYSZ	28		/* Size in bytes of DT_FINI_ARRAY */ +#define DT_RUNPATH	29		/* Library search path */ +#define DT_FLAGS	30		/* Flags for the object being loaded */ +#define DT_ENCODING	32		/* Start of encoded range */ +#define DT_PREINIT_ARRAY 32		/* Array with addresses of preinit fct*/ +#define DT_PREINIT_ARRAYSZ 33		/* size in bytes of DT_PREINIT_ARRAY */ +#define	DT_NUM		34		/* Number used */ +#define DT_LOOS		0x60000000	/* Start of OS-specific */ +#define DT_HIOS		0x6fffffff	/* End of OS-specific */ +#define DT_LOPROC	0x70000000	/* Start of processor-specific */ +#define DT_HIPROC	0x7fffffff	/* End of processor-specific */ +#define	DT_PROCNUM	DT_MIPS_NUM	/* Most used by any processor */ + +/* DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the +   Dyn.d_un.d_val field of the Elf*_Dyn structure.  This follows Sun's +   approach.  */ +#define DT_VALRNGLO	0x6ffffd00 +#define DT_CHECKSUM	0x6ffffdf8 +#define DT_PLTPADSZ	0x6ffffdf9 +#define DT_MOVEENT	0x6ffffdfa +#define DT_MOVESZ	0x6ffffdfb +#define DT_FEATURE_1	0x6ffffdfc	/* Feature selection (DTF_*).  */ +#define DT_POSFLAG_1	0x6ffffdfd	/* Flags for DT_* entries, effecting +					   the following DT_* entry.  */ +#define DT_SYMINSZ	0x6ffffdfe	/* Size of syminfo table (in bytes) */ +#define DT_SYMINENT	0x6ffffdff	/* Entry size of syminfo */ +#define DT_VALRNGHI	0x6ffffdff + +/* DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the +   Dyn.d_un.d_ptr field of the Elf*_Dyn structure. + +   If any adjustment is made to the ELF object after it has been +   built these entries will need to be adjusted.  */ +#define DT_ADDRRNGLO	0x6ffffe00 +#define DT_CONFIG	0x6ffffefa	/* Configuration information.  */ +#define DT_DEPAUDIT	0x6ffffefb	/* Dependency auditing.  */ +#define DT_AUDIT	0x6ffffefc	/* Object auditing.  */ +#define	DT_PLTPAD	0x6ffffefd	/* PLT padding.  */ +#define	DT_MOVETAB	0x6ffffefe	/* Move table.  */ +#define DT_SYMINFO	0x6ffffeff	/* Syminfo table.  */ +#define DT_ADDRRNGHI	0x6ffffeff + +/* The versioning entry types.  The next are defined as part of the +   GNU extension.  */ +#define DT_VERSYM	0x6ffffff0 + +#define DT_RELACOUNT	0x6ffffff9 +#define DT_RELCOUNT	0x6ffffffa + +/* These were chosen by Sun.  */ +#define DT_FLAGS_1	0x6ffffffb	/* State flags, see DF_1_* below.  */ +#define	DT_VERDEF	0x6ffffffc	/* Address of version definition +					   table */ +#define	DT_VERDEFNUM	0x6ffffffd	/* Number of version definitions */ +#define	DT_VERNEED	0x6ffffffe	/* Address of table with needed +					   versions */ +#define	DT_VERNEEDNUM	0x6fffffff	/* Number of needed versions */ +#define DT_VERSIONTAGIDX(tag)	(DT_VERNEEDNUM - (tag))	/* Reverse order! */ +#define DT_VERSIONTAGNUM 16 + +/* Sun added these machine-independent extensions in the "processor-specific" +   range.  Be compatible.  */ +#define DT_AUXILIARY    0x7ffffffd      /* Shared object to load before self */ +#define DT_FILTER       0x7fffffff      /* Shared object to get values from */ +#define DT_EXTRATAGIDX(tag)	((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1) +#define DT_EXTRANUM	3 + +/* Values of `d_un.d_val' in the DT_FLAGS entry.  */ +#define DF_ORIGIN	0x00000001	/* Object may use DF_ORIGIN */ +#define DF_SYMBOLIC	0x00000002	/* Symbol resolutions starts here */ +#define DF_TEXTREL	0x00000004	/* Object contains text relocations */ +#define DF_BIND_NOW	0x00000008	/* No lazy binding for this object */ + +/* State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1 +   entry in the dynamic section.  */ +#define DF_1_NOW	0x00000001	/* Set RTLD_NOW for this object.  */ +#define DF_1_GLOBAL	0x00000002	/* Set RTLD_GLOBAL for this object.  */ +#define DF_1_GROUP	0x00000004	/* Set RTLD_GROUP for this object.  */ +#define DF_1_NODELETE	0x00000008	/* Set RTLD_NODELETE for this object.*/ +#define DF_1_LOADFLTR	0x00000010	/* Trigger filtee loading at runtime.*/ +#define DF_1_INITFIRST	0x00000020	/* Set RTLD_INITFIRST for this object*/ +#define DF_1_NOOPEN	0x00000040	/* Set RTLD_NOOPEN for this object.  */ +#define DF_1_ORIGIN	0x00000080	/* $ORIGIN must be handled.  */ +#define DF_1_DIRECT	0x00000100	/* Direct binding enabled.  */ +#define DF_1_TRANS	0x00000200 +#define DF_1_INTERPOSE	0x00000400	/* Object is used to interpose.  */ +#define DF_1_NODEFLIB	0x00000800	/* Ignore default lib search path.  */ +#define DF_1_NODUMP	0x00001000	/* Object can't be dldump'ed.  */ +#define DF_1_CONFALT	0x00002000	/* Configuration alternative created.*/ +#define DF_1_ENDFILTEE	0x00004000	/* Filtee terminates filters search. */ +#define	DF_1_DISPRELDNE	0x00008000	/* Disp reloc applied at build time. */ +#define	DF_1_DISPRELPND	0x00010000	/* Disp reloc applied at run-time.  */ + +/* Flags for the feature selection in DT_FEATURE_1.  */ +#define DTF_1_PARINIT	0x00000001 +#define DTF_1_CONFEXP	0x00000002 + +/* Flags in the DT_POSFLAG_1 entry effecting only the next DT_* entry.  */ +#define DF_P1_LAZYLOAD	0x00000001	/* Lazyload following object.  */ +#define DF_P1_GROUPPERM	0x00000002	/* Symbols from next object are not +					   generally available.  */ + +/* Version definition sections.  */ + +typedef struct +{ +  Elf32_Half	vd_version;		/* Version revision */ +  Elf32_Half	vd_flags;		/* Version information */ +  Elf32_Half	vd_ndx;			/* Version Index */ +  Elf32_Half	vd_cnt;			/* Number of associated aux entries */ +  Elf32_Word	vd_hash;		/* Version name hash value */ +  Elf32_Word	vd_aux;			/* Offset in bytes to verdaux array */ +  Elf32_Word	vd_next;		/* Offset in bytes to next verdef +					   entry */ +} Elf32_Verdef; + +typedef struct +{ +  Elf64_Half	vd_version;		/* Version revision */ +  Elf64_Half	vd_flags;		/* Version information */ +  Elf64_Half	vd_ndx;			/* Version Index */ +  Elf64_Half	vd_cnt;			/* Number of associated aux entries */ +  Elf64_Word	vd_hash;		/* Version name hash value */ +  Elf64_Word	vd_aux;			/* Offset in bytes to verdaux array */ +  Elf64_Word	vd_next;		/* Offset in bytes to next verdef +					   entry */ +} Elf64_Verdef; + + +/* Legal values for vd_version (version revision).  */ +#define VER_DEF_NONE	0		/* No version */ +#define VER_DEF_CURRENT	1		/* Current version */ +#define VER_DEF_NUM	2		/* Given version number */ + +/* Legal values for vd_flags (version information flags).  */ +#define VER_FLG_BASE	0x1		/* Version definition of file itself */ +#define VER_FLG_WEAK	0x2		/* Weak version identifier */ + +/* Versym symbol index values.  */ +#define	VER_NDX_LOCAL		0	/* Symbol is local.  */ +#define	VER_NDX_GLOBAL		1	/* Symbol is global.  */ +#define	VER_NDX_LORESERVE	0xff00	/* Beginning of reserved entries.  */ +#define	VER_NDX_ELIMINATE	0xff01	/* Symbol is to be eliminated.  */ + +/* Auxialiary version information.  */ + +typedef struct +{ +  Elf32_Word	vda_name;		/* Version or dependency names */ +  Elf32_Word	vda_next;		/* Offset in bytes to next verdaux +					   entry */ +} Elf32_Verdaux; + +typedef struct +{ +  Elf64_Word	vda_name;		/* Version or dependency names */ +  Elf64_Word	vda_next;		/* Offset in bytes to next verdaux +					   entry */ +} Elf64_Verdaux; + + +/* Version dependency section.  */ + +typedef struct +{ +  Elf32_Half	vn_version;		/* Version of structure */ +  Elf32_Half	vn_cnt;			/* Number of associated aux entries */ +  Elf32_Word	vn_file;		/* Offset of filename for this +					   dependency */ +  Elf32_Word	vn_aux;			/* Offset in bytes to vernaux array */ +  Elf32_Word	vn_next;		/* Offset in bytes to next verneed +					   entry */ +} Elf32_Verneed; + +typedef struct +{ +  Elf64_Half	vn_version;		/* Version of structure */ +  Elf64_Half	vn_cnt;			/* Number of associated aux entries */ +  Elf64_Word	vn_file;		/* Offset of filename for this +					   dependency */ +  Elf64_Word	vn_aux;			/* Offset in bytes to vernaux array */ +  Elf64_Word	vn_next;		/* Offset in bytes to next verneed +					   entry */ +} Elf64_Verneed; + + +/* Legal values for vn_version (version revision).  */ +#define VER_NEED_NONE	 0		/* No version */ +#define VER_NEED_CURRENT 1		/* Current version */ +#define VER_NEED_NUM	 2		/* Given version number */ + +/* Auxiliary needed version information.  */ + +typedef struct +{ +  Elf32_Word	vna_hash;		/* Hash value of dependency name */ +  Elf32_Half	vna_flags;		/* Dependency specific information */ +  Elf32_Half	vna_other;		/* Unused */ +  Elf32_Word	vna_name;		/* Dependency name string offset */ +  Elf32_Word	vna_next;		/* Offset in bytes to next vernaux +					   entry */ +} Elf32_Vernaux; + +typedef struct +{ +  Elf64_Word	vna_hash;		/* Hash value of dependency name */ +  Elf64_Half	vna_flags;		/* Dependency specific information */ +  Elf64_Half	vna_other;		/* Unused */ +  Elf64_Word	vna_name;		/* Dependency name string offset */ +  Elf64_Word	vna_next;		/* Offset in bytes to next vernaux +					   entry */ +} Elf64_Vernaux; + + +/* Legal values for vna_flags.  */ +#define VER_FLG_WEAK	0x2		/* Weak version identifier */ + + +/* Auxiliary vector.  */ + +/* This vector is normally only used by the program interpreter.  The +   usual definition in an ABI supplement uses the name auxv_t.  The +   vector is not usually defined in a standard <elf.h> file, but it +   can't hurt.  We rename it to avoid conflicts.  The sizes of these +   types are an arrangement between the exec server and the program +   interpreter, so we don't fully specify them here.  */ + +typedef struct +{ +  int a_type;			/* Entry type */ +  union +    { +      long int a_val;		/* Integer value */ +      void *a_ptr;		/* Pointer value */ +      void (*a_fcn) (void);	/* Function pointer value */ +    } a_un; +} Elf32_auxv_t; + +typedef struct +{ +  long int a_type;		/* Entry type */ +  union +    { +      long int a_val;		/* Integer value */ +      void *a_ptr;		/* Pointer value */ +      void (*a_fcn) (void);	/* Function pointer value */ +    } a_un; +} Elf64_auxv_t; + +/* Legal values for a_type (entry type).  */ + +#define AT_NULL		0		/* End of vector */ +#define AT_IGNORE	1		/* Entry should be ignored */ +#define AT_EXECFD	2		/* File descriptor of program */ +#define AT_PHDR		3		/* Program headers for program */ +#define AT_PHENT	4		/* Size of program header entry */ +#define AT_PHNUM	5		/* Number of program headers */ +#define AT_PAGESZ	6		/* System page size */ +#define AT_BASE		7		/* Base address of interpreter */ +#define AT_FLAGS	8		/* Flags */ +#define AT_ENTRY	9		/* Entry point of program */ +#define AT_NOTELF	10		/* Program is not ELF */ +#define AT_UID		11		/* Real uid */ +#define AT_EUID		12		/* Effective uid */ +#define AT_GID		13		/* Real gid */ +#define AT_EGID		14		/* Effective gid */ +#define AT_CLKTCK	17		/* Frequency of times() */ + +/* Some more special a_type values describing the hardware.  */ +#define AT_PLATFORM	15		/* String identifying platform.  */ +#define AT_HWCAP	16		/* Machine dependent hints about +					   processor capabilities.  */ + +/* This entry gives some information about the FPU initialization +   performed by the kernel.  */ +#define AT_FPUCW	18		/* Used FPU control word.  */ + +/* Cache block sizes.  */ +#define AT_DCACHEBSIZE	19		/* Data cache block size.  */ +#define AT_ICACHEBSIZE	20		/* Instruction cache block size.  */ +#define AT_UCACHEBSIZE	21		/* Unified cache block size.  */ + +/* A special ignored value for PPC, used by the kernel to control the +   interpretation of the AUXV. Must be > 16.  */ +#define AT_IGNOREPPC	22		/* Entry should be ignored */ + + +/* Note section contents.  Each entry in the note section begins with +   a header of a fixed form.  */ + +typedef struct +{ +  Elf32_Word n_namesz;			/* Length of the note's name.  */ +  Elf32_Word n_descsz;			/* Length of the note's descriptor.  */ +  Elf32_Word n_type;			/* Type of the note.  */ +} Elf32_Nhdr; + +typedef struct +{ +  Elf64_Word n_namesz;			/* Length of the note's name.  */ +  Elf64_Word n_descsz;			/* Length of the note's descriptor.  */ +  Elf64_Word n_type;			/* Type of the note.  */ +} Elf64_Nhdr; + +/* Known names of notes.  */ + +/* Solaris entries in the note section have this name.  */ +#define ELF_NOTE_SOLARIS	"SUNW Solaris" + +/* Note entries for GNU systems have this name.  */ +#define ELF_NOTE_GNU		"GNU" + + +/* Defined types of notes for Solaris.  */ + +/* Value of descriptor (one word) is desired pagesize for the binary.  */ +#define ELF_NOTE_PAGESIZE_HINT	1 + + +/* Defined note types for GNU systems.  */ + +/* ABI information.  The descriptor consists of words: +   word 0: OS descriptor +   word 1: major version of the ABI +   word 2: minor version of the ABI +   word 3: subminor version of the ABI +*/ +#define ELF_NOTE_ABI		1 + +/* Known OSes.  These value can appear in word 0 of an ELF_NOTE_ABI +   note section entry.  */ +#define ELF_NOTE_OS_LINUX	0 +#define ELF_NOTE_OS_GNU		1 +#define ELF_NOTE_OS_SOLARIS2	2 + + +/* Move records.  */ +typedef struct +{ +  Elf32_Xword m_value;		/* Symbol value.  */ +  Elf32_Word m_info;		/* Size and index.  */ +  Elf32_Word m_poffset;		/* Symbol offset.  */ +  Elf32_Half m_repeat;		/* Repeat count.  */ +  Elf32_Half m_stride;		/* Stride info.  */ +} Elf32_Move; + +typedef struct +{ +  Elf64_Xword m_value;		/* Symbol value.  */ +  Elf64_Xword m_info;		/* Size and index.  */ +  Elf64_Xword m_poffset;	/* Symbol offset.  */ +  Elf64_Half m_repeat;		/* Repeat count.  */ +  Elf64_Half m_stride;		/* Stride info.  */ +} Elf64_Move; + +/* Macro to construct move records.  */ +#define ELF32_M_SYM(info)	((info) >> 8) +#define ELF32_M_SIZE(info)	((unsigned char) (info)) +#define ELF32_M_INFO(sym, size)	(((sym) << 8) + (unsigned char) (size)) + +#define ELF64_M_SYM(info)	ELF32_M_SYM (info) +#define ELF64_M_SIZE(info)	ELF32_M_SIZE (info) +#define ELF64_M_INFO(sym, size)	ELF32_M_INFO (sym, size) + + +/* Motorola 68k specific definitions.  */ + +/* Values for Elf32_Ehdr.e_flags.  */ +#define EF_CPU32	0x00810000 + +/* m68k relocs.  */ + +#define R_68K_NONE	0		/* No reloc */ +#define R_68K_32	1		/* Direct 32 bit  */ +#define R_68K_16	2		/* Direct 16 bit  */ +#define R_68K_8		3		/* Direct 8 bit  */ +#define R_68K_PC32	4		/* PC relative 32 bit */ +#define R_68K_PC16	5		/* PC relative 16 bit */ +#define R_68K_PC8	6		/* PC relative 8 bit */ +#define R_68K_GOT32	7		/* 32 bit PC relative GOT entry */ +#define R_68K_GOT16	8		/* 16 bit PC relative GOT entry */ +#define R_68K_GOT8	9		/* 8 bit PC relative GOT entry */ +#define R_68K_GOT32O	10		/* 32 bit GOT offset */ +#define R_68K_GOT16O	11		/* 16 bit GOT offset */ +#define R_68K_GOT8O	12		/* 8 bit GOT offset */ +#define R_68K_PLT32	13		/* 32 bit PC relative PLT address */ +#define R_68K_PLT16	14		/* 16 bit PC relative PLT address */ +#define R_68K_PLT8	15		/* 8 bit PC relative PLT address */ +#define R_68K_PLT32O	16		/* 32 bit PLT offset */ +#define R_68K_PLT16O	17		/* 16 bit PLT offset */ +#define R_68K_PLT8O	18		/* 8 bit PLT offset */ +#define R_68K_COPY	19		/* Copy symbol at runtime */ +#define R_68K_GLOB_DAT	20		/* Create GOT entry */ +#define R_68K_JMP_SLOT	21		/* Create PLT entry */ +#define R_68K_RELATIVE	22		/* Adjust by program base */ +/* Keep this the last entry.  */ +#define R_68K_NUM	23 + +/* Intel 80386 specific definitions.  */ + +/* i386 relocs.  */ + +#define R_386_NONE	0		/* No reloc */ +#define R_386_32	1		/* Direct 32 bit  */ +#define R_386_PC32	2		/* PC relative 32 bit */ +#define R_386_GOT32	3		/* 32 bit GOT entry */ +#define R_386_PLT32	4		/* 32 bit PLT address */ +#define R_386_COPY	5		/* Copy symbol at runtime */ +#define R_386_GLOB_DAT	6		/* Create GOT entry */ +#define R_386_JMP_SLOT	7		/* Create PLT entry */ +#define R_386_RELATIVE	8		/* Adjust by program base */ +#define R_386_GOTOFF	9		/* 32 bit offset to GOT */ +#define R_386_GOTPC	10		/* 32 bit PC relative offset to GOT */ +/* Keep this the last entry.  */ +#define R_386_NUM	11 + +/* SUN SPARC specific definitions.  */ + +/* Legal values for ST_TYPE subfield of st_info (symbol type).  */ + +#define STT_REGISTER	13		/* Global register reserved to app. */ + +/* Values for Elf64_Ehdr.e_flags.  */ + +#define EF_SPARCV9_MM		3 +#define EF_SPARCV9_TSO		0 +#define EF_SPARCV9_PSO		1 +#define EF_SPARCV9_RMO		2 +#define EF_SPARC_LEDATA		0x800000 /* little endian data */ +#define EF_SPARC_EXT_MASK	0xFFFF00 +#define EF_SPARC_32PLUS		0x000100 /* generic V8+ features */ +#define EF_SPARC_SUN_US1	0x000200 /* Sun UltraSPARC1 extensions */ +#define EF_SPARC_HAL_R1		0x000400 /* HAL R1 extensions */ +#define EF_SPARC_SUN_US3	0x000800 /* Sun UltraSPARCIII extensions */ + +/* SPARC relocs.  */ + +#define R_SPARC_NONE	0		/* No reloc */ +#define R_SPARC_8	1		/* Direct 8 bit */ +#define R_SPARC_16	2		/* Direct 16 bit */ +#define R_SPARC_32	3		/* Direct 32 bit */ +#define R_SPARC_DISP8	4		/* PC relative 8 bit */ +#define R_SPARC_DISP16	5		/* PC relative 16 bit */ +#define R_SPARC_DISP32	6		/* PC relative 32 bit */ +#define R_SPARC_WDISP30	7		/* PC relative 30 bit shifted */ +#define R_SPARC_WDISP22	8		/* PC relative 22 bit shifted */ +#define R_SPARC_HI22	9		/* High 22 bit */ +#define R_SPARC_22	10		/* Direct 22 bit */ +#define R_SPARC_13	11		/* Direct 13 bit */ +#define R_SPARC_LO10	12		/* Truncated 10 bit */ +#define R_SPARC_GOT10	13		/* Truncated 10 bit GOT entry */ +#define R_SPARC_GOT13	14		/* 13 bit GOT entry */ +#define R_SPARC_GOT22	15		/* 22 bit GOT entry shifted */ +#define R_SPARC_PC10	16		/* PC relative 10 bit truncated */ +#define R_SPARC_PC22	17		/* PC relative 22 bit shifted */ +#define R_SPARC_WPLT30	18		/* 30 bit PC relative PLT address */ +#define R_SPARC_COPY	19		/* Copy symbol at runtime */ +#define R_SPARC_GLOB_DAT 20		/* Create GOT entry */ +#define R_SPARC_JMP_SLOT 21		/* Create PLT entry */ +#define R_SPARC_RELATIVE 22		/* Adjust by program base */ +#define R_SPARC_UA32	23		/* Direct 32 bit unaligned */ + +/* Additional Sparc64 relocs.  */ + +#define R_SPARC_PLT32	24		/* Direct 32 bit ref to PLT entry */ +#define R_SPARC_HIPLT22	25		/* High 22 bit PLT entry */ +#define R_SPARC_LOPLT10	26		/* Truncated 10 bit PLT entry */ +#define R_SPARC_PCPLT32	27		/* PC rel 32 bit ref to PLT entry */ +#define R_SPARC_PCPLT22	28		/* PC rel high 22 bit PLT entry */ +#define R_SPARC_PCPLT10	29		/* PC rel trunc 10 bit PLT entry */ +#define R_SPARC_10	30		/* Direct 10 bit */ +#define R_SPARC_11	31		/* Direct 11 bit */ +#define R_SPARC_64	32		/* Direct 64 bit */ +#define R_SPARC_OLO10	33		/* 10bit with secondary 13bit addend */ +#define R_SPARC_HH22	34		/* Top 22 bits of direct 64 bit */ +#define R_SPARC_HM10	35		/* High middle 10 bits of ... */ +#define R_SPARC_LM22	36		/* Low middle 22 bits of ... */ +#define R_SPARC_PC_HH22	37		/* Top 22 bits of pc rel 64 bit */ +#define R_SPARC_PC_HM10	38		/* High middle 10 bit of ... */ +#define R_SPARC_PC_LM22	39		/* Low miggle 22 bits of ... */ +#define R_SPARC_WDISP16	40		/* PC relative 16 bit shifted */ +#define R_SPARC_WDISP19	41		/* PC relative 19 bit shifted */ +#define R_SPARC_7	43		/* Direct 7 bit */ +#define R_SPARC_5	44		/* Direct 5 bit */ +#define R_SPARC_6	45		/* Direct 6 bit */ +#define R_SPARC_DISP64	46		/* PC relative 64 bit */ +#define R_SPARC_PLT64	47		/* Direct 64 bit ref to PLT entry */ +#define R_SPARC_HIX22	48		/* High 22 bit complemented */ +#define R_SPARC_LOX10	49		/* Truncated 11 bit complemented */ +#define R_SPARC_H44	50		/* Direct high 12 of 44 bit */ +#define R_SPARC_M44	51		/* Direct mid 22 of 44 bit */ +#define R_SPARC_L44	52		/* Direct low 10 of 44 bit */ +#define R_SPARC_REGISTER 53		/* Global register usage */ +#define R_SPARC_UA64	54		/* Direct 64 bit unaligned */ +#define R_SPARC_UA16	55		/* Direct 16 bit unaligned */ +/* Keep this the last entry.  */ +#define R_SPARC_NUM	56 + +/* For Sparc64, legal values for d_tag of Elf64_Dyn.  */ + +#define DT_SPARC_REGISTER 0x70000001 +#define DT_SPARC_NUM	2 + +/* Bits present in AT_HWCAP, primarily for Sparc32.  */ + +#define HWCAP_SPARC_FLUSH	1	/* The cpu supports flush insn.  */ +#define HWCAP_SPARC_STBAR	2 +#define HWCAP_SPARC_SWAP	4 +#define HWCAP_SPARC_MULDIV	8 +#define HWCAP_SPARC_V9		16	/* The cpu is v9, so v8plus is ok.  */ +#define HWCAP_SPARC_ULTRA3	32 + +/* MIPS R3000 specific definitions.  */ + +/* Legal values for e_flags field of Elf32_Ehdr.  */ + +#define EF_MIPS_NOREORDER   1		/* A .noreorder directive was used */ +#define EF_MIPS_PIC	    2		/* Contains PIC code */ +#define EF_MIPS_CPIC	    4		/* Uses PIC calling sequence */ +#define EF_MIPS_XGOT	    8 +#define EF_MIPS_64BIT_WHIRL 16 +#define EF_MIPS_ABI2	    32 +#define EF_MIPS_ABI_ON32    64 +#define EF_MIPS_ARCH	    0xf0000000	/* MIPS architecture level */ + +/* Legal values for MIPS architecture level.  */ + +#define EF_MIPS_ARCH_1	    0x00000000	/* -mips1 code.  */ +#define EF_MIPS_ARCH_2	    0x10000000	/* -mips2 code.  */ +#define EF_MIPS_ARCH_3	    0x20000000	/* -mips3 code.  */ +#define EF_MIPS_ARCH_4	    0x30000000	/* -mips4 code.  */ +#define EF_MIPS_ARCH_5	    0x40000000	/* -mips5 code.  */ +#define EF_MIPS_ARCH_32	    0x60000000	/* MIPS32 code.  */ +#define EF_MIPS_ARCH_64	    0x70000000	/* MIPS64 code.  */ + +/* The following are non-official names and should not be used.  */ + +#define E_MIPS_ARCH_1	  0x00000000	/* -mips1 code.  */ +#define E_MIPS_ARCH_2	  0x10000000	/* -mips2 code.  */ +#define E_MIPS_ARCH_3	  0x20000000	/* -mips3 code.  */ +#define E_MIPS_ARCH_4	  0x30000000	/* -mips4 code.  */ +#define E_MIPS_ARCH_5	  0x40000000	/* -mips5 code.  */ +#define E_MIPS_ARCH_32	  0x60000000	/* MIPS32 code.  */ +#define E_MIPS_ARCH_64	  0x70000000	/* MIPS64 code.  */ + +/* Special section indices.  */ + +#define SHN_MIPS_ACOMMON    0xff00	/* Allocated common symbols */ +#define SHN_MIPS_TEXT	    0xff01	/* Allocated test symbols.  */ +#define SHN_MIPS_DATA	    0xff02	/* Allocated data symbols.  */ +#define SHN_MIPS_SCOMMON    0xff03	/* Small common symbols */ +#define SHN_MIPS_SUNDEFINED 0xff04	/* Small undefined symbols */ + +/* Legal values for sh_type field of Elf32_Shdr.  */ + +#define SHT_MIPS_LIBLIST       0x70000000 /* Shared objects used in link */ +#define SHT_MIPS_MSYM	       0x70000001 +#define SHT_MIPS_CONFLICT      0x70000002 /* Conflicting symbols */ +#define SHT_MIPS_GPTAB	       0x70000003 /* Global data area sizes */ +#define SHT_MIPS_UCODE	       0x70000004 /* Reserved for SGI/MIPS compilers */ +#define SHT_MIPS_DEBUG	       0x70000005 /* MIPS ECOFF debugging information*/ +#define SHT_MIPS_REGINFO       0x70000006 /* Register usage information */ +#define SHT_MIPS_PACKAGE       0x70000007 +#define SHT_MIPS_PACKSYM       0x70000008 +#define SHT_MIPS_RELD	       0x70000009 +#define SHT_MIPS_IFACE         0x7000000b +#define SHT_MIPS_CONTENT       0x7000000c +#define SHT_MIPS_OPTIONS       0x7000000d /* Miscellaneous options.  */ +#define SHT_MIPS_SHDR	       0x70000010 +#define SHT_MIPS_FDESC	       0x70000011 +#define SHT_MIPS_EXTSYM	       0x70000012 +#define SHT_MIPS_DENSE	       0x70000013 +#define SHT_MIPS_PDESC	       0x70000014 +#define SHT_MIPS_LOCSYM	       0x70000015 +#define SHT_MIPS_AUXSYM	       0x70000016 +#define SHT_MIPS_OPTSYM	       0x70000017 +#define SHT_MIPS_LOCSTR	       0x70000018 +#define SHT_MIPS_LINE	       0x70000019 +#define SHT_MIPS_RFDESC	       0x7000001a +#define SHT_MIPS_DELTASYM      0x7000001b +#define SHT_MIPS_DELTAINST     0x7000001c +#define SHT_MIPS_DELTACLASS    0x7000001d +#define SHT_MIPS_DWARF         0x7000001e /* DWARF debugging information.  */ +#define SHT_MIPS_DELTADECL     0x7000001f +#define SHT_MIPS_SYMBOL_LIB    0x70000020 +#define SHT_MIPS_EVENTS	       0x70000021 /* Event section.  */ +#define SHT_MIPS_TRANSLATE     0x70000022 +#define SHT_MIPS_PIXIE	       0x70000023 +#define SHT_MIPS_XLATE	       0x70000024 +#define SHT_MIPS_XLATE_DEBUG   0x70000025 +#define SHT_MIPS_WHIRL	       0x70000026 +#define SHT_MIPS_EH_REGION     0x70000027 +#define SHT_MIPS_XLATE_OLD     0x70000028 +#define SHT_MIPS_PDR_EXCEPTION 0x70000029 + +/* Legal values for sh_flags field of Elf32_Shdr.  */ + +#define SHF_MIPS_GPREL	 0x10000000	/* Must be part of global data area */ +#define SHF_MIPS_MERGE	 0x20000000 +#define SHF_MIPS_ADDR	 0x40000000 +#define SHF_MIPS_STRINGS 0x80000000 +#define SHF_MIPS_NOSTRIP 0x08000000 +#define SHF_MIPS_LOCAL	 0x04000000 +#define SHF_MIPS_NAMES	 0x02000000 +#define SHF_MIPS_NODUPE	 0x01000000 + + +/* Symbol tables.  */ + +/* MIPS specific values for `st_other'.  */ +#define STO_MIPS_DEFAULT		0x0 +#define STO_MIPS_INTERNAL		0x1 +#define STO_MIPS_HIDDEN			0x2 +#define STO_MIPS_PROTECTED		0x3 +#define STO_MIPS_SC_ALIGN_UNUSED	0xff + +/* MIPS specific values for `st_info'.  */ +#define STB_MIPS_SPLIT_COMMON		13 + +/* Entries found in sections of type SHT_MIPS_GPTAB.  */ + +typedef union +{ +  struct +    { +      Elf32_Word gt_current_g_value;	/* -G value used for compilation */ +      Elf32_Word gt_unused;		/* Not used */ +    } gt_header;			/* First entry in section */ +  struct +    { +      Elf32_Word gt_g_value;		/* If this value were used for -G */ +      Elf32_Word gt_bytes;		/* This many bytes would be used */ +    } gt_entry;				/* Subsequent entries in section */ +} Elf32_gptab; + +/* Entry found in sections of type SHT_MIPS_REGINFO.  */ + +typedef struct +{ +  Elf32_Word	ri_gprmask;		/* General registers used */ +  Elf32_Word	ri_cprmask[4];		/* Coprocessor registers used */ +  Elf32_Sword	ri_gp_value;		/* $gp register value */ +} Elf32_RegInfo; + +/* Entries found in sections of type SHT_MIPS_OPTIONS.  */ + +typedef struct +{ +  unsigned char kind;		/* Determines interpretation of the +				   variable part of descriptor.  */ +  unsigned char size;		/* Size of descriptor, including header.  */ +  Elf32_Section section;	/* Section header index of section affected, +				   0 for global options.  */ +  Elf32_Word info;		/* Kind-specific information.  */ +} Elf_Options; + +/* Values for `kind' field in Elf_Options.  */ + +#define ODK_NULL	0	/* Undefined.  */ +#define ODK_REGINFO	1	/* Register usage information.  */ +#define ODK_EXCEPTIONS	2	/* Exception processing options.  */ +#define ODK_PAD		3	/* Section padding options.  */ +#define ODK_HWPATCH	4	/* Hardware workarounds performed */ +#define ODK_FILL	5	/* record the fill value used by the linker. */ +#define ODK_TAGS	6	/* reserve space for desktop tools to write. */ +#define ODK_HWAND	7	/* HW workarounds.  'AND' bits when merging. */ +#define ODK_HWOR	8	/* HW workarounds.  'OR' bits when merging.  */ + +/* Values for `info' in Elf_Options for ODK_EXCEPTIONS entries.  */ + +#define OEX_FPU_MIN	0x1f	/* FPE's which MUST be enabled.  */ +#define OEX_FPU_MAX	0x1f00	/* FPE's which MAY be enabled.  */ +#define OEX_PAGE0	0x10000	/* page zero must be mapped.  */ +#define OEX_SMM		0x20000	/* Force sequential memory mode?  */ +#define OEX_FPDBUG	0x40000	/* Force floating point debug mode?  */ +#define OEX_PRECISEFP	OEX_FPDBUG +#define OEX_DISMISS	0x80000	/* Dismiss invalid address faults?  */ + +#define OEX_FPU_INVAL	0x10 +#define OEX_FPU_DIV0	0x08 +#define OEX_FPU_OFLO	0x04 +#define OEX_FPU_UFLO	0x02 +#define OEX_FPU_INEX	0x01 + +/* Masks for `info' in Elf_Options for an ODK_HWPATCH entry.  */ + +#define OHW_R4KEOP	0x1	/* R4000 end-of-page patch.  */ +#define OHW_R8KPFETCH	0x2	/* may need R8000 prefetch patch.  */ +#define OHW_R5KEOP	0x4	/* R5000 end-of-page patch.  */ +#define OHW_R5KCVTL	0x8	/* R5000 cvt.[ds].l bug.  clean=1.  */ + +#define OPAD_PREFIX	0x1 +#define OPAD_POSTFIX	0x2 +#define OPAD_SYMBOL	0x4 + +/* Entry found in `.options' section.  */ + +typedef struct +{ +  Elf32_Word hwp_flags1;	/* Extra flags.  */ +  Elf32_Word hwp_flags2;	/* Extra flags.  */ +} Elf_Options_Hw; + +/* Masks for `info' in ElfOptions for ODK_HWAND and ODK_HWOR entries.  */ + +#define OHWA0_R4KEOP_CHECKED	0x00000001 +#define OHWA1_R4KEOP_CLEAN	0x00000002 + +/* MIPS relocs.  */ + +#define R_MIPS_NONE		0	/* No reloc */ +#define R_MIPS_16		1	/* Direct 16 bit */ +#define R_MIPS_32		2	/* Direct 32 bit */ +#define R_MIPS_REL32		3	/* PC relative 32 bit */ +#define R_MIPS_26		4	/* Direct 26 bit shifted */ +#define R_MIPS_HI16		5	/* High 16 bit */ +#define R_MIPS_LO16		6	/* Low 16 bit */ +#define R_MIPS_GPREL16		7	/* GP relative 16 bit */ +#define R_MIPS_LITERAL		8	/* 16 bit literal entry */ +#define R_MIPS_GOT16		9	/* 16 bit GOT entry */ +#define R_MIPS_PC16		10	/* PC relative 16 bit */ +#define R_MIPS_CALL16		11	/* 16 bit GOT entry for function */ +#define R_MIPS_GPREL32		12	/* GP relative 32 bit */ + +#define R_MIPS_SHIFT5		16 +#define R_MIPS_SHIFT6		17 +#define R_MIPS_64		18 +#define R_MIPS_GOT_DISP		19 +#define R_MIPS_GOT_PAGE		20 +#define R_MIPS_GOT_OFST		21 +#define R_MIPS_GOT_HI16		22 +#define R_MIPS_GOT_LO16		23 +#define R_MIPS_SUB		24 +#define R_MIPS_INSERT_A		25 +#define R_MIPS_INSERT_B		26 +#define R_MIPS_DELETE		27 +#define R_MIPS_HIGHER		28 +#define R_MIPS_HIGHEST		29 +#define R_MIPS_CALL_HI16	30 +#define R_MIPS_CALL_LO16	31 +#define R_MIPS_SCN_DISP		32 +#define R_MIPS_REL16		33 +#define R_MIPS_ADD_IMMEDIATE	34 +#define R_MIPS_PJUMP		35 +#define R_MIPS_RELGOT		36 +#define R_MIPS_JALR		37 +/* Keep this the last entry.  */ +#define R_MIPS_NUM		38 + +/* Legal values for p_type field of Elf32_Phdr.  */ + +#define PT_MIPS_REGINFO	0x70000000	/* Register usage information */ +#define PT_MIPS_RTPROC  0x70000001	/* Runtime procedure table. */ +#define PT_MIPS_OPTIONS 0x70000002 + +/* Special program header types.  */ + +#define PF_MIPS_LOCAL	0x10000000 + +/* Legal values for d_tag field of Elf32_Dyn.  */ + +#define DT_MIPS_RLD_VERSION  0x70000001	/* Runtime linker interface version */ +#define DT_MIPS_TIME_STAMP   0x70000002	/* Timestamp */ +#define DT_MIPS_ICHECKSUM    0x70000003	/* Checksum */ +#define DT_MIPS_IVERSION     0x70000004	/* Version string (string tbl index) */ +#define DT_MIPS_FLAGS	     0x70000005	/* Flags */ +#define DT_MIPS_BASE_ADDRESS 0x70000006	/* Base address */ +#define DT_MIPS_MSYM	     0x70000007 +#define DT_MIPS_CONFLICT     0x70000008	/* Address of CONFLICT section */ +#define DT_MIPS_LIBLIST	     0x70000009	/* Address of LIBLIST section */ +#define DT_MIPS_LOCAL_GOTNO  0x7000000a	/* Number of local GOT entries */ +#define DT_MIPS_CONFLICTNO   0x7000000b	/* Number of CONFLICT entries */ +#define DT_MIPS_LIBLISTNO    0x70000010	/* Number of LIBLIST entries */ +#define DT_MIPS_SYMTABNO     0x70000011	/* Number of DYNSYM entries */ +#define DT_MIPS_UNREFEXTNO   0x70000012	/* First external DYNSYM */ +#define DT_MIPS_GOTSYM	     0x70000013	/* First GOT entry in DYNSYM */ +#define DT_MIPS_HIPAGENO     0x70000014	/* Number of GOT page table entries */ +#define DT_MIPS_RLD_MAP	     0x70000016	/* Address of run time loader map.  */ +#define DT_MIPS_DELTA_CLASS  0x70000017	/* Delta C++ class definition.  */ +#define DT_MIPS_DELTA_CLASS_NO    0x70000018 /* Number of entries in +						DT_MIPS_DELTA_CLASS.  */ +#define DT_MIPS_DELTA_INSTANCE    0x70000019 /* Delta C++ class instances.  */ +#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a /* Number of entries in +						DT_MIPS_DELTA_INSTANCE.  */ +#define DT_MIPS_DELTA_RELOC  0x7000001b /* Delta relocations.  */ +#define DT_MIPS_DELTA_RELOC_NO 0x7000001c /* Number of entries in +					     DT_MIPS_DELTA_RELOC.  */ +#define DT_MIPS_DELTA_SYM    0x7000001d /* Delta symbols that Delta +					   relocations refer to.  */ +#define DT_MIPS_DELTA_SYM_NO 0x7000001e /* Number of entries in +					   DT_MIPS_DELTA_SYM.  */ +#define DT_MIPS_DELTA_CLASSSYM 0x70000020 /* Delta symbols that hold the +					     class declaration.  */ +#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021 /* Number of entries in +						DT_MIPS_DELTA_CLASSSYM.  */ +#define DT_MIPS_CXX_FLAGS    0x70000022 /* Flags indicating for C++ flavor.  */ +#define DT_MIPS_PIXIE_INIT   0x70000023 +#define DT_MIPS_SYMBOL_LIB   0x70000024 +#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025 +#define DT_MIPS_LOCAL_GOTIDX 0x70000026 +#define DT_MIPS_HIDDEN_GOTIDX 0x70000027 +#define DT_MIPS_PROTECTED_GOTIDX 0x70000028 +#define DT_MIPS_OPTIONS	     0x70000029 /* Address of .options.  */ +#define DT_MIPS_INTERFACE    0x7000002a /* Address of .interface.  */ +#define DT_MIPS_DYNSTR_ALIGN 0x7000002b +#define DT_MIPS_INTERFACE_SIZE 0x7000002c /* Size of the .interface section. */ +#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d /* Address of rld_text_rsolve +						    function stored in GOT.  */ +#define DT_MIPS_PERF_SUFFIX  0x7000002e /* Default suffix of dso to be added +					   by rld on dlopen() calls.  */ +#define DT_MIPS_COMPACT_SIZE 0x7000002f /* (O32)Size of compact rel section. */ +#define DT_MIPS_GP_VALUE     0x70000030 /* GP value for aux GOTs.  */ +#define DT_MIPS_AUX_DYNAMIC  0x70000031 /* Address of aux .dynamic.  */ +#define DT_MIPS_NUM	     0x32 + +/* Legal values for DT_MIPS_FLAGS Elf32_Dyn entry.  */ + +#define RHF_NONE		   0		/* No flags */ +#define RHF_QUICKSTART		   (1 << 0)	/* Use quickstart */ +#define RHF_NOTPOT		   (1 << 1)	/* Hash size not power of 2 */ +#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2)	/* Ignore LD_LIBRARY_PATH */ +#define RHF_NO_MOVE		   (1 << 3) +#define RHF_SGI_ONLY		   (1 << 4) +#define RHF_GUARANTEE_INIT	   (1 << 5) +#define RHF_DELTA_C_PLUS_PLUS	   (1 << 6) +#define RHF_GUARANTEE_START_INIT   (1 << 7) +#define RHF_PIXIE		   (1 << 8) +#define RHF_DEFAULT_DELAY_LOAD	   (1 << 9) +#define RHF_REQUICKSTART	   (1 << 10) +#define RHF_REQUICKSTARTED	   (1 << 11) +#define RHF_CORD		   (1 << 12) +#define RHF_NO_UNRES_UNDEF	   (1 << 13) +#define RHF_RLD_ORDER_SAFE	   (1 << 14) + +/* Entries found in sections of type SHT_MIPS_LIBLIST.  */ + +typedef struct +{ +  Elf32_Word l_name;		/* Name (string table index) */ +  Elf32_Word l_time_stamp;	/* Timestamp */ +  Elf32_Word l_checksum;	/* Checksum */ +  Elf32_Word l_version;		/* Interface version */ +  Elf32_Word l_flags;		/* Flags */ +} Elf32_Lib; + +typedef struct +{ +  Elf64_Word l_name;		/* Name (string table index) */ +  Elf64_Word l_time_stamp;	/* Timestamp */ +  Elf64_Word l_checksum;	/* Checksum */ +  Elf64_Word l_version;		/* Interface version */ +  Elf64_Word l_flags;		/* Flags */ +} Elf64_Lib; + + +/* Legal values for l_flags.  */ + +#define LL_NONE		  0 +#define LL_EXACT_MATCH	  (1 << 0)	/* Require exact match */ +#define LL_IGNORE_INT_VER (1 << 1)	/* Ignore interface version */ +#define LL_REQUIRE_MINOR  (1 << 2) +#define LL_EXPORTS	  (1 << 3) +#define LL_DELAY_LOAD	  (1 << 4) +#define LL_DELTA	  (1 << 5) + +/* Entries found in sections of type SHT_MIPS_CONFLICT.  */ + +typedef Elf32_Addr Elf32_Conflict; + + +/* HPPA specific definitions.  */ + +/* Legal values for e_flags field of Elf32_Ehdr.  */ + +#define EF_PARISC_TRAPNIL	0x00010000 /* Trap nil pointer dereference.  */ +#define EF_PARISC_EXT		0x00020000 /* Program uses arch. extensions. */ +#define EF_PARISC_LSB		0x00040000 /* Program expects little endian. */ +#define EF_PARISC_WIDE		0x00080000 /* Program expects wide mode.  */ +#define EF_PARISC_NO_KABP	0x00100000 /* No kernel assisted branch +					      prediction.  */ +#define EF_PARISC_LAZYSWAP	0x00400000 /* Allow lazy swapping.  */ +#define EF_PARISC_ARCH		0x0000ffff /* Architecture version.  */ + +/* Defined values for `e_flags & EF_PARISC_ARCH' are:  */ + +#define EFA_PARISC_1_0		    0x020b /* PA-RISC 1.0 big-endian.  */ +#define EFA_PARISC_1_1		    0x0210 /* PA-RISC 1.1 big-endian.  */ +#define EFA_PARISC_2_0		    0x0214 /* PA-RISC 2.0 big-endian.  */ + +/* Additional section indeces.  */ + +#define SHN_PARISC_ANSI_COMMON	0xff00	   /* Section for tenatively declared +					      symbols in ANSI C.  */ +#define SHN_PARISC_HUGE_COMMON	0xff01	   /* Common blocks in huge model.  */ + +/* Legal values for sh_type field of Elf32_Shdr.  */ + +#define SHT_PARISC_EXT		0x70000000 /* Contains product specific ext. */ +#define SHT_PARISC_UNWIND	0x70000001 /* Unwind information.  */ +#define SHT_PARISC_DOC		0x70000002 /* Debug info for optimized code. */ + +/* Legal values for sh_flags field of Elf32_Shdr.  */ + +#define SHF_PARISC_SHORT	0x20000000 /* Section with short addressing. */ +#define SHF_PARISC_HUGE		0x40000000 /* Section far from gp.  */ +#define SHF_PARISC_SBP		0x80000000 /* Static branch prediction code. */ + +/* Legal values for ST_TYPE subfield of st_info (symbol type).  */ + +#define STT_PARISC_MILLICODE	13	/* Millicode function entry point.  */ + +#define STT_HP_OPAQUE		(STT_LOOS + 0x1) +#define STT_HP_STUB		(STT_LOOS + 0x2) + +/* HPPA relocs.  */ + +#define R_PARISC_NONE		0	/* No reloc.  */ +#define R_PARISC_DIR32		1	/* Direct 32-bit reference.  */ +#define R_PARISC_DIR21L		2	/* Left 21 bits of eff. address.  */ +#define R_PARISC_DIR17R		3	/* Right 17 bits of eff. address.  */ +#define R_PARISC_DIR17F		4	/* 17 bits of eff. address.  */ +#define R_PARISC_DIR14R		6	/* Right 14 bits of eff. address.  */ +#define R_PARISC_PCREL32	9	/* 32-bit rel. address.  */ +#define R_PARISC_PCREL21L	10	/* Left 21 bits of rel. address.  */ +#define R_PARISC_PCREL17R	11	/* Right 17 bits of rel. address.  */ +#define R_PARISC_PCREL17F	12	/* 17 bits of rel. address.  */ +#define R_PARISC_PCREL14R	14	/* Right 14 bits of rel. address.  */ +#define R_PARISC_DPREL21L	18	/* Left 21 bits of rel. address.  */ +#define R_PARISC_DPREL14R	22	/* Right 14 bits of rel. address.  */ +#define R_PARISC_GPREL21L	26	/* GP-relative, left 21 bits.  */ +#define R_PARISC_GPREL14R	30	/* GP-relative, right 14 bits.  */ +#define R_PARISC_LTOFF21L	34	/* LT-relative, left 21 bits.  */ +#define R_PARISC_LTOFF14R	38	/* LT-relative, right 14 bits.  */ +#define R_PARISC_SECREL32	41	/* 32 bits section rel. address.  */ +#define R_PARISC_SEGBASE	48	/* No relocation, set segment base.  */ +#define R_PARISC_SEGREL32	49	/* 32 bits segment rel. address.  */ +#define R_PARISC_PLTOFF21L	50	/* PLT rel. address, left 21 bits.  */ +#define R_PARISC_PLTOFF14R	54	/* PLT rel. address, right 14 bits.  */ +#define R_PARISC_LTOFF_FPTR32	57	/* 32 bits LT-rel. function pointer. */ +#define R_PARISC_LTOFF_FPTR21L	58	/* LT-rel. fct ptr, left 21 bits. */ +#define R_PARISC_LTOFF_FPTR14R	62	/* LT-rel. fct ptr, right 14 bits. */ +#define R_PARISC_FPTR64		64	/* 64 bits function address.  */ +#define R_PARISC_PLABEL32	65	/* 32 bits function address.  */ +#define R_PARISC_PCREL64	72	/* 64 bits PC-rel. address.  */ +#define R_PARISC_PCREL22F	74	/* 22 bits PC-rel. address.  */ +#define R_PARISC_PCREL14WR	75	/* PC-rel. address, right 14 bits.  */ +#define R_PARISC_PCREL14DR	76	/* PC rel. address, right 14 bits.  */ +#define R_PARISC_PCREL16F	77	/* 16 bits PC-rel. address.  */ +#define R_PARISC_PCREL16WF	78	/* 16 bits PC-rel. address.  */ +#define R_PARISC_PCREL16DF	79	/* 16 bits PC-rel. address.  */ +#define R_PARISC_DIR64		80	/* 64 bits of eff. address.  */ +#define R_PARISC_DIR14WR	83	/* 14 bits of eff. address.  */ +#define R_PARISC_DIR14DR	84	/* 14 bits of eff. address.  */ +#define R_PARISC_DIR16F		85	/* 16 bits of eff. address.  */ +#define R_PARISC_DIR16WF	86	/* 16 bits of eff. address.  */ +#define R_PARISC_DIR16DF	87	/* 16 bits of eff. address.  */ +#define R_PARISC_GPREL64	88	/* 64 bits of GP-rel. address.  */ +#define R_PARISC_GPREL14WR	91	/* GP-rel. address, right 14 bits.  */ +#define R_PARISC_GPREL14DR	92	/* GP-rel. address, right 14 bits.  */ +#define R_PARISC_GPREL16F	93	/* 16 bits GP-rel. address.  */ +#define R_PARISC_GPREL16WF	94	/* 16 bits GP-rel. address.  */ +#define R_PARISC_GPREL16DF	95	/* 16 bits GP-rel. address.  */ +#define R_PARISC_LTOFF64	96	/* 64 bits LT-rel. address.  */ +#define R_PARISC_LTOFF14WR	99	/* LT-rel. address, right 14 bits.  */ +#define R_PARISC_LTOFF14DR	100	/* LT-rel. address, right 14 bits.  */ +#define R_PARISC_LTOFF16F	101	/* 16 bits LT-rel. address.  */ +#define R_PARISC_LTOFF16WF	102	/* 16 bits LT-rel. address.  */ +#define R_PARISC_LTOFF16DF	103	/* 16 bits LT-rel. address.  */ +#define R_PARISC_SECREL64	104	/* 64 bits section rel. address.  */ +#define R_PARISC_SEGREL64	112	/* 64 bits segment rel. address.  */ +#define R_PARISC_PLTOFF14WR	115	/* PLT-rel. address, right 14 bits.  */ +#define R_PARISC_PLTOFF14DR	116	/* PLT-rel. address, right 14 bits.  */ +#define R_PARISC_PLTOFF16F	117	/* 16 bits LT-rel. address.  */ +#define R_PARISC_PLTOFF16WF	118	/* 16 bits PLT-rel. address.  */ +#define R_PARISC_PLTOFF16DF	119	/* 16 bits PLT-rel. address.  */ +#define R_PARISC_LTOFF_FPTR64	120	/* 64 bits LT-rel. function ptr.  */ +#define R_PARISC_LTOFF_FPTR14WR	123	/* LT-rel. fct. ptr., right 14 bits. */ +#define R_PARISC_LTOFF_FPTR14DR	124	/* LT-rel. fct. ptr., right 14 bits. */ +#define R_PARISC_LTOFF_FPTR16F	125	/* 16 bits LT-rel. function ptr.  */ +#define R_PARISC_LTOFF_FPTR16WF	126	/* 16 bits LT-rel. function ptr.  */ +#define R_PARISC_LTOFF_FPTR16DF	127	/* 16 bits LT-rel. function ptr.  */ +#define R_PARISC_LORESERVE	128 +#define R_PARISC_COPY		128	/* Copy relocation.  */ +#define R_PARISC_IPLT		129	/* Dynamic reloc, imported PLT */ +#define R_PARISC_EPLT		130	/* Dynamic reloc, exported PLT */ +#define R_PARISC_TPREL32	153	/* 32 bits TP-rel. address.  */ +#define R_PARISC_TPREL21L	154	/* TP-rel. address, left 21 bits.  */ +#define R_PARISC_TPREL14R	158	/* TP-rel. address, right 14 bits.  */ +#define R_PARISC_LTOFF_TP21L	162	/* LT-TP-rel. address, left 21 bits. */ +#define R_PARISC_LTOFF_TP14R	166	/* LT-TP-rel. address, right 14 bits.*/ +#define R_PARISC_LTOFF_TP14F	167	/* 14 bits LT-TP-rel. address.  */ +#define R_PARISC_TPREL64	216	/* 64 bits TP-rel. address.  */ +#define R_PARISC_TPREL14WR	219	/* TP-rel. address, right 14 bits.  */ +#define R_PARISC_TPREL14DR	220	/* TP-rel. address, right 14 bits.  */ +#define R_PARISC_TPREL16F	221	/* 16 bits TP-rel. address.  */ +#define R_PARISC_TPREL16WF	222	/* 16 bits TP-rel. address.  */ +#define R_PARISC_TPREL16DF	223	/* 16 bits TP-rel. address.  */ +#define R_PARISC_LTOFF_TP64	224	/* 64 bits LT-TP-rel. address.  */ +#define R_PARISC_LTOFF_TP14WR	227	/* LT-TP-rel. address, right 14 bits.*/ +#define R_PARISC_LTOFF_TP14DR	228	/* LT-TP-rel. address, right 14 bits.*/ +#define R_PARISC_LTOFF_TP16F	229	/* 16 bits LT-TP-rel. address.  */ +#define R_PARISC_LTOFF_TP16WF	230	/* 16 bits LT-TP-rel. address.  */ +#define R_PARISC_LTOFF_TP16DF	231	/* 16 bits LT-TP-rel. address.  */ +#define R_PARISC_HIRESERVE	255 + +/* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr.  */ + +#define PT_HP_TLS		(PT_LOOS + 0x0) +#define PT_HP_CORE_NONE		(PT_LOOS + 0x1) +#define PT_HP_CORE_VERSION	(PT_LOOS + 0x2) +#define PT_HP_CORE_KERNEL	(PT_LOOS + 0x3) +#define PT_HP_CORE_COMM		(PT_LOOS + 0x4) +#define PT_HP_CORE_PROC		(PT_LOOS + 0x5) +#define PT_HP_CORE_LOADABLE	(PT_LOOS + 0x6) +#define PT_HP_CORE_STACK	(PT_LOOS + 0x7) +#define PT_HP_CORE_SHM		(PT_LOOS + 0x8) +#define PT_HP_CORE_MMF		(PT_LOOS + 0x9) +#define PT_HP_PARALLEL		(PT_LOOS + 0x10) +#define PT_HP_FASTBIND		(PT_LOOS + 0x11) +#define PT_HP_OPT_ANNOT		(PT_LOOS + 0x12) +#define PT_HP_HSL_ANNOT		(PT_LOOS + 0x13) +#define PT_HP_STACK		(PT_LOOS + 0x14) + +#define PT_PARISC_ARCHEXT	0x70000000 +#define PT_PARISC_UNWIND	0x70000001 + +/* Legal values for p_flags field of Elf32_Phdr/Elf64_Phdr.  */ + +#define PF_PARISC_SBP		0x08000000 + +#define PF_HP_PAGE_SIZE		0x00100000 +#define PF_HP_FAR_SHARED	0x00200000 +#define PF_HP_NEAR_SHARED	0x00400000 +#define PF_HP_CODE		0x01000000 +#define PF_HP_MODIFY		0x02000000 +#define PF_HP_LAZYSWAP		0x04000000 +#define PF_HP_SBP		0x08000000 + + +/* Alpha specific definitions.  */ + +/* Legal values for e_flags field of Elf64_Ehdr.  */ + +#define EF_ALPHA_32BIT		1	/* All addresses must be < 2GB.  */ +#define EF_ALPHA_CANRELAX	2	/* Relocations for relaxing exist.  */ + +/* Legal values for sh_type field of Elf64_Shdr.  */ + +/* These two are primerily concerned with ECOFF debugging info.  */ +#define SHT_ALPHA_DEBUG		0x70000001 +#define SHT_ALPHA_REGINFO	0x70000002 + +/* Legal values for sh_flags field of Elf64_Shdr.  */ + +#define SHF_ALPHA_GPREL		0x10000000 + +/* Legal values for st_other field of Elf64_Sym.  */ +#define STO_ALPHA_NOPV		0x80	/* No PV required.  */ +#define STO_ALPHA_STD_GPLOAD	0x88	/* PV only used for initial ldgp.  */ + +/* Alpha relocs.  */ + +#define R_ALPHA_NONE		0	/* No reloc */ +#define R_ALPHA_REFLONG		1	/* Direct 32 bit */ +#define R_ALPHA_REFQUAD		2	/* Direct 64 bit */ +#define R_ALPHA_GPREL32		3	/* GP relative 32 bit */ +#define R_ALPHA_LITERAL		4	/* GP relative 16 bit w/optimization */ +#define R_ALPHA_LITUSE		5	/* Optimization hint for LITERAL */ +#define R_ALPHA_GPDISP		6	/* Add displacement to GP */ +#define R_ALPHA_BRADDR		7	/* PC+4 relative 23 bit shifted */ +#define R_ALPHA_HINT		8	/* PC+4 relative 16 bit shifted */ +#define R_ALPHA_SREL16		9	/* PC relative 16 bit */ +#define R_ALPHA_SREL32		10	/* PC relative 32 bit */ +#define R_ALPHA_SREL64		11	/* PC relative 64 bit */ +#define R_ALPHA_OP_PUSH		12	/* OP stack push */ +#define R_ALPHA_OP_STORE	13	/* OP stack pop and store */ +#define R_ALPHA_OP_PSUB		14	/* OP stack subtract */ +#define R_ALPHA_OP_PRSHIFT	15	/* OP stack right shift */ +#define R_ALPHA_GPVALUE		16 +#define R_ALPHA_GPRELHIGH	17 +#define R_ALPHA_GPRELLOW	18 +#define R_ALPHA_IMMED_GP_16	19 +#define R_ALPHA_IMMED_GP_HI32	20 +#define R_ALPHA_IMMED_SCN_HI32	21 +#define R_ALPHA_IMMED_BR_HI32	22 +#define R_ALPHA_IMMED_LO32	23 +#define R_ALPHA_COPY		24	/* Copy symbol at runtime */ +#define R_ALPHA_GLOB_DAT	25	/* Create GOT entry */ +#define R_ALPHA_JMP_SLOT	26	/* Create PLT entry */ +#define R_ALPHA_RELATIVE	27	/* Adjust by program base */ +/* Keep this the last entry.  */ +#define R_ALPHA_NUM		28 + + +/* PowerPC specific declarations */ + +/* Values for Elf32/64_Ehdr.e_flags.  */ +#define EF_PPC_EMB		0x80000000	/* PowerPC embedded flag */ + +/* Cygnus local bits below */ +#define EF_PPC_RELOCATABLE	0x00010000	/* PowerPC -mrelocatable flag*/ +#define EF_PPC_RELOCATABLE_LIB	0x00008000	/* PowerPC -mrelocatable-lib +						   flag */ + +/* PowerPC relocations defined by the ABIs */ +#define R_PPC_NONE		0 +#define R_PPC_ADDR32		1	/* 32bit absolute address */ +#define R_PPC_ADDR24		2	/* 26bit address, 2 bits ignored.  */ +#define R_PPC_ADDR16		3	/* 16bit absolute address */ +#define R_PPC_ADDR16_LO		4	/* lower 16bit of absolute address */ +#define R_PPC_ADDR16_HI		5	/* high 16bit of absolute address */ +#define R_PPC_ADDR16_HA		6	/* adjusted high 16bit */ +#define R_PPC_ADDR14		7	/* 16bit address, 2 bits ignored */ +#define R_PPC_ADDR14_BRTAKEN	8 +#define R_PPC_ADDR14_BRNTAKEN	9 +#define R_PPC_REL24		10	/* PC relative 26 bit */ +#define R_PPC_REL14		11	/* PC relative 16 bit */ +#define R_PPC_REL14_BRTAKEN	12 +#define R_PPC_REL14_BRNTAKEN	13 +#define R_PPC_GOT16		14 +#define R_PPC_GOT16_LO		15 +#define R_PPC_GOT16_HI		16 +#define R_PPC_GOT16_HA		17 +#define R_PPC_PLTREL24		18 +#define R_PPC_COPY		19 +#define R_PPC_GLOB_DAT		20 +#define R_PPC_JMP_SLOT		21 +#define R_PPC_RELATIVE		22 +#define R_PPC_LOCAL24PC		23 +#define R_PPC_UADDR32		24 +#define R_PPC_UADDR16		25 +#define R_PPC_REL32		26 +#define R_PPC_PLT32		27 +#define R_PPC_PLTREL32		28 +#define R_PPC_PLT16_LO		29 +#define R_PPC_PLT16_HI		30 +#define R_PPC_PLT16_HA		31 +#define R_PPC_SDAREL16		32 +#define R_PPC_SECTOFF		33 +#define R_PPC_SECTOFF_LO	34 +#define R_PPC_SECTOFF_HI	35 +#define R_PPC_SECTOFF_HA	36 +/* Keep this the last entry.  */ +#define R_PPC_NUM		37 + +/* The remaining relocs are from the Embedded ELF ABI, and are not +   in the SVR4 ELF ABI.  */ +#define R_PPC_EMB_NADDR32	101 +#define R_PPC_EMB_NADDR16	102 +#define R_PPC_EMB_NADDR16_LO	103 +#define R_PPC_EMB_NADDR16_HI	104 +#define R_PPC_EMB_NADDR16_HA	105 +#define R_PPC_EMB_SDAI16	106 +#define R_PPC_EMB_SDA2I16	107 +#define R_PPC_EMB_SDA2REL	108 +#define R_PPC_EMB_SDA21		109	/* 16 bit offset in SDA */ +#define R_PPC_EMB_MRKREF	110 +#define R_PPC_EMB_RELSEC16	111 +#define R_PPC_EMB_RELST_LO	112 +#define R_PPC_EMB_RELST_HI	113 +#define R_PPC_EMB_RELST_HA	114 +#define R_PPC_EMB_BIT_FLD	115 +#define R_PPC_EMB_RELSDA	116	/* 16 bit relative offset in SDA */ + +/* Diab tool relocations.  */ +#define R_PPC_DIAB_SDA21_LO	180	/* like EMB_SDA21, but lower 16 bit */ +#define R_PPC_DIAB_SDA21_HI	181	/* like EMB_SDA21, but high 16 bit */ +#define R_PPC_DIAB_SDA21_HA	182	/* like EMB_SDA21, adjusted high 16 */ +#define R_PPC_DIAB_RELSDA_LO	183	/* like EMB_RELSDA, but lower 16 bit */ +#define R_PPC_DIAB_RELSDA_HI	184	/* like EMB_RELSDA, but high 16 bit */ +#define R_PPC_DIAB_RELSDA_HA	185	/* like EMB_RELSDA, adjusted high 16 */ + +/* This is a phony reloc to handle any old fashioned TOC16 references +   that may still be in object files.  */ +#define R_PPC_TOC16		255 + + +/* ARM specific declarations */ + +/* Processor specific flags for the ELF header e_flags field.  */ +#define EF_ARM_RELEXEC     0x01 +#define EF_ARM_HASENTRY    0x02 +#define EF_ARM_INTERWORK   0x04 +#define EF_ARM_APCS_26     0x08 +#define EF_ARM_APCS_FLOAT  0x10 +#define EF_ARM_PIC         0x20 +#define EF_ARM_ALIGN8      0x40		/* 8-bit structure alignment is in use */ +#define EF_ARM_NEW_ABI     0x80 +#define EF_ARM_OLD_ABI     0x100 + +/* Other constants defined in the ARM ELF spec. version B-01.  */ +/* NB. These conflict with values defined above.  */ +#define EF_ARM_SYMSARESORTED	0x04 +#define EF_ARM_DYNSYMSUSESEGIDX 0x08 +#define EF_ARM_MAPSYMSFIRST	0x10 +#define EF_ARM_EABIMASK		0XFF000000 + +#define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK) +#define EF_ARM_EABI_UNKNOWN  0x00000000 +#define EF_ARM_EABI_VER1     0x01000000 +#define EF_ARM_EABI_VER2     0x02000000 + +/* Additional symbol types for Thumb */ +#define STT_ARM_TFUNC      0xd + +/* ARM-specific values for sh_flags */ +#define SHF_ARM_ENTRYSECT  0x10000000   /* Section contains an entry point */ +#define SHF_ARM_COMDEF     0x80000000   /* Section may be multiply defined +					   in the input to a link step */ + +/* ARM-specific program header flags */ +#define PF_ARM_SB          0x10000000   /* Segment contains the location +					   addressed by the static base */ + +/* ARM relocs.  */ +#define R_ARM_NONE		0	/* No reloc */ +#define R_ARM_PC24		1	/* PC relative 26 bit branch */ +#define R_ARM_ABS32		2	/* Direct 32 bit  */ +#define R_ARM_REL32		3	/* PC relative 32 bit */ +#define R_ARM_PC13		4 +#define R_ARM_ABS16		5	/* Direct 16 bit */ +#define R_ARM_ABS12		6	/* Direct 12 bit */ +#define R_ARM_THM_ABS5		7 +#define R_ARM_ABS8		8	/* Direct 8 bit */ +#define R_ARM_SBREL32		9 +#define R_ARM_THM_PC22		10 +#define R_ARM_THM_PC8		11 +#define R_ARM_AMP_VCALL9	12 +#define R_ARM_SWI24		13 +#define R_ARM_THM_SWI8		14 +#define R_ARM_XPC25		15 +#define R_ARM_THM_XPC22		16 +#define R_ARM_COPY		20	/* Copy symbol at runtime */ +#define R_ARM_GLOB_DAT		21	/* Create GOT entry */ +#define R_ARM_JUMP_SLOT		22	/* Create PLT entry */ +#define R_ARM_RELATIVE		23	/* Adjust by program base */ +#define R_ARM_GOTOFF		24	/* 32 bit offset to GOT */ +#define R_ARM_GOTPC		25	/* 32 bit PC relative offset to GOT */ +#define R_ARM_GOT32		26	/* 32 bit GOT entry */ +#define R_ARM_PLT32		27	/* 32 bit PLT address */ +#define R_ARM_ALU_PCREL_7_0	32 +#define R_ARM_ALU_PCREL_15_8	33 +#define R_ARM_ALU_PCREL_23_15	34 +#define R_ARM_LDR_SBREL_11_0	35 +#define R_ARM_ALU_SBREL_19_12	36 +#define R_ARM_ALU_SBREL_27_20	37 +#define R_ARM_GNU_VTENTRY	100 +#define R_ARM_GNU_VTINHERIT	101 +#define R_ARM_THM_PC11		102	/* thumb unconditional branch */ +#define R_ARM_THM_PC9		103	/* thumb conditional branch */ +#define R_ARM_RXPC25		249 +#define R_ARM_RSBREL32		250 +#define R_ARM_THM_RPC22		251 +#define R_ARM_RREL32		252 +#define R_ARM_RABS22		253 +#define R_ARM_RPC24		254 +#define R_ARM_RBASE		255 +/* Keep this the last entry.  */ +#define R_ARM_NUM		256 + +/* IA-64 specific declarations.  */ + +/* Processor specific flags for the Ehdr e_flags field.  */ +#define EF_IA_64_MASKOS		0x0000000f	/* os-specific flags */ +#define EF_IA_64_ABI64		0x00000010	/* 64-bit ABI */ +#define EF_IA_64_ARCH		0xff000000	/* arch. version mask */ + +/* Processor specific values for the Phdr p_type field.  */ +#define PT_IA_64_ARCHEXT	(PT_LOPROC + 0)	/* arch extension bits */ +#define PT_IA_64_UNWIND		(PT_LOPROC + 1)	/* ia64 unwind bits */ + +/* Processor specific flags for the Phdr p_flags field.  */ +#define PF_IA_64_NORECOV	0x80000000	/* spec insns w/o recovery */ + +/* Processor specific values for the Shdr sh_type field.  */ +#define SHT_IA_64_EXT		(SHT_LOPROC + 0) /* extension bits */ +#define SHT_IA_64_UNWIND	(SHT_LOPROC + 1) /* unwind bits */ + +/* Processor specific flags for the Shdr sh_flags field.  */ +#define SHF_IA_64_SHORT		0x10000000	/* section near gp */ +#define SHF_IA_64_NORECOV	0x20000000	/* spec insns w/o recovery */ + +/* Processor specific values for the Dyn d_tag field.  */ +#define DT_IA_64_PLT_RESERVE	(DT_LOPROC + 0) +#define DT_IA_64_NUM		1 + +/* IA-64 relocations.  */ +#define R_IA64_NONE		0x00	/* none */ +#define R_IA64_IMM14		0x21	/* symbol + addend, add imm14 */ +#define R_IA64_IMM22		0x22	/* symbol + addend, add imm22 */ +#define R_IA64_IMM64		0x23	/* symbol + addend, mov imm64 */ +#define R_IA64_DIR32MSB		0x24	/* symbol + addend, data4 MSB */ +#define R_IA64_DIR32LSB		0x25	/* symbol + addend, data4 LSB */ +#define R_IA64_DIR64MSB		0x26	/* symbol + addend, data8 MSB */ +#define R_IA64_DIR64LSB		0x27	/* symbol + addend, data8 LSB */ +#define R_IA64_GPREL22		0x2a	/* @gprel(sym + add), add imm22 */ +#define R_IA64_GPREL64I		0x2b	/* @gprel(sym + add), mov imm64 */ +#define R_IA64_GPREL32MSB	0x2c	/* @gprel(sym + add), data4 MSB */ +#define R_IA64_GPREL32LSB	0x2d	/* @gprel(sym + add), data4 LSB */ +#define R_IA64_GPREL64MSB	0x2e	/* @gprel(sym + add), data8 MSB */ +#define R_IA64_GPREL64LSB	0x2f	/* @gprel(sym + add), data8 LSB */ +#define R_IA64_LTOFF22		0x32	/* @ltoff(sym + add), add imm22 */ +#define R_IA64_LTOFF64I		0x33	/* @ltoff(sym + add), mov imm64 */ +#define R_IA64_PLTOFF22		0x3a	/* @pltoff(sym + add), add imm22 */ +#define R_IA64_PLTOFF64I	0x3b	/* @pltoff(sym + add), mov imm64 */ +#define R_IA64_PLTOFF64MSB	0x3e	/* @pltoff(sym + add), data8 MSB */ +#define R_IA64_PLTOFF64LSB	0x3f	/* @pltoff(sym + add), data8 LSB */ +#define R_IA64_FPTR64I		0x43	/* @fptr(sym + add), mov imm64 */ +#define R_IA64_FPTR32MSB	0x44	/* @fptr(sym + add), data4 MSB */ +#define R_IA64_FPTR32LSB	0x45	/* @fptr(sym + add), data4 LSB */ +#define R_IA64_FPTR64MSB	0x46	/* @fptr(sym + add), data8 MSB */ +#define R_IA64_FPTR64LSB	0x47	/* @fptr(sym + add), data8 LSB */ +#define R_IA64_PCREL60B		0x48	/* @pcrel(sym + add), brl */ +#define R_IA64_PCREL21B		0x49	/* @pcrel(sym + add), ptb, call */ +#define R_IA64_PCREL21M		0x4a	/* @pcrel(sym + add), chk.s */ +#define R_IA64_PCREL21F		0x4b	/* @pcrel(sym + add), fchkf */ +#define R_IA64_PCREL32MSB	0x4c	/* @pcrel(sym + add), data4 MSB */ +#define R_IA64_PCREL32LSB	0x4d	/* @pcrel(sym + add), data4 LSB */ +#define R_IA64_PCREL64MSB	0x4e	/* @pcrel(sym + add), data8 MSB */ +#define R_IA64_PCREL64LSB	0x4f	/* @pcrel(sym + add), data8 LSB */ +#define R_IA64_LTOFF_FPTR22	0x52	/* @ltoff(@fptr(s+a)), imm22 */ +#define R_IA64_LTOFF_FPTR64I	0x53	/* @ltoff(@fptr(s+a)), imm64 */ +#define R_IA64_LTOFF_FPTR32MSB	0x54	/* @ltoff(@fptr(s+a)), data4 MSB */ +#define R_IA64_LTOFF_FPTR32LSB	0x55	/* @ltoff(@fptr(s+a)), data4 LSB */ +#define R_IA64_LTOFF_FPTR64MSB	0x56	/* @ltoff(@fptr(s+a)), data8 MSB */ +#define R_IA64_LTOFF_FPTR64LSB	0x57	/* @ltoff(@fptr(s+a)), data8 LSB */ +#define R_IA64_SEGREL32MSB	0x5c	/* @segrel(sym + add), data4 MSB */ +#define R_IA64_SEGREL32LSB	0x5d	/* @segrel(sym + add), data4 LSB */ +#define R_IA64_SEGREL64MSB	0x5e	/* @segrel(sym + add), data8 MSB */ +#define R_IA64_SEGREL64LSB	0x5f	/* @segrel(sym + add), data8 LSB */ +#define R_IA64_SECREL32MSB	0x64	/* @secrel(sym + add), data4 MSB */ +#define R_IA64_SECREL32LSB	0x65	/* @secrel(sym + add), data4 LSB */ +#define R_IA64_SECREL64MSB	0x66	/* @secrel(sym + add), data8 MSB */ +#define R_IA64_SECREL64LSB	0x67	/* @secrel(sym + add), data8 LSB */ +#define R_IA64_REL32MSB		0x6c	/* data 4 + REL */ +#define R_IA64_REL32LSB		0x6d	/* data 4 + REL */ +#define R_IA64_REL64MSB		0x6e	/* data 8 + REL */ +#define R_IA64_REL64LSB		0x6f	/* data 8 + REL */ +#define R_IA64_LTV32MSB		0x74	/* symbol + addend, data4 MSB */ +#define R_IA64_LTV32LSB		0x75	/* symbol + addend, data4 LSB */ +#define R_IA64_LTV64MSB		0x76	/* symbol + addend, data8 MSB */ +#define R_IA64_LTV64LSB		0x77	/* symbol + addend, data8 LSB */ +#define R_IA64_PCREL21BI	0x79	/* @pcrel(sym + add), 21bit inst */ +#define R_IA64_PCREL22		0x7a	/* @pcrel(sym + add), 22bit inst */ +#define R_IA64_PCREL64I		0x7b	/* @pcrel(sym + add), 64bit inst */ +#define R_IA64_IPLTMSB		0x80	/* dynamic reloc, imported PLT, MSB */ +#define R_IA64_IPLTLSB		0x81	/* dynamic reloc, imported PLT, LSB */ +#define R_IA64_COPY		0x84	/* copy relocation */ +#define R_IA64_SUB		0x85	/* Addend and symbol difference */ +#define R_IA64_LTOFF22X		0x86	/* LTOFF22, relaxable.  */ +#define R_IA64_LDXMOV		0x87	/* Use of LTOFF22X.  */ +#define R_IA64_TPREL14		0x91	/* @tprel(sym + add), imm14 */ +#define R_IA64_TPREL22		0x92	/* @tprel(sym + add), imm22 */ +#define R_IA64_TPREL64I		0x93	/* @tprel(sym + add), imm64 */ +#define R_IA64_TPREL64MSB	0x96	/* @tprel(sym + add), data8 MSB */ +#define R_IA64_TPREL64LSB	0x97	/* @tprel(sym + add), data8 LSB */ +#define R_IA64_LTOFF_TPREL22	0x9a	/* @ltoff(@tprel(s+a)), imm2 */ +#define R_IA64_DTPMOD64MSB	0xa6	/* @dtpmod(sym + add), data8 MSB */ +#define R_IA64_DTPMOD64LSB	0xa7	/* @dtpmod(sym + add), data8 LSB */ +#define R_IA64_LTOFF_DTPMOD22	0xaa	/* @ltoff(@dtpmod(sym + add)), imm22 */ +#define R_IA64_DTPREL14		0xb1	/* @dtprel(sym + add), imm14 */ +#define R_IA64_DTPREL22		0xb2	/* @dtprel(sym + add), imm22 */ +#define R_IA64_DTPREL64I	0xb3	/* @dtprel(sym + add), imm64 */ +#define R_IA64_DTPREL32MSB	0xb4	/* @dtprel(sym + add), data4 MSB */ +#define R_IA64_DTPREL32LSB	0xb5	/* @dtprel(sym + add), data4 LSB */ +#define R_IA64_DTPREL64MSB	0xb6	/* @dtprel(sym + add), data8 MSB */ +#define R_IA64_DTPREL64LSB	0xb7	/* @dtprel(sym + add), data8 LSB */ +#define R_IA64_LTOFF_DTPREL22	0xba	/* @ltoff(@dtprel(s+a)), imm22 */ + +/* SH specific declarations */ + +/* SH relocs.  */ +#define	R_SH_NONE		0 +#define	R_SH_DIR32		1 +#define	R_SH_REL32		2 +#define	R_SH_DIR8WPN		3 +#define	R_SH_IND12W		4 +#define	R_SH_DIR8WPL		5 +#define	R_SH_DIR8WPZ		6 +#define	R_SH_DIR8BP		7 +#define	R_SH_DIR8W		8 +#define	R_SH_DIR8L		9 +#define	R_SH_SWITCH16		25 +#define	R_SH_SWITCH32		26 +#define	R_SH_USES		27 +#define	R_SH_COUNT		28 +#define	R_SH_ALIGN		29 +#define	R_SH_CODE		30 +#define	R_SH_DATA		31 +#define	R_SH_LABEL		32 +#define	R_SH_SWITCH8		33 +#define	R_SH_GNU_VTINHERIT	34 +#define	R_SH_GNU_VTENTRY	35 +#define	R_SH_GOT32		160 +#define	R_SH_PLT32		161 +#define	R_SH_COPY		162 +#define	R_SH_GLOB_DAT		163 +#define	R_SH_JMP_SLOT		164 +#define	R_SH_RELATIVE		165 +#define	R_SH_GOTOFF		166 +#define	R_SH_GOTPC		167 +/* Keep this the last entry.  */ +#define	R_SH_NUM		256 + +/* Additional s390 relocs */ + +#define R_390_NONE      0              /* No reloc.  */ +#define R_390_8         1              /* Direct 8 bit.  */ +#define R_390_12        2              /* Direct 12 bit.  */ +#define R_390_16        3              /* Direct 16 bit.  */ +#define R_390_32        4              /* Direct 32 bit.  */ +#define R_390_PC32      5              /* PC relative 32 bit.  */ +#define R_390_GOT12     6              /* 12 bit GOT offset.  */ +#define R_390_GOT32     7              /* 32 bit GOT offset.  */ +#define R_390_PLT32     8              /* 32 bit PC relative PLT address.  */ +#define R_390_COPY      9              /* Copy symbol at runtime.  */ +#define R_390_GLOB_DAT  10             /* Create GOT entry.  */ +#define R_390_JMP_SLOT  11             /* Create PLT entry.  */ +#define R_390_RELATIVE  12             /* Adjust by program base.  */ +#define R_390_GOTOFF    13             /* 32 bit offset to GOT.  */ +#define R_390_GOTPC     14             /* 32 bit PC relative offset to GOT.  */ +#define R_390_GOT16     15             /* 16 bit GOT offset.  */ +#define R_390_PC16      16             /* PC relative 16 bit.  */ +#define R_390_PC16DBL   17             /* PC relative 16 bit shifted by 1.  */ +#define R_390_PLT16DBL  18             /* 16 bit PC rel. PLT shifted by 1.  */ +#define R_390_PC32DBL   19             /* PC relative 32 bit shifted by 1.  */ +#define R_390_PLT32DBL  20             /* 32 bit PC rel. PLT shifted by 1.  */ +#define R_390_GOTPCDBL  21             /* 32 bit PC rel. GOT shifted by 1.  */ +#define R_390_64        22             /* Direct 64 bit.  */ +#define R_390_PC64      23             /* PC relative 64 bit.  */ +#define R_390_GOT64     24             /* 64 bit GOT offset.  */ +#define R_390_PLT64     25             /* 64 bit PC relative PLT address.  */ +#define R_390_GOTENT    26             /* 32 bit PC rel. to GOT entry >> 1. */ + +/* Keep this the last entry.  */ +#define R_390_NUM       19 + +/* CRIS relocations.  */ +#define R_CRIS_NONE		0 +#define R_CRIS_8		1 +#define R_CRIS_16		2 +#define R_CRIS_32		3 +#define R_CRIS_8_PCREL		4 +#define R_CRIS_16_PCREL		5 +#define R_CRIS_32_PCREL		6 +#define R_CRIS_GNU_VTINHERIT	7 +#define R_CRIS_GNU_VTENTRY	8 +#define R_CRIS_COPY		9 +#define R_CRIS_GLOB_DAT		10 +#define R_CRIS_JUMP_SLOT	11 +#define R_CRIS_RELATIVE		12 +#define R_CRIS_16_GOT		13 +#define R_CRIS_32_GOT		14 +#define R_CRIS_16_GOTPLT	15 +#define R_CRIS_32_GOTPLT	16 +#define R_CRIS_32_GOTREL	17 +#define R_CRIS_32_PLT_GOTREL	18 +#define R_CRIS_32_PLT_PCREL	19 + +#define R_CRIS_NUM		20 + +#define R_MICROBLAZE_NONE 		0 +#define R_MICROBLAZE_32 		1 +#define R_MICROBLAZE_32_PCREL 		2 +#define R_MICROBLAZE_64_PCREL 		3 +#define R_MICROBLAZE_32_PCREL_LO 	4 +#define R_MICROBLAZE_64 		5 +#define R_MICROBLAZE_32_LO 		6 +#define R_MICROBLAZE_SRO32 		7 +#define R_MICROBLAZE_SRW32 		8 +#define R_MICROBLAZE_64_NONE 		9 +#define R_MICROBLAZE_32_SYM_OP_SYM 	10 +#define R_MICROBLAZE_GNU_VTINHERIT 	11 +#define R_MICROBLAZE_GNU_VTENTRY 	12 + +#define R_MICROBLAZE_NUM 		13 + +/* Altera NIOS specific definitions.  */ + +#define FLAT_NIOS2_R_32			0 /* Normal 32-bit reloc */ +#define FLAT_NIOS2_R_HI_LO		1 +#define FLAT_NIOS2_R_HIADJ_LO	2 +#define FLAT_NIOS2_R_CALL26		4 + +/* NIOS relocations. */ +#define R_NIOS_NONE				0 +#define R_NIOS_32				1	/* A 32 bit absolute relocation.*/ +#define R_NIOS_LO16_LO5			2	/* A LO-16 5 bit absolute relocation.  */ +#define R_NIOS_LO16_HI11		3	/* A LO-16 top 11 bit absolute relocation.  */ +#define R_NIOS_HI16_LO5			4	/* A HI-16 5 bit absolute relocation.  */ +#define R_NIOS_HI16_HI11		5	/* A HI-16 top 11 bit absolute relocation.  */ +#define R_NIOS_PCREL6			6	/* A 6 bit relative relocation.  */ +#define R_NIOS_PCREL8			7	/* An 8 bit relative relocation.  */ +#define R_NIOS_PCREL11			8	/* An 11 bit relative relocation.  */ +#define R_NIOS_16				9	/* A 16 bit absolute relocation.  */ +#define R_NIOS_H_LO5			10	/* Low 5-bits of absolute relocation in halfwords.  */ +#define R_NIOS_H_HI11			11	/* Top 11 bits of 16-bit absolute relocation in halfwords.  */ +#define R_NIOS_H_XLO5			12	/* Low 5 bits of top 16-bits of 32-bit absolute relocation in halfwords.  */ +#define R_NIOS_H_XHI11			13	/* Top 11 bits of top 16-bits of 32-bit absolute relocation in halfwords.  */ +#define R_NIOS_H_16				14	/* Half-word @h value */ +#define R_NIOS_H_32				15	/* Word @h value */ +#define R_NIOS_GNU_VTINHERIT	200	/* GNU extension to record C++ vtable hierarchy */ +#define R_NIOS_GNU_VTENTRY		201	/* GNU extension to record C++ vtable member usage */ +/* Keep this the last entry.  */ +#define R_NIOS_NUM				202 + +/* NIOS II relocations */ +#define R_NIOS2_NONE			0 +#define R_NIOS2_S16				1 +#define R_NIOS2_U16				2 +#define R_NIOS2_PCREL16			3 +#define R_NIOS2_CALL26			4 +#define R_NIOS2_IMM5			5 +#define R_NIOS2_CACHE_OPX 		6 +#define R_NIOS2_IMM6			7 +#define R_NIOS2_IMM8			8 +#define R_NIOS2_HI16			9 +#define R_NIOS2_LO16			10 +#define R_NIOS2_HIADJ16 		11 +#define R_NIOS2_BFD_RELOC_32	12 +#define R_NIOS2_BFD_RELOC_16	13 +#define R_NIOS2_BFD_RELOC_8 	14 +#define R_NIOS2_GPREL			15 +#define R_NIOS2_GNU_VTINHERIT 	16 +#define R_NIOS2_GNU_VTENTRY  	17 +#define R_NIOS2_UJMP			18 +#define R_NIOS2_CJMP			19 +#define R_NIOS2_CALLR			20 +#define R_NIOS2_ALIGN			21 +/* Keep this the last entry.  */ +#define R_NIOS2_NUM				22 + +#endif	/* elf.h */ diff --git a/toolchain/elf2flt/elf2flt/e1-elf2flt.ld b/toolchain/elf2flt/elf2flt/e1-elf2flt.ld new file mode 100644 index 000000000..a88fc4ffe --- /dev/null +++ b/toolchain/elf2flt/elf2flt/e1-elf2flt.ld @@ -0,0 +1,161 @@ + +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) } +} diff --git a/toolchain/elf2flt/elf2flt/elf2flt.c b/toolchain/elf2flt/elf2flt/elf2flt.c new file mode 100644 index 000000000..c8d6201ac --- /dev/null +++ b/toolchain/elf2flt/elf2flt/elf2flt.c @@ -0,0 +1,2250 @@ +/* + * elf2flt.c: Convert ELF (or any BFD format) to FLAT binary format + * + * (c) 1999-2002, Greg Ungerer <gerg@snapgear.com> + * Created elf2flt from coff2flt (see copyrights below). Added all the + * ELF format file handling. Extended relocation support for all of + * text and data. + * + * (c) 2004, Nios II support, Wentao Xu <wentao@microtronix.com> + * (c) 2003, H8 support, ktrace <davidm@snapgear.com> + * (c) 2003-2004, MicroBlaze support, John Williams <jwilliams@itee.uq.edu.au> + * (c) 2001-2003, arm/arm-pic/arm-big-endian support <davidm@snapgear.com> + * (c) 2001, v850 changes, Mile Bader <miles@lsi.nec.co.jp> + * (c) 2003, SuperH support, Paul Mundt <lethal@linux-sh.org> + * (c) 2001, zflat support <davidm@snapgear.com> + * (c) 2001, Changes for GOT entries Paul Dale <pauli@snapgear.com> and + *           David McCullough <davidm@snapgear.com> + * + * Now supports PIC with GOT tables.  This works by taking a '.elf' file + * and a fully linked elf executable (at address 0) and produces a flat + * file that can be loaded with some fixups.  It still supports the old + * style fully relocatable elf format files. + * + * Originally obj-res.c + * + * (c) 1998, Kenneth Albanowski <kjahds@kjahds.com> + * (c) 1998, D. Jeff Dionne + * (c) 1998, The Silver Hammer Group Ltd. + * (c) 1996, 1997 Dionne & Associates <jeff@ryeham.ee.ryerson.ca> + * + * This is Free Software, under the GNU Public Licence v2 or greater. + * + * Relocation added March 1997, Kresten Krab Thorup  + * krab@california.daimi.aau.dk + */ +  +#include <stdio.h>    /* Userland pieces of the ANSI C standard I/O package  */ +#include <stdlib.h>   /* Userland prototypes of the ANSI C std lib functions */ +#include <stdarg.h>   /* Allows va_list to exist in the these namespaces     */ +#include <string.h>   /* Userland prototypes of the string handling funcs    */ +#include <strings.h> +#include <unistd.h>   /* Userland prototypes of the Unix std system calls    */ +#include <fcntl.h>    /* Flag value for file handling functions              */ +#include <time.h> +#ifndef WIN32 +#include <netinet/in.h> /* Consts and structs defined by the internet system */ +#else +#include <winsock2.h> +#endif + +/* from $(INSTALLDIR)/include       */ +#include <bfd.h>      /* Main header file for the BFD library                */ + +#if defined(TARGET_h8300) +#include <elf/h8.h>      /* TARGET_* ELF support for the BFD library            */ +#elif defined(__CYGWIN__) || defined(__MINGW32__) || defined(TARGET_nios) || defined(TARGET_nios2) +#include "cygwin-elf.h"	/* Cygwin uses a local copy */ +#elif defined(TARGET_microblaze) +#include <elf/microblaze.h>	/* TARGET_* ELF support for the BFD library */ +#elif defined(TARGET_bfin) +#include "elf/bfin.h" +#else +#include <elf.h>      /* TARGET_* ELF support for the BFD library            */ +#endif + +#if defined(__MINGW32__) +#include <getopt.h> +#endif + +/* from uClinux-x.x.x/include/linux */ +#include "flat.h"     /* Binary flat header description                      */ + +#ifdef TARGET_e1 +#include <e1.h> +#endif + +#ifdef TARGET_v850e +#define TARGET_v850 +#endif + +#if defined(TARGET_m68k) +#define	ARCH	"m68k/coldfire" +#elif defined(TARGET_arm) +#define	ARCH	"arm" +#elif defined(TARGET_sparc) +#define	ARCH	"sparc" +#elif defined(TARGET_v850) +#define	ARCH	"v850" +#elif defined(TARGET_sh) +#define	ARCH	"sh" +#elif defined(TARGET_h8300) +#define	ARCH	"h8300" +#elif defined(TARGET_microblaze) +#define ARCH	"microblaze" +#elif defined(TARGET_e1) +#define ARCH    "e1-coff" +#elif defined(TARGET_bfin) +#define ARCH	"bfin" +#define FLAT_RELOC_TYPE_TEXT 0 +#define FLAT_RELOC_TYPE_DATA 1 +#define FLAT_RELOC_TYPE_BSS 2 +#define FLAT_RELOC_TYPE_STACK 3 +#define FLAT_RELOC_PART_LO 0 +#define FLAT_RELOC_PART_HI 1 +#define PCREL24_MAGIC_OFFSET -1 +#elif defined(TARGET_nios) +#define ARCH	"nios" +#elif defined(TARGET_nios2) +#define ARCH	"nios2" +#else +#error "Don't know how to support your CPU architecture??" +#endif + +#if defined(TARGET_m68k) || defined(TARGET_h8300) || defined(TARGET_bfin) +/* + * Define a maximum number of bytes allowed in the offset table. + * We'll fail if the table is larger than this. + * + * This limit may be different for platforms other than m68k, but + * 8000 entries is a lot,  trust me :-) (davidm) + */ +#define GOT_LIMIT 32767 +/* + * we have to mask out the shared library id here and there,  this gives + * us the real address bits when needed + */ +#define	real_address_bits(x)	(pic_with_got ? ((x) & 0xffffff) : (x)) +#else +#define	real_address_bits(x)	(x) +#endif + +#ifndef O_BINARY +#define O_BINARY 0 +#endif + + +int verbose = 0;      /* extra output when running */ +int pic_with_got = 0; /* do elf/got processing with PIC code */ +int load_to_ram = 0;  /* instruct loader to allocate everything into RAM */ +int ktrace = 0;       /* instruct loader output kernel trace on load */ +int compress = 0;     /* 1 = compress everything, 2 = compress data only */ +int use_resolved = 0; /* If true, get the value of symbol references from */ +		      /* the program contents, not from the relocation table. */ +		      /* In this case, the input ELF file must be already */ +		      /* fully resolved (using the `-q' flag with recent */ +		      /* versions of GNU ld will give you a fully resolved */ +		      /* output file with relocation entries).  */ + +const char *progname, *filename; +int lineno; + +int nerrors = 0; +int nwarnings = 0; + +static char where[200]; + +enum { +  /* Use exactly one of these: */ +  E_NOFILE = 0,         /* "progname: " */ +  E_FILE = 1,           /* "filename: " */ +  E_FILELINE = 2,       /* "filename:lineno: " */ +  E_FILEWHERE = 3,      /* "filename:%s: " -- set %s with ewhere() */ +           +  /* Add in any of these with |': */ +  E_WARNING = 0x10, +  E_PERROR = 0x20 +}; +                   +void ewhere (const char *format, ...); +void einfo (int type, const char *format, ...); +                   + +void +ewhere (const char *format, ...) { +  va_list args; +  va_start (args, format); +  vsprintf (where, format, args); +  va_end (args); +} + + +void +einfo (int type, const char *format, ...) { +  va_list args; + +  switch (type & 0x0f) { +  case E_NOFILE: +    fprintf (stderr, "%s: ", progname); +    break; +  case E_FILE: +    fprintf (stderr, "%s: ", filename); +    break; +  case E_FILELINE: +    ewhere ("%d", lineno); +    /* fall-through */ +  case E_FILEWHERE: +    fprintf (stderr, "%s:%s: ", filename, where); +    break; +  } + +  if (type & E_WARNING) { +    fprintf (stderr, "warning: "); +    nwarnings++; +  } else { +    nerrors++; +  } + +  va_start (args, format); +  vfprintf (stderr, format, args); +  va_end (args); + +  if (type & E_PERROR) +    perror (""); +  else +    fprintf (stderr, "\n"); +} + + +asymbol** +get_symbols (bfd *abfd, long *num) +{ +  long storage_needed; +  asymbol **symbol_table; +  long number_of_symbols; +   +  storage_needed = bfd_get_symtab_upper_bound (abfd); +	   +  if (storage_needed < 0) +    abort (); +       +  if (storage_needed == 0) +    return NULL; + +  symbol_table = (asymbol **) malloc (storage_needed); + +  number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table); +   +  if (number_of_symbols < 0)  +    abort (); + +  *num = number_of_symbols; +  return symbol_table; +} + + + +int +dump_symbols(asymbol **symbol_table, long number_of_symbols) +{ +  long i; +  printf("SYMBOL TABLE:\n"); +  for (i=0; i<number_of_symbols; i++) { +	printf("  NAME=%s  VALUE=0x%x\n", symbol_table[i]->name, +		symbol_table[i]->value); +  } +  printf("\n"); +  return(0); +}   + + + +long +get_symbol_offset(char *name, asection *sec, asymbol **symbol_table, long number_of_symbols) +{ +  long i; +  for (i=0; i<number_of_symbols; i++) { +    if (symbol_table[i]->section == sec) { +      if (!strcmp(symbol_table[i]->name, name)) { +        return symbol_table[i]->value; +      } +    } +  } +  return -1; +}   + + + +long +get_gp_value(asymbol **symbol_table, long number_of_symbols) +{ +  long i; +  for (i=0; i<number_of_symbols; i++) { +      if (!strcmp(symbol_table[i]->name, "_gp")) +		return symbol_table[i]->value; +  } +  return -1; +} +  + + +long +add_com_to_bss(asymbol **symbol_table, long number_of_symbols, long bss_len) +{ +  long i, comsize; +  long offset; + +  comsize = 0; +  for (i=0; i<number_of_symbols; i++) { +    if (strcmp("*COM*", symbol_table[i]->section->name) == 0) { +      offset = bss_len + comsize; +      comsize += symbol_table[i]->value; +      symbol_table[i]->value = offset; +    } +  } +  return comsize; +}   + +#ifdef TARGET_bfin +/* stack to handle "arithmetic" relocations */ +#define RELOC_STACK_SIZE 100 +static bfd_vma reloc_stack[RELOC_STACK_SIZE]; +static unsigned int reloc_stack_tos = 0; +static char sym_section_name[80]; +static asection *stack_sym_section = 0; + +static void +reloc_stack_set_section(asection *section, const char *sym_section_name_in) +{ +    /* TODO : we can add checks to make sure we do not +       add different section names to the same arithmetic +       expression.  */ +    strcpy(sym_section_name, sym_section_name_in); +    stack_sym_section = section; +} + +static const char * +reloc_stack_get_section_name() +{ +    return sym_section_name; +} +static asection *reloc_stack_get_section() +{ +    return stack_sym_section; +} + +#define is_reloc_stack_empty() ((reloc_stack_tos > 0)?0:1) + +static void +reloc_stack_push(bfd_vma value) +{ +  reloc_stack[reloc_stack_tos++] = value; +} + +static bfd_vma +reloc_stack_pop() +{ +  return reloc_stack[--reloc_stack_tos]; +} + +static bfd_vma +reloc_stack_operate(unsigned int oper) +{ +    bfd_vma value; +    switch(oper){ +    case 0xE2 : +	value = reloc_stack[reloc_stack_tos - 2] + reloc_stack[reloc_stack_tos - 1]; +	reloc_stack_tos -= 2; +	break; +    case 0xE3 : +	value = reloc_stack[reloc_stack_tos - 2] - reloc_stack[reloc_stack_tos - 1]; +	reloc_stack_tos -= 2; +	break; +    case 0xE4 : +	value = reloc_stack[reloc_stack_tos - 2] * reloc_stack[reloc_stack_tos - 1]; +	reloc_stack_tos -= 2; +	break; +    case 0xE5 : +	value = reloc_stack[reloc_stack_tos - 2] / reloc_stack[reloc_stack_tos - 1]; +	reloc_stack_tos -= 2; +	break; +    case 0xE6 : +	value = reloc_stack[reloc_stack_tos - 2] % reloc_stack[reloc_stack_tos - 1]; +	reloc_stack_tos -= 2; +	break; +    case 0xE7 : +	value = reloc_stack[reloc_stack_tos - 2] << reloc_stack[reloc_stack_tos - 1]; +	reloc_stack_tos -= 2; +	break; +    case 0xE8 : +	value = reloc_stack[reloc_stack_tos - 2] >> reloc_stack[reloc_stack_tos - 1]; +	reloc_stack_tos -= 2; +	break; +    case 0xE9 : +	value = reloc_stack[reloc_stack_tos - 2] & reloc_stack[reloc_stack_tos - 1]; +	reloc_stack_tos -= 2; +	break; +    case 0xEA : +	value = reloc_stack[reloc_stack_tos - 2] | reloc_stack[reloc_stack_tos - 1]; +	reloc_stack_tos -= 2; +	break; +    case 0xEB : +	value = reloc_stack[reloc_stack_tos - 2] ^ reloc_stack[reloc_stack_tos - 1]; +	reloc_stack_tos -= 2; +	break; +    case 0xEC : +	value = reloc_stack[reloc_stack_tos - 2] && reloc_stack[reloc_stack_tos - 1]; +	reloc_stack_tos -= 2; +	break; +    case 0xED : +	value = reloc_stack[reloc_stack_tos - 2] || reloc_stack[reloc_stack_tos - 1]; +	reloc_stack_tos -= 2; +	break; +    case 0xEF : +	value = -reloc_stack[reloc_stack_tos - 1]; +	reloc_stack_tos --; +	break; +    case 0xF0 : +	value = ~reloc_stack[reloc_stack_tos - 1]; +	reloc_stack_tos -= 1; +	break; +    default : +	fprintf(stderr, "bfin relocation : Internal bug\n"); +	return 0; +    } + +    // now push the new value back on stack +    reloc_stack_push(value); + +    return value; +} + +/* FUNCTION : weak_und_symbol +   ABSTRACT : return true if symbol is weak and undefined. +*/ +static int +weak_und_symbol(const char *reloc_section_name, +                struct bfd_symbol *symbol) +{ +    if (!(strstr (reloc_section_name, "text") +	  || strstr (reloc_section_name, "data") +	  || strstr (reloc_section_name, "bss"))) { +	if (symbol->flags & BSF_WEAK) { +#ifdef DEBUG_BFIN +	    fprintf(stderr, "found weak undefined symbol %s\n", symbol->name); +#endif +	    return TRUE; +	} +    } +    return FALSE; +} + +static int +bfin_set_reloc (uint32_t *reloc,  +		const char *reloc_section_name,  +		const char *sym_name, +		struct bfd_symbol *symbol, +		int sp, int hilo, int32_t offset) +{ +    unsigned int type; +    uint32_t val; + +    if (strstr (reloc_section_name, "text")) +	type = FLAT_RELOC_TYPE_TEXT; +    else if (strstr (reloc_section_name, "data")) +	type = FLAT_RELOC_TYPE_DATA; +    else if (strstr (reloc_section_name, "bss")) +	type = FLAT_RELOC_TYPE_BSS; +    else if (strstr (reloc_section_name, "stack")) +	type = FLAT_RELOC_TYPE_STACK; +    else if (symbol->flags & BSF_WEAK){ +	/* weak symbol support ... if a weak symbol is undefined at the +	   end of a final link, it should return 0 rather than error +	   We will assume text section for the moment. +	*/ +	type = FLAT_RELOC_TYPE_TEXT; +    } else if (strstr (reloc_section_name, "*ABS*")){ +	/* (A data section initialization of something in the shared libc's text section +	   does not resolve - i.e. a global pointer to function initialized with +	   a libc function). +	   The text section here is appropriate as the section information +	   of the shared library is lost. The loader will do some calcs. +	*/ +	type = FLAT_RELOC_TYPE_TEXT; +    } else { +	printf ("Unknown Type - relocation for %s in bad section - %s\n", sym_name, reloc_section_name); +	return 1; +    } + +    val = (offset & ((1 << 26) - 1)) << 6; +    val |= (sp & (1 << 3) - 1) << 3; +    val |= (hilo & 1) << 2; +    val |= (type & (1 << 2) - 1); +    *reloc = val; +    return 0; +} +#endif + + +uint32_t * +output_relocs ( +  bfd *abs_bfd, +  asymbol **symbols, +  int number_of_symbols, +  unsigned long *n_relocs, +  unsigned char *text, int text_len, unsigned long text_vma, +  unsigned char *data, int data_len, unsigned long data_vma, +  bfd *rel_bfd) +{ +  uint32_t		*flat_relocs; +  asection		*a, *sym_section, *r; +  arelent		**relpp, **p, *q; +  const char		*sym_name, *section_name; +  unsigned char		*sectionp; +  unsigned long		pflags; +  char			addstr[16]; +  long			sym_addr, sym_vma, section_vma; +  int			relsize, relcount; +  int			flat_reloc_count; +  int			sym_reloc_size, rc; +  int			got_size = 0; +  int			bad_relocs = 0; +  asymbol		**symb; +  long			nsymb; +   +#if 0 +  printf("%s(%d): output_relocs(abs_bfd=%d,synbols=0x%x,number_of_symbols=%d" +	"n_relocs=0x%x,text=0x%x,text_len=%d,data=0x%x,data_len=%d)\n", +	__FILE__, __LINE__, abs_bfd, symbols, number_of_symbols, n_relocs, +	text, text_len, data, data_len); +#endif + +#if 0 +dump_symbols(symbols, number_of_symbols); +#endif + +  *n_relocs = 0; +  flat_relocs = NULL; +  flat_reloc_count = 0; +  rc = 0; +  pflags = 0; + +  /* Determine how big our offset table is in bytes. +   * This isn't too difficult as we've terminated the table with -1. +   * Also note that both the relocatable and absolute versions have this +   * terminator even though the relocatable one doesn't have the GOT! +   */ +  if (pic_with_got) { +    unsigned long *lp = (unsigned long *)data; +    /* Should call ntohl(*lp) here but is isn't going to matter */ +    while (*lp != 0xffffffff) lp++; +    got_size = ((unsigned char *)lp) - data; +    if (verbose) +	    printf("GOT table contains %d entries (%d bytes)\n", +			    got_size/sizeof(unsigned long), got_size); +#ifdef TARGET_m68k +    if (got_size > GOT_LIMIT) { +	    fprintf(stderr, "GOT too large: %d bytes (limit = %d bytes)\n", +			    got_size, GOT_LIMIT); +	    exit(1); +    } +#endif +  } + +  for (a = abs_bfd->sections; (a != (asection *) NULL); a = a->next) { +  	section_vma = bfd_section_vma(abs_bfd, a); + +	if (verbose) +		printf("SECTION: %s [0x%x]: flags=0x%x vma=0x%x\n", a->name, a, +			a->flags, section_vma); + +//	if (bfd_is_abs_section(a)) +//		continue; +	if (bfd_is_und_section(a)) +		continue; +	if (bfd_is_com_section(a)) +		continue; +//	if ((a->flags & SEC_RELOC) == 0) +//		continue; + +	/* +	 *	Only relocate things in the data sections if we are PIC/GOT. +	 *	otherwise do text as well +	 */ +	if (!pic_with_got && (a->flags & SEC_CODE)) +		sectionp = text + (a->vma - text_vma); +	else if (a->flags & SEC_DATA) +		sectionp = data + (a->vma - data_vma); +	else +		continue; + +	/* Now search for the equivalent section in the relocation binary +	 * and use that relocation information to build reloc entries +	 * for this one. +	 */ +	for (r=rel_bfd->sections; r != NULL; r=r->next) +		if (strcmp(a->name, r->name) == 0) +			break; +	if (r == NULL) +	  continue; +	if (verbose) +	  printf(" RELOCS: %s [0x%x]: flags=0x%x vma=0x%x\n", r->name, r, +			r->flags, bfd_section_vma(abs_bfd, r)); +  	if ((r->flags & SEC_RELOC) == 0) +  	  continue; +	relsize = bfd_get_reloc_upper_bound(rel_bfd, r); +	if (relsize <= 0) { +		if (verbose) +			printf("%s(%d): no relocation entries section=0x%x\n", +				__FILE__, __LINE__, r->name); +		continue; +	} + +	symb = get_symbols(rel_bfd, &nsymb); +	relpp = (arelent **) xmalloc(relsize); +	relcount = bfd_canonicalize_reloc(rel_bfd, r, relpp, symb); +	if (relcount <= 0) { +		if (verbose) +			printf("%s(%d): no relocation entries section=%s\n", +			__FILE__, __LINE__, r->name); +		continue; +	} else { +		for (p = relpp; (relcount && (*p != NULL)); p++, relcount--) { +			unsigned char *r_mem; +			int relocation_needed = 0; + +#ifdef TARGET_microblaze +			/* The MICROBLAZE_XX_NONE relocs can be skipped. +			   They represent PC relative branches that the +			   linker has already resolved */ +				 +			switch ((*p)->howto->type)  +			{ +			case R_MICROBLAZE_NONE: +			case R_MICROBLAZE_64_NONE: +				continue; +			} +#endif /* TARGET_microblaze */ + +#ifdef TARGET_nios2 +#define  htoniosl(x)	(x) +#define  niostohl(x)	(x) +			switch ((*p)->howto->type)  +			{ +				case R_NIOS2_BFD_RELOC_32: +					relocation_needed = 1; +					pflags = (FLAT_NIOS2_R_32 << 28); +					sym_vma = bfd_section_vma(abs_bfd, sym_section); +					sym_addr += sym_vma + q->addend; +					/* modify target, in target order */ +					*(unsigned long *)r_mem = htoniosl(sym_addr); +					break; +				case R_NIOS2_CALL26: +				{ +					unsigned long exist_val; +					relocation_needed = 1; +					pflags = (FLAT_NIOS2_R_CALL26 << 28); +					sym_vma = bfd_section_vma(abs_bfd, sym_section); +					sym_addr += sym_vma + q->addend; +					 +					/* modify target, in target order */ +					// exist_val = niostohl(*(unsigned long *)r_mem); +					exist_val = ((sym_addr >> 2) << 6); +					*(unsigned long *)r_mem = htoniosl(exist_val); +					break; +				} +				case R_NIOS2_HIADJ16: +				case R_NIOS2_HI16: +				{ +					unsigned long exist_val; +					int r2_type; +					/* handle the adjacent HI/LO pairs */ +					if (relcount == 0) +						r2_type = R_NIOS2_NONE; +					else +						r2_type = p[1]->howto->type; +					if ((r2_type == R_NIOS2_LO16) +					    && (p[0]->sym_ptr_ptr == p[1]->sym_ptr_ptr) +					    && (p[0]->addend == p[1]->addend))  +					    { +							unsigned char * r2_mem = sectionp + p[1]->address; +							if (p[1]->address - q->address!=4) +								printf("Err: HI/LO not adjacent %d\n", p[1]->address - q->address); +							relocation_needed = 1; +							pflags = (q->howto->type == R_NIOS2_HIADJ16)  +								? FLAT_NIOS2_R_HIADJ_LO : FLAT_NIOS2_R_HI_LO; +							pflags <<= 28; +						 +							sym_vma = bfd_section_vma(abs_bfd, sym_section); +							sym_addr += sym_vma + q->addend; + +							/* modify high 16 bits, in target order */ +							exist_val = niostohl(*(unsigned long *)r_mem); +							exist_val =  ((exist_val >> 22) << 22) | (exist_val & 0x3f); +							if (q->howto->type == R_NIOS2_HIADJ16) +								exist_val |= ((((sym_addr >> 16) + ((sym_addr >> 15) & 1)) & 0xFFFF) << 6); +							else +								exist_val |= (((sym_addr >> 16) & 0xFFFF) << 6); +							*(unsigned long *)r_mem = htoniosl(exist_val); + +							/* modify low 16 bits, in target order */ +							exist_val = niostohl(*(unsigned long *)r2_mem); +							exist_val =  ((exist_val >> 22) << 22) | (exist_val & 0x3f); +							exist_val |= ((sym_addr & 0xFFFF) << 6); +							*(unsigned long *)r2_mem = htoniosl(exist_val); +						 +						} else  +							goto NIOS2_RELOC_ERR; +					} +					break; + +				case R_NIOS2_GPREL: +				{ +					unsigned long exist_val, temp; +					//long gp = get_symbol_offset("_gp", sym_section, symbols, number_of_symbols); +					long gp = get_gp_value(symbols, number_of_symbols); +					if (gp == -1) { +						printf("Err: unresolved symbol _gp when relocating %s\n", sym_name); +						goto NIOS2_RELOC_ERR; +					} +					/* _gp holds a absolute value, otherwise the ld cannot generate correct code */ +					sym_vma = bfd_section_vma(abs_bfd, sym_section); +					//printf("sym=%x, %d, _gp=%x, %d\n", sym_addr+sym_vma, sym_addr+sym_vma, gp, gp); +					sym_addr += sym_vma + q->addend; +					sym_addr -= gp; +					//printf("sym - _gp=%x, %d\n", sym_addr, sym_addr); +					/* modify the target, in target order (little_endian) */ +					exist_val = niostohl(*(unsigned long *)r_mem); +					temp = ((exist_val >> 6) & 0x3ff0000) | (sym_addr & 0xffff); +					temp <<= 6; +					temp |= (exist_val & 0x3f); +					*(unsigned long *)r_mem = htoniosl(temp); +					if (verbose) +						printf("omit: offset=0x%x symbol=%s%s " +								"section=%s size=%d " +								"fixup=0x%x (reloc=0x%x) GPREL\n",  +								q->address, sym_name, addstr, +								section_name, sym_reloc_size, +								sym_addr, section_vma + q->address); +					continue; +				} +				case R_NIOS2_PCREL16: +				{ +					unsigned long exist_val; +					sym_vma = 0; +					sym_addr += sym_vma + q->addend; +					sym_addr -= (q->address + 4); +					/* modify the target, in target order (little_endian) */ +					exist_val = niostohl(*(unsigned long *)r_mem); +					exist_val =  ((exist_val >> 22) << 22) | (exist_val & 0x3f); +					exist_val |= ((sym_addr & 0xFFFF) << 6); +					*(unsigned long *)r_mem = htoniosl(exist_val); +					if (verbose) +						printf("omit: offset=0x%x symbol=%s%s " +								"section=%s size=%d " +								"fixup=0x%x (reloc=0x%x) PCREL\n",  +								q->address, sym_name, addstr, +								section_name, sym_reloc_size, +								sym_addr, section_vma + q->address); +					continue; +				} + +				case R_NIOS2_LO16: +					/* check if this is actually the 2nd half of a pair */ +					if ((p > relpp) +						&& ((p[-1]->howto->type == R_NIOS2_HIADJ16)  +							|| (p[-1]->howto->type == R_NIOS2_HI16)) +					    && (p[-1]->sym_ptr_ptr == p[0]->sym_ptr_ptr) +					    && (p[-1]->addend == p[0]->addend)) { +						if (verbose) +							printf("omit: offset=0x%x symbol=%s%s " +								"section=%s size=%d LO16\n",  +								q->address, sym_name, addstr, +								section_name, sym_reloc_size); +						continue; +					} + +					/* error, fall through */ + +				case R_NIOS2_S16: +				case R_NIOS2_U16: +				case R_NIOS2_CACHE_OPX: +				case R_NIOS2_IMM5: +				case R_NIOS2_IMM6: +				case R_NIOS2_IMM8: +				case R_NIOS2_BFD_RELOC_16: +				case R_NIOS2_BFD_RELOC_8: +				case R_NIOS2_GNU_VTINHERIT: +				case R_NIOS2_GNU_VTENTRY: +				case R_NIOS2_UJMP: +				case R_NIOS2_CJMP: +				case R_NIOS2_CALLR: +NIOS2_RELOC_ERR: +					printf("Err: unexpected reloc type %s(%d)\n", q->howto->name, q->howto->type); +					bad_relocs++; +					continue; +			} +#endif /* TARGET_nios2 */ + +#ifdef TARGET_v850 +			/* Skip this relocation entirely if possible (we +			   do this early, before doing any other +			   processing on it).  */ +			switch ((*p)->howto->type) { +#ifdef R_V850_9_PCREL +			case R_V850_9_PCREL: +#endif +#ifdef R_V850_22_PCREL +			case R_V850_22_PCREL: +#endif +#ifdef R_V850_SDA_16_16_OFFSET +			case R_V850_SDA_16_16_OFFSET: +#endif +#ifdef R_V850_SDA_15_16_OFFSET +			case R_V850_SDA_15_16_OFFSET: +#endif +#ifdef R_V850_ZDA_15_16_OFFSET +			case R_V850_ZDA_15_16_OFFSET: +#endif +#ifdef R_V850_TDA_6_8_OFFSET +			case R_V850_TDA_6_8_OFFSET: +#endif +#ifdef R_V850_TDA_7_8_OFFSET +			case R_V850_TDA_7_8_OFFSET: +#endif +#ifdef R_V850_TDA_7_7_OFFSET +			case R_V850_TDA_7_7_OFFSET: +#endif +#ifdef R_V850_TDA_16_16_OFFSET +			case R_V850_TDA_16_16_OFFSET: +#endif +#ifdef R_V850_TDA_4_5_OFFSET +			case R_V850_TDA_4_5_OFFSET: +#endif +#ifdef R_V850_TDA_4_4_OFFSET +			case R_V850_TDA_4_4_OFFSET: +#endif +#ifdef R_V850_SDA_16_16_SPLIT_OFFSET +			case R_V850_SDA_16_16_SPLIT_OFFSET: +#endif +#ifdef R_V850_CALLT_6_7_OFFSET +			case R_V850_CALLT_6_7_OFFSET: +#endif +#ifdef R_V850_CALLT_16_16_OFFSET +			case R_V850_CALLT_16_16_OFFSET: +#endif +				/* These are relative relocations, which +				   have already been fixed up by the +				   linker at this point, so just ignore +				   them.  */  +				continue; +			} +#endif /* USE_V850_RELOCS */ + +			q = *p; +#ifdef TARGET_bfin +			if ((q->sym_ptr_ptr && *q->sym_ptr_ptr) && +			     (!is_reloc_stack_empty() && strstr((*(q->sym_ptr_ptr))->name, "operator"))){ +				/* must be an arith reloc ... get the value from the stack */ +				sym_name = (*(q->sym_ptr_ptr))->name; +				sym_section = reloc_stack_get_section(); +				section_name = reloc_stack_get_section_name(); +			} +			else +#endif +			if (q->sym_ptr_ptr && *q->sym_ptr_ptr) { +				sym_name = (*(q->sym_ptr_ptr))->name; +				sym_section = (*(q->sym_ptr_ptr))->section; +				section_name=(*(q->sym_ptr_ptr))->section->name; +			} else { +				printf("ERROR: undefined relocation entry\n"); +				rc = -1; +				continue; +			} +#ifndef TARGET_bfin +			/* Adjust the address to account for the GOT table which wasn't +			 * present in the relative file link. +			 */ +			if (pic_with_got) +			  q->address += got_size; +#endif + +			/* A pointer to what's being relocated, used often +			   below.  */ +			r_mem = sectionp + q->address; + +			/* +			 *	Fixup offset in the actual section. +			 */ +			addstr[0] = 0; +#ifndef TARGET_e1 +  			if ((sym_addr = get_symbol_offset((char *) sym_name, +			    sym_section, symbols, number_of_symbols)) == -1) { +				sym_addr = 0; +			} +#else +			sym_addr = (*(q->sym_ptr_ptr))->value; +#endif			 +			if (use_resolved) { +				/* Use the address of the symbol already in +				   the program text.  How this is handled may +				   still depend on the particular relocation +				   though.  */ +				switch (q->howto->type) { +					int r2_type; +#ifdef TARGET_v850 +				case R_V850_HI16_S: +					/* We specially handle adjacent +					   HI16_S/ZDA_15_16_OFFSET and +					   HI16_S/LO16 pairs that reference the +					   same address (these are usually +					   movhi/ld and movhi/movea pairs, +					   respectively).  */ +					if (relcount == 0) +						r2_type = R_V850_NONE; +					else +						r2_type = p[1]->howto->type; +					if ((r2_type == R_V850_ZDA_15_16_OFFSET +					     || r2_type == R_V850_LO16) +					    && (p[0]->sym_ptr_ptr +						== p[1]->sym_ptr_ptr) +					    && (p[0]->addend == p[1]->addend)) +					{ +						relocation_needed = 1; + +						switch (r2_type) { +						case R_V850_ZDA_15_16_OFFSET: +							pflags = 0x10000000; +							break; +						case R_V850_LO16: +							pflags = 0x20000000; +							break; +						} + +						/* We don't really need the +						   actual value -- the bits +						   produced by the linker are +						   what we want in the final +						   flat file -- but get it +						   anyway if useful for +						   debugging.  */ +						if (verbose) { +							unsigned char *r2_mem = +								sectionp +								+ p[1]->address; +							/* little-endian */ +							int hi = r_mem[0] +								+ (r_mem[1] << 8); +							int lo = r2_mem[0] +								+ (r2_mem[1] << 8); +							/* Sign extend LO.  */ +							lo = (lo ^ 0x8000) +								- 0x8000; + +							/* Maybe ignore the LSB +							   of LO, which is +							   actually part of the +							   instruction.  */ +							if (r2_type != R_V850_LO16) +								lo &= ~1; + +							sym_addr = +								(hi << 16) +								+ lo; +						} +					} else +						goto bad_v850_reloc_err; +					break; + +				case R_V850_LO16: +					/* See if this is actually the +					   2nd half of a pair.  */ +					if (p > relpp +					    && (p[-1]->howto->type +						== R_V850_HI16_S) +					    && (p[-1]->sym_ptr_ptr +						== p[0]->sym_ptr_ptr) +					    && (p[-1]->addend == p[0]->addend)) +						break; /* not an error */ +					else +						goto bad_v850_reloc_err; + +				case R_V850_HI16: +				bad_v850_reloc_err: +					printf("ERROR: reloc type %s unsupported in this context\n", +					       q->howto->name); +					bad_relocs++; +					break; +#endif /* TARGET_V850 */ + +				default: +					/* The default is to assume that the +					   relocation is relative and has +					   already been fixed up by the +					   linker (perhaps we ought to make +					   give an error by default, and +					   require `safe' relocations to be +					   enumberated explicitly?).  */ +					if (bfd_big_endian (abs_bfd)) +						sym_addr = +							(r_mem[0] << 24) +							+ (r_mem[1] << 16) +							+ (r_mem[2] << 8)  +							+ r_mem[3]; +					else +						sym_addr = +							r_mem[0] +							+ (r_mem[1] << 8) +							+ (r_mem[2] << 16) +							+ (r_mem[3] << 24); +					relocation_needed = 1; +				} +			} else { +				/* Calculate the sym address ourselves.  */ +				sym_reloc_size = bfd_get_reloc_size(q->howto); + +#if !defined(TARGET_h8300) && !defined(TARGET_e1) && !defined(TARGET_bfin) +				if (sym_reloc_size != 4) { +					printf("ERROR: bad reloc type %d size=%d for symbol=%s\n", +							(*p)->howto->type, sym_reloc_size, sym_name); +					bad_relocs++; +					rc = -1; +					continue; +				} +#endif + +				switch ((*p)->howto->type) { + +#if defined(TARGET_m68k) +				case R_68K_32: +					relocation_needed = 1; +					sym_vma = bfd_section_vma(abs_bfd, sym_section); +					sym_addr += sym_vma + q->addend; +					break; +				case R_68K_PC32: +					sym_vma = 0; +					sym_addr += sym_vma + q->addend; +					sym_addr -= q->address; +					break; +#endif + +#if defined(TARGET_arm) +				case R_ARM_ABS32: +					relocation_needed = 1; +					if (verbose) +						fprintf(stderr, +							"%s vma=0x%x, value=0x%x, address=0x%x " +							"sym_addr=0x%x rs=0x%x, opcode=0x%x\n", +							"ABS32", +							sym_vma, (*(q->sym_ptr_ptr))->value, +							q->address, sym_addr, +							(*p)->howto->rightshift, +							*(unsigned long *)r_mem); +					sym_vma = bfd_section_vma(abs_bfd, sym_section); +					sym_addr += sym_vma + q->addend; +					break; +				case R_ARM_GOT32: +				case R_ARM_GOTPC: +					/* Should be fine as is */ +					break; +				case R_ARM_PLT32: +					if (verbose) +						fprintf(stderr, +							"%s vma=0x%x, value=0x%x, address=0x%x " +							"sym_addr=0x%x rs=0x%x, opcode=0x%x\n", +							"PLT32", +							sym_vma, (*(q->sym_ptr_ptr))->value, +							q->address, sym_addr, +							(*p)->howto->rightshift, +							*(unsigned long *)r_mem); +				case R_ARM_PC24: +					sym_vma = 0; +					sym_addr = (sym_addr-q->address)>>(*p)->howto->rightshift; +					break; +#endif + +#ifdef TARGET_v850 +				case R_V850_32: +					relocation_needed = 1; +					sym_vma = bfd_section_vma(abs_bfd, sym_section); +					sym_addr += sym_vma + q->addend; +					break; +#if defined(R_V850_ZDA_16_16_OFFSET) || defined(R_V850_ZDA_16_16_SPLIT_OFFSET) +#ifdef R_V850_ZDA_16_16_OFFSET +				case R_V850_ZDA_16_16_OFFSET: +#endif +#ifdef R_V850_ZDA_16_16_SPLIT_OFFSET +				case R_V850_ZDA_16_16_SPLIT_OFFSET: +#endif +					/* Can't support zero-relocations.  */ +					printf ("ERROR: %s+0x%x: zero relocations not supported\n", +							sym_name, q->addend); +					continue; +#endif /* R_V850_ZDA_16_16_OFFSET || R_V850_ZDA_16_16_SPLIT_OFFSET */ +#endif /* TARGET_v850 */ + +#ifdef TARGET_h8300 +				case R_H8_DIR24R8: +					if (sym_reloc_size != 4) { +						printf("R_H8_DIR24R8 size %d\n", sym_reloc_size); +						bad_relocs++; +						continue; +					} +					relocation_needed = 1; +					sym_addr = (*(q->sym_ptr_ptr))->value; +					q->address -= 1; +					r_mem -= 1; /* tracks q->address */ +					sym_vma = bfd_section_vma(abs_bfd, sym_section); +					sym_addr += sym_vma + q->addend; +					sym_addr |= (*(unsigned char *)r_mem<<24); +					break; +				case R_H8_DIR24A8: +					if (sym_reloc_size != 4) { +						printf("R_H8_DIR24A8 size %d\n", sym_reloc_size); +						bad_relocs++; +						continue; +					} +					/* Absolute symbol done not relocation */ +					relocation_needed = !bfd_is_abs_section(sym_section); +					sym_addr = (*(q->sym_ptr_ptr))->value; +					sym_vma = bfd_section_vma(abs_bfd, sym_section); +					sym_addr += sym_vma + q->addend; +					break; +				case R_H8_DIR32: +				case R_H8_DIR32A16: /* currently 32,  could be made 16 */ +					if (sym_reloc_size != 4) { +						printf("R_H8_DIR32 size %d\n", sym_reloc_size); +						bad_relocs++; +						continue; +					} +					relocation_needed = 1; +					sym_addr = (*(q->sym_ptr_ptr))->value; +					sym_vma = bfd_section_vma(abs_bfd, sym_section); +					sym_addr += sym_vma + q->addend; +					break; +				case R_H8_PCREL16: +					sym_vma = 0; +					sym_addr = (*(q->sym_ptr_ptr))->value; +					sym_addr += sym_vma + q->addend; +					sym_addr -= (q->address + 2); +					if (bfd_big_endian(abs_bfd)) +					*(unsigned short *)r_mem = +						bfd_big_endian(abs_bfd) ? htons(sym_addr) : sym_addr; +					continue; +				case R_H8_PCREL8: +					sym_vma = 0; +					sym_addr = (*(q->sym_ptr_ptr))->value; +					sym_addr += sym_vma + q->addend; +					sym_addr -= (q->address + 1); +					*(unsigned char *)r_mem = sym_addr; +					continue; +#endif + +#ifdef TARGET_microblaze +				case R_MICROBLAZE_64: +		/* The symbol is split over two consecutive instructions.   +		   Flag this to the flat loader by setting the high bit of  +		   the relocation symbol. */ +				{ +					unsigned char *p = r_mem; +					unsigned long offset; +					pflags=0x80000000; + +					/* work out the relocation */ +					sym_vma = bfd_section_vma(abs_bfd, sym_section); +					/* grab any offset from the text */ +					offset = (p[2]<<24) + (p[3] << 16) + (p[6] << 8) + (p[7]); +					/* Update the address */ +					sym_addr += offset + sym_vma + q->addend; +					/* Write relocated pointer back */ +					p[2] = (sym_addr >> 24) & 0xff; +					p[3] = (sym_addr >> 16) & 0xff; +					p[6] = (sym_addr >>  8) & 0xff; +					p[7] =  sym_addr        & 0xff; + +					/* create a new reloc entry */ +					flat_relocs = realloc(flat_relocs, +						(flat_reloc_count + 1) * sizeof(uint32_t)); +					flat_relocs[flat_reloc_count] = pflags | (section_vma + q->address); +					flat_reloc_count++; +					relocation_needed = 0; +					pflags = 0; +			sprintf(&addstr[0], "+0x%x", sym_addr - (*(q->sym_ptr_ptr))->value - +					 bfd_section_vma(abs_bfd, sym_section)); +			if (verbose) +				printf("  RELOC[%d]: offset=0x%x symbol=%s%s " +					"section=%s size=%d " +					"fixup=0x%x (reloc=0x%x)\n", flat_reloc_count, +					q->address, sym_name, addstr, +					section_name, sym_reloc_size, +					sym_addr, section_vma + q->address); +			if (verbose) +				printf("reloc[%d] = 0x%x\n", flat_reloc_count, +					 section_vma + q->address); + +					continue; +				} +				case R_MICROBLAZE_32: +				{	 +					unsigned char *p = r_mem; +					unsigned long offset; + +					/* grab any offset from the text */ +					offset = (p[0]<<24) + (p[1] << 16) + (p[2] << 8) + (p[3]); +					sym_vma = bfd_section_vma(abs_bfd, sym_section); +					/* This is a horrible kludge.  For some +					   reason, *sometimes* the offset is in +					   both addend and the code.  Detect +					   it, and cancel the effect.  Otherwise +					   the offset gets added twice - ouch. +					   There should be a better test +					   for this condition, based on the +					   BFD data structures */ +					if(offset==q->addend) +						offset=0; + +					sym_addr += offset + sym_vma + q->addend; +					relocation_needed = 1; +					break; +				} +				case R_MICROBLAZE_64_PCREL: +					sym_vma = 0; +					//sym_addr = (*(q->sym_ptr_ptr))->value; +					sym_addr += sym_vma + q->addend; +					sym_addr -= (q->address + 4); +					sym_addr = htonl(sym_addr); +					/* insert 16 MSB */ +					* ((unsigned short *) (r_mem+2)) |= (sym_addr) & 0xFFFF; +					/* then 16 LSB */ +					* ((unsigned short *) (r_mem+6)) |= (sym_addr >> 16) & 0xFFFF; +					/* We've done all the work, so continue +					   to next reloc instead of break */ +					continue; + +#endif /* TARGET_microblaze */ +					 +#ifdef TARGET_sparc +				case R_SPARC_32: +				case R_SPARC_UA32: +					relocation_needed = 1; +					sym_vma = bfd_section_vma(abs_bfd, sym_section); +					sym_addr += sym_vma + q->addend; +					break; +				case R_SPARC_PC22: +					sym_vma = 0; +					sym_addr += sym_vma + q->addend; +					sym_addr -= q->address; +					break; +				case R_SPARC_WDISP30: +					sym_addr = (((*(q->sym_ptr_ptr))->value- +						q->address) >> 2) & 0x3fffffff; +					sym_addr |= ( +						ntohl(*(unsigned long *)r_mem) +						& 0xc0000000 +						); +					break; +				case R_SPARC_HI22: +					relocation_needed = 1; +					pflags = 0x80000000; +					sym_vma = bfd_section_vma(abs_bfd, sym_section); +					sym_addr += sym_vma + q->addend; +					sym_addr |= ( +						htonl(*(unsigned long *)r_mem) +						& 0xffc00000 +						); +					break; +				case R_SPARC_LO10: +					relocation_needed = 1; +					pflags = 0x40000000; +					sym_vma = bfd_section_vma(abs_bfd, sym_section); +					sym_addr += sym_vma + q->addend; +					sym_addr &= 0x000003ff; +					sym_addr |= ( +						htonl(*(unsigned long *)r_mem) +						& 0xfffffc00 +						); +					break; +#endif /* TARGET_sparc */ + +#ifdef TARGET_bfin +				case R_pcrel12_jump: +				case R_pcrel12_jump_s: +				case R_pcrel24: +				case R_pcrel24_jump_l: +				case R_pcrel24_jump_x: +				case R_pcrel24_call_x: +				case R_pcrel10: +				case R_pcrel11: +				case R_pcrel5m2: +				  sym_addr += q->addend;// get the symbol addr +				  sym_vma = bfd_section_vma(abs_bfd, sym_section); +				  sym_addr -= q->address; // make it PC relative  +				  // implicitly assumes code section and symbol section are same +				  break; +				 +				case R_rimm16: +				    if (is_reloc_stack_empty ()) +				    { +					sym_addr += q->addend; +				    } else { +					sym_addr = reloc_stack_pop (); +				    } +				    if(weak_und_symbol(sym_section->name, (*(q->sym_ptr_ptr)))) +					continue; +				    if(0xFFFF0000 & sym_addr){ +					fprintf (stderr, "Relocation overflow for rN = %s\n",sym_name); +					bad_relocs++; +				    } +				    flat_relocs = (uint32_t *) +					(realloc (flat_relocs, (flat_reloc_count + 1) * sizeof (uint32_t))); +				    if (bfin_set_reloc (flat_relocs + flat_reloc_count,  +							sym_section->name, sym_name, +							(*(q->sym_ptr_ptr)), +							0, FLAT_RELOC_PART_LO,  +							section_vma + q->address)) +					bad_relocs++; +				    flat_reloc_count++; +				    break; +				     +				case R_luimm16: +				case R_huimm16: +				{ +				    unsigned int sp; +				    unsigned int reloc_count_incr; +				    unsigned int hi_lo; + +				    if (q->howto->type == R_luimm16) +					hi_lo = FLAT_RELOC_PART_LO; +				    else +					hi_lo = FLAT_RELOC_PART_HI; +				 +				    if (is_reloc_stack_empty ()) +					sym_addr += q->addend; +				    else +					sym_addr = reloc_stack_pop (); +				     +				    flat_relocs = (uint32_t *) +					(realloc (flat_relocs, (flat_reloc_count + 2) * sizeof (uint32_t))); +				    reloc_count_incr = 1; +				    if (weak_und_symbol (sym_section->name, (*(q->sym_ptr_ptr)))) +					continue; +				    if (0xFFFF0000 & sym_addr) { +					/* value is > 16 bits - use an extra field */ +					/* see if we have already output that symbol */ +					/* reloc may be addend from symbol and       */ +					/* we can only store 16 bit offsets	     */ +					sp = 1; +					if ((*(q->sym_ptr_ptr))->udata.i == 0 +					    || flat_relocs[(*(q->sym_ptr_ptr))->udata.i] != sym_addr +					    || ((*(q->sym_ptr_ptr))->udata.i & 0xFFFF0000)) +					{ +					    reloc_count_incr = 2; +					    flat_relocs[flat_reloc_count + 1] = sym_addr; +					    (*(q->sym_ptr_ptr))->udata.i = flat_reloc_count + 1; +					    sym_addr = 0; // indication to loader to read next +					} else{ +					    sym_addr = (*(q->sym_ptr_ptr))->udata.i; +					} +				    } else { +					sp = 0; +				    } + +				    if (bfin_set_reloc (flat_relocs + flat_reloc_count,  +							sym_section->name, sym_name, +							(*(q->sym_ptr_ptr)), +							sp, hi_lo, +							section_vma + q->address)) +					bad_relocs++; +				    flat_reloc_count += reloc_count_incr; +				    break; +				} +				case R_byte4_data: +				    if (is_reloc_stack_empty ()) +					sym_addr += q->addend; +				    else +					sym_addr = reloc_stack_pop (); +				    if (weak_und_symbol (sym_section->name, *q->sym_ptr_ptr)) +					continue; + +				    flat_relocs = (uint32_t *) +					(realloc (flat_relocs, (flat_reloc_count + 1) * sizeof (uint32_t))); +				    if (bfin_set_reloc (flat_relocs + flat_reloc_count,  +							sym_section->name, sym_name, +							(*(q->sym_ptr_ptr)), +							2, FLAT_RELOC_PART_LO,  +							section_vma + q->address)) +					bad_relocs++; + +				    flat_reloc_count++; +				    break; + +				case 0xE0:  +				   /* push */ +				  sym_addr += q->addend; +				  reloc_stack_push(sym_addr); +				  reloc_stack_set_section(sym_section, section_name); +				  break; + +				case 0xE1: +				  /* const */ +				  reloc_stack_push(q->addend); +				break; + +				case 0xE2 ... 0xF2: +				  reloc_stack_operate((*p)->howto->type); +				  break; + +#endif //TARGET_bfin + +#ifdef TARGET_sh +				case R_SH_DIR32: +					relocation_needed = 1; +					sym_vma = bfd_section_vma(abs_bfd, sym_section); +					sym_addr += sym_vma + q->addend; +					break; +				case R_SH_REL32: +					sym_vma = 0; +					sym_addr += sym_vma + q->addend; +					sym_addr -= q->address; +					break; +#endif /* TARGET_sh */ + +#ifdef TARGET_e1 +#define  htoe1l(x)              htonl(x) +					 +#if 0  +#define  DEBUG_E1 +#endif + +#ifdef   DEBUG_E1 +#define  DBG_E1                 printf +#else +#define  DBG_E1(x, ...  ) +#endif + +#define _32BITS_RELOC 0x00000000 +#define _30BITS_RELOC 0x80000000 +#define _28BITS_RELOC 0x40000000 +					{ +				char *p; +				unsigned long   sec_vma, exist_val, S; +				case R_E1_CONST31: +						relocation_needed = 1; +						DBG_E1("Handling Reloc <CONST31>\n"); +						sec_vma = bfd_section_vma(abs_bfd, sym_section); +						DBG_E1("sec_vma : [0x%x], sym_addr : [0x%x], q->address : [0x%x]\n", +										sec_vma, sym_addr, q->address); +						sym_addr = sec_vma + sym_addr; +						exist_val = *(unsigned long*)((unsigned long)sectionp + q->address + 2);         +						DBG_E1("Orig:exist_val : [0x%08x]\n", exist_val); +						exist_val = htoe1l(exist_val); +						DBG_E1("HtoBE:exist_val : [0x%08x]\n", exist_val); +						sym_addr += exist_val; +						pflags = _30BITS_RELOC; +						break; +				case R_E1_CONST31_PCREL: +						relocation_needed = 0; +						DBG_E1("Handling Reloc <CONST31_PCREL>\n"); +						DBG_E1("DONT RELOCATE AT LOADING\n"); +						sec_vma = bfd_section_vma(abs_bfd, sym_section); +						DBG_E1("sec_vma : [0x%x], sym_addr : [0x%x], q->address : [0x%x]\n", +										sec_vma, sym_addr, q->address); +						sym_addr =  sec_vma + sym_addr; +						DBG_E1("sym_addr =  sec_vma + sym_addr : [0x%x]\n", sym_addr ); + +						DBG_E1("q->address : 0x%x, section_vma : 0x%x\n", q->address, +																		section_vma ); +						q->address = q->address + section_vma; +						DBG_E1("q->address += section_vma : 0x%x\n", q->address ); + +						if( (sym_addr = (sym_addr - q->address - 6)) < 0 ) +								DBG_E1("NEGATIVE OFFSET in PC Relative instruction\n"); +						DBG_E1( "sym_addr := sym_addr - q->address  - " +								"sizeof(CONST31_PCREL): [0x%x]\n", +								sym_addr ); +						exist_val = *(unsigned long*)((unsigned long)sectionp + q->address + 2);               +						DBG_E1("Orig:exist_val : [0x%08x]\n", exist_val); +						exist_val = htoe1l(exist_val); +						DBG_E1("HtoBE:exist_val : [0x%08x]\n", exist_val); +						sym_addr |= exist_val; +						DBG_E1("sym_addr |=  exist_val) : [0x%x]\n", sym_addr ); +						break; +				case R_E1_DIS29W_PCREL: +						relocation_needed = 0; +						DBG_E1("Handling Reloc <DIS29W_PCREL>\n"); +						DBG_E1("DONT RELOCATE AT LOADING\n"); +						sec_vma = bfd_section_vma(abs_bfd, sym_section); +						DBG_E1("sec_vma : [0x%x], sym_addr : [0x%x], q->address : [0x%x]\n", +										sec_vma, sym_addr, q->address); +						sym_addr =  sec_vma + sym_addr; +						DBG_E1("sym_addr =  sec_vma + sym_addr : [0x%x]\n", sym_addr ); + +						DBG_E1("q->address : 0x%x, section_vma : 0x%x\n", q->address, +																		section_vma ); +						q->address = q->address + section_vma; +						DBG_E1("q->address += section_vma : 0x%x\n", q->address ); + +						if( (sym_addr = (sym_addr - q->address - 6)) < 0 ) +								DBG_E1("NEGATIVE OFFSET in PC Relative instruction\n"); +						DBG_E1( "sym_addr := sym_addr - q->address  - " +								"sizeof(CONST31_PCREL): [0x%x]\n", +								sym_addr ); +						DBG_E1("sectionp:[0x%x], q->address:[0x%x]\n", sectionp, q->address ); +						exist_val = *(unsigned long*)((unsigned long)sectionp + q->address + 2);        +						DBG_E1("Original:exist_val : [0x%08x]\n",exist_val); +						exist_val = htoe1l(exist_val); +						DBG_E1("HtoBE:exist_val : [0x%08x]\n",exist_val); +						sym_addr += exist_val; +						break; +				case R_E1_DIS29W: +						DBG_E1("Handling Reloc <DIS29W>\n"); +						goto DIS29_RELOCATION; +				case R_E1_DIS29H: +						DBG_E1("Handling Reloc <DIS29H>\n"); +						goto DIS29_RELOCATION; +				case R_E1_DIS29B: +						DBG_E1("Handling Reloc <DIS29B>\n"); +DIS29_RELOCATION: +						relocation_needed = 1; +						sec_vma = bfd_section_vma(abs_bfd, sym_section); +						DBG_E1("sec_vma : [0x%x], sym_addr : [0x%08x]\n", +										sec_vma, sym_addr); +						sym_addr =  sec_vma + sym_addr; +						DBG_E1("sym_addr =  sec_vma + sym_addr : [0x%08x]\n", sym_addr); +						exist_val = *(unsigned long*)((unsigned long)sectionp + q->address + 2);                 +						DBG_E1("Orig:exist_val : [0x%08x]\n", exist_val); +						exist_val = htoe1l(exist_val); +						DBG_E1("HtoBE:exist_val : [0x%08x]\n", exist_val); +						sym_addr +=  exist_val; +						DBG_E1("sym_addr +=  exist_val : [0x%08x]\n", sym_addr); +						pflags = _28BITS_RELOC; +						break; +				case R_E1_IMM32_PCREL: +						relocation_needed = 0; +						DBG_E1("Handling Reloc <IMM32_PCREL>\n"); +						DBG_E1("DONT RELOCATE AT LOADING\n"); +						sec_vma = bfd_section_vma(abs_bfd, sym_section); +						DBG_E1("sec_vma : [0x%x], sym_addr : [0x%x]\n", +										sec_vma, sym_addr); +						sym_addr =  sec_vma + sym_addr; + +						DBG_E1("sym_addr =  sec_vma + sym_addr : [0x%x]\n", sym_addr ); +						DBG_E1("q->address : 0x%x, section_vma : 0x%x\n", q->address, +																		section_vma ); +						q->address = q->address + section_vma; +						DBG_E1("q->address += section_vma : 0x%x\n", q->address ); + +						if( (sym_addr = (sym_addr - q->address - 6 )) < 0 ) +								DBG_E1("NEGATIVE OFFSET in PC Relative instruction\n"); +						DBG_E1( "sym_addr := sym_addr - q->address  - " +								"sizeof(CONST31_PCREL): [0x%x]\n", +								sym_addr ); +						DBG_E1("sectionp:[0x%x], q->address:[0x%x]\n", sectionp, q->address ); +						exist_val = *(unsigned long*)((unsigned long)sectionp + q->address + 2);                  + 						DBG_E1("Original:exist_val : [0x%08x]\n",exist_val); +						exist_val = htoe1l(exist_val); +						DBG_E1("HtoBE:exist_val : [0x%08x]\n",exist_val); +						sym_addr += exist_val; +						break; +				case R_E1_IMM32: +						relocation_needed = 1; +						DBG_E1("Handling Reloc <IMM32>\n"); +						sec_vma = bfd_section_vma(abs_bfd, sym_section); +						DBG_E1("sec_vma : [0x%x], sym_addr : [0x%x]\n", +										sec_vma, sym_addr); +						sym_addr =  sec_vma + sym_addr; +						DBG_E1("sym_addr =  sec_vma + sym_addr : [0x%x]\n", sym_addr ); +						DBG_E1("sectionp:[0x%x], q->address:[0x%x]\n", sectionp, q->address ); +						exist_val = *(unsigned long*)((unsigned long)sectionp + q->address + 2);                      +	 					DBG_E1("Original:exist_val : [0x%08x]\n",exist_val); +						exist_val = htoe1l(exist_val); +						DBG_E1("HtoBE:exist_val : [0x%08x]\n",exist_val); +						sym_addr += exist_val; +						pflags = _32BITS_RELOC; +						break; +				case R_E1_WORD: +						relocation_needed = 1; +						DBG_E1("Handling Reloc <WORD>\n"); +						sec_vma = bfd_section_vma(abs_bfd, sym_section); +						DBG_E1("sec_vma : [0x%x], sym_addr : [0x%x]\n", +										sec_vma, sym_addr); +						sym_addr =  sec_vma + sym_addr; +						DBG_E1("sym_addr =  sec_vma + sym_addr : [0x%x]\n", sym_addr ); +						exist_val = *(unsigned long*)((unsigned long)sectionp + q->address ); +						DBG_E1("Orig:exist_val : [0x%08x]\n", exist_val); +						exist_val = htoe1l(exist_val); +						DBG_E1("HtoBE:exist_val : [0x%08x]\n", exist_val); +						sym_addr +=  exist_val; +						DBG_E1("sym_addr +=  exist_val : [0x%08x]\n", sym_addr); +						pflags = _32BITS_RELOC; +						break; +				} +#undef _32BITS_RELOC +#undef _30BITS_RELOC +#undef _28BITS_RELOC +#endif +				default: +					/* missing support for other types of relocs */ +					printf("ERROR: bad reloc type %d\n", (*p)->howto->type); +					bad_relocs++; +					continue; +				} +			} + +			sprintf(&addstr[0], "+0x%x", sym_addr - (*(q->sym_ptr_ptr))->value - +					 bfd_section_vma(abs_bfd, sym_section)); + + +			/* +			 * for full elf relocation we have to write back the +			 * start_code relative value to use. +			 */ +			if (!pic_with_got) { +#if defined(TARGET_arm) +				union { +					unsigned char c[4]; +					unsigned long l; +				} tmp; +				long hl; +				int i0, i1, i2, i3; + +				/* +				 * horrible nasty hack to support different endianess +				 */ +				if (!bfd_big_endian(abs_bfd)) { +					i0 = 0; +					i1 = 1; +					i2 = 2; +					i3 = 3; +				} else { +					i0 = 3; +					i1 = 2; +					i2 = 1; +					i3 = 0; +				} + +				tmp.l = *(unsigned long *)r_mem; +				hl = tmp.c[i0] | (tmp.c[i1] << 8) | (tmp.c[i2] << 16); +				if (((*p)->howto->type != R_ARM_PC24) && +				    ((*p)->howto->type != R_ARM_PLT32)) +					hl |= (tmp.c[i3] << 24); +				else if (tmp.c[i2] & 0x80) +					hl |= 0xff000000; /* sign extend */ +				hl += sym_addr; +				tmp.c[i0] = hl & 0xff; +				tmp.c[i1] = (hl >> 8) & 0xff; +				tmp.c[i2] = (hl >> 16) & 0xff; +				if (((*p)->howto->type != R_ARM_PC24) && +				    ((*p)->howto->type != R_ARM_PLT32)) +					tmp.c[i3] = (hl >> 24) & 0xff; +				if ((*p)->howto->type == R_ARM_ABS32) +					*(unsigned long *)r_mem = htonl(hl); +				else +					*(unsigned long *)r_mem = tmp.l; + +#elif defined(TARGET_bfin) +				if ((*p)->howto->type == R_pcrel24 +				    || (*p)->howto->type == R_pcrel24_jump_l +				    || (*p)->howto->type == R_pcrel24_jump_x +				    || (*p)->howto->type == R_pcrel24_call_x) +				{ +				    sym_addr += 2*-1*PCREL24_MAGIC_OFFSET; +				    *((unsigned short *)(sectionp + q->address) + 1 + PCREL24_MAGIC_OFFSET) +					= (sym_addr >> 1) & 0xffff; +				    *((unsigned short *)(sectionp + q->address) + PCREL24_MAGIC_OFFSET) +					= (0xff00 & *((unsigned short *) (sectionp + q->address) + PCREL24_MAGIC_OFFSET) +					   | ((sym_addr >> 17) & 0xff)); +				} else if ((*p)->howto->type == R_byte4_data) { +				    *((uint32_t *)(sectionp + q->address)) = sym_addr; +				} else if ((*p)->howto->type == R_pcrel12_jump +					   || (*p)->howto->type == R_pcrel12_jump_s) { +				    *((unsigned short *)(sectionp + q->address)) +					= (0xf000 & *((unsigned short *)(sectionp + q->address)) +					   | ((sym_addr >> 1) & 0xfff)); +				} else if ((*p)->howto->type == R_pcrel10) { +				    *((unsigned short *)(sectionp + q->address)) +					= (~0x3ff & *((unsigned short *)(sectionp + q->address)) +					   | ((sym_addr >> 1) & 0x3ff)); +				} else if ((*p)->howto->type == R_rimm16 +					   || (*p)->howto->type == R_huimm16 +					   || (*p)->howto->type == R_luimm16) { +				    /* for l and h we set the lower 16 bits which is only when it will be used */ +				    *((unsigned short *) (sectionp + q->address)) = (unsigned short) sym_addr; +				} else if ((*p)->howto->type == R_pcrel5m2) { +				    *((unsigned short *)(sectionp + q->address)) +					= (0xfff0 & *((unsigned short *)(sectionp + q->address)) +					   | ((sym_addr >> 1) & 0xf)); +				} else if ((*p)->howto->type == R_pcrel11){ +				    *((unsigned short *)(sectionp + q->address)) +					= (0xfc00 & *((unsigned short *)(sectionp + q->address)) +					   | ((sym_addr >> 1) & 0x3ff)); +				} else if (0xE0 <= (*p)->howto->type && 0xF3 >= (*p)->howto->type) { +				    //arith relocs dont generate a real relocation +				} else { +				    printf("Blackfin relocation fail for reloc type: 0x%x\n", (*p)->howto->type); +				} +#elif defined(TARGET_e1) +#define OPCODE_SIZE 2           /* Add 2 bytes, counting the opcode size*/ +				switch ((*p)->howto->type) { +				case R_E1_CONST31: +				case R_E1_CONST31_PCREL: +				case R_E1_DIS29W_PCREL: +				case R_E1_DIS29W: +				case R_E1_DIS29H: +				case R_E1_DIS29B: +				case R_E1_IMM32_PCREL: +				case R_E1_IMM32: +						DBG_E1("In addr + 2:[0x%x] <- write [0x%x]\n", +								(sectionp + q->address + 2), sym_addr ); +						*((unsigned long *) (sectionp + q->address + OPCODE_SIZE)) = +						htonl(sym_addr); +				break; +				case R_E1_WORD: +						DBG_E1("In addr : [0x%x] <- write [0x%x]\n", +								(sectionp + q->address), sym_addr ); +						*((unsigned long *) (sectionp + q->address )) = htonl(sym_addr); +				break; +				default: +						printf("ERROR:Unhandled Relocation. Exiting...\n"); +						exit(0); +				break; +				} +#else /* ! TARGET_arm && ! TARGET_e1 */ + +				switch (q->howto->type) { +#ifdef TARGET_v850 +				case R_V850_HI16_S: +				case R_V850_HI16: +				case R_V850_LO16: +					/* Do nothing -- for cases we handle, +					   the bits produced by the linker are +					   what we want in the final flat file +					   (and other cases are errors).  Note +					   that unlike most relocated values, +					   it is stored in little-endian order, +					   but this is necessary to avoid +					   trashing the low-bit, and the float +					   loaders knows about it.  */ +					break; +#endif /* TARGET_V850 */ + +#ifdef TARGET_nios2 +				case R_NIOS2_BFD_RELOC_32: +				case R_NIOS2_CALL26: +				case R_NIOS2_HIADJ16: +				case R_NIOS2_HI16: +					/* do nothing */ +					break; +#endif /* TARGET_nios2 */ + +				default: +					/* The alignment of the build host +					   might be stricter than that of the +					   target, so be careful.  We store in +					   network byte order. */ +					r_mem[0] = (sym_addr >> 24) & 0xff; +					r_mem[1] = (sym_addr >> 16) & 0xff; +					r_mem[2] = (sym_addr >>  8) & 0xff; +					r_mem[3] =  sym_addr        & 0xff; +				} +#endif /* !TARGET_arm */ +			} + +#ifdef TARGET_bfin +			else { +			    if ((*p)->howto->type == R_rimm16 +				|| (*p)->howto->type == R_huimm16 +				|| (*p)->howto->type == R_luimm16) +			    { +				/* for l and h we set the lower 16 bits which is only when it will be used */ +				*((unsigned short *) (sectionp + q->address)) = (unsigned short) sym_addr; +			    } else if ((*p)->howto->type == R_byte4_data) { +				*((uint32_t *)(sectionp + q->address)) = sym_addr; +			    } +			} +#endif +			if (verbose) +				printf("  RELOC[%d]: offset=0x%x symbol=%s%s " +					"section=%s size=%d " +					"fixup=0x%x (reloc=0x%x)\n", flat_reloc_count, +					q->address, sym_name, addstr, +					section_name, sym_reloc_size, +					sym_addr, section_vma + q->address); + +			/* +			 *	Create relocation entry (PC relative doesn't need this). +			 */ +			if (relocation_needed) { +#ifndef TARGET_bfin +				flat_relocs = realloc(flat_relocs, +					(flat_reloc_count + 1) * sizeof(uint32_t)); +#ifndef TARGET_e1 +				flat_relocs[flat_reloc_count] = pflags | +					(section_vma + q->address); + +				if (verbose) +					printf("reloc[%d] = 0x%x\n", flat_reloc_count, +							section_vma + q->address); +#else +				switch ((*p)->howto->type) { +				case R_E1_CONST31: +				case R_E1_CONST31_PCREL: +				case R_E1_DIS29W_PCREL: +				case R_E1_DIS29W: +				case R_E1_DIS29H: +				case R_E1_DIS29B: +				case R_E1_IMM32_PCREL: +				case R_E1_IMM32: +				flat_relocs[flat_reloc_count] = pflags | +						(section_vma + q->address + OPCODE_SIZE); +				if (verbose) +						printf("RELOCATION TABLE : reloc[%d] = [0x%x]\n", flat_reloc_count, +										 flat_relocs[flat_reloc_count] ); +				break; +				case R_E1_WORD: +				flat_relocs[flat_reloc_count] = pflags | +						(section_vma + q->address); +				if (verbose) +						printf("RELOCATION TABLE : reloc[%d] = [0x%x]\n", flat_reloc_count, +										 flat_relocs[flat_reloc_count] ); +				break; +				} +#endif +				flat_reloc_count++; +#endif +				relocation_needed = 0; +				pflags = 0; +			} + +#if 0 +printf("%s(%d): symbol name=%s address=0x%x section=%s -> RELOC=0x%x\n", +	__FILE__, __LINE__, sym_name, q->address, section_name, +	flat_relocs[flat_reloc_count]); +#endif +		} +	} +  } + +  if (bad_relocs) { +	  printf("%d bad relocs\n", bad_relocs); +	  exit(1); +  } + +  if (rc < 0) +	return(0); + +  *n_relocs = flat_reloc_count; +  return flat_relocs; +} + + + +static char * program; + +static void usage(void) +{   +    fprintf(stderr, "Usage: %s [vrzd] [-p <abs-pic-file>] [-s stack-size] " +	"[-o <output-file>] <elf-file>\n\n" +	"       -v              : verbose operation\n" +	"       -r              : force load to RAM\n" +	"       -k              : enable kernel trace on load (for debug)\n" +	"       -z              : compress code/data/relocs\n" +	"       -d              : compress data/relocs\n" +	"       -a              : use existing symbol references\n" +	"                         instead of recalculating from\n" +	"                         relocation info\n" +        "       -R reloc-file   : read relocations from a separate file\n" +	"       -p abs-pic-file : GOT/PIC processing with files\n" +	"       -s stacksize    : set application stack size\n" +	"       -o output-file  : output file name\n\n", +	program); +	fprintf(stderr, "Compiled for " ARCH " architecture\n\n"); +    exit(2); +} + + +/* Write NUM zeroes to STREAM.  */ +static void write_zeroes (unsigned long num, FILE *stream) +{ +  char zeroes[1024]; +  if (num > 0) { +    /* It'd be nice if we could just use fseek, but that doesn't seem to +       work for stdio output files.  */ +    bzero(zeroes, 1024); +    while (num > sizeof(zeroes)) { +      fwrite(zeroes, sizeof(zeroes), 1, stream); +      num -= sizeof(zeroes); +    } +    if (num > 0) +      fwrite(zeroes, num, 1, stream); +  } +} + + +int main(int argc, char *argv[]) +{ +  int fd; +  bfd *rel_bfd, *abs_bfd; +  asection *s; +  char *ofile=NULL, *pfile=NULL, *abs_file = NULL, *rel_file = NULL; +  char *fname = NULL; +  int opt; +  int i; +  int stack; +  char  cmd[1024]; +  FILE *gf = NULL; + +  asymbol **symbol_table; +  long number_of_symbols; + +  unsigned long data_len = 0; +  unsigned long bss_len = 0; +  unsigned long text_len = 0; +  unsigned long reloc_len; + +  unsigned long data_vma = ~0; +  unsigned long bss_vma = ~0; +  unsigned long text_vma = ~0; + +  unsigned long text_offs; + +  void *text; +  void *data; +  uint32_t *reloc; +   +  struct flat_hdr hdr; + +  int gf_is_pipe = 0; + +  program = argv[0]; +  progname = argv[0]; + +  if (argc < 2) +  	usage(); +   +  if (sizeof(hdr) != 64) { +    fprintf(stderr, +	    "Potential flat header incompatibility detected\n" +	    "header size should be 64 but is %d\n", +	    sizeof(hdr)); +    exit(64); +  } + +#ifndef TARGET_e1 +  stack = 4096; +#else /* We need plenty of stack for both of them (Aggregate and Register) */ +  stack = 0x2020; +#endif + +  while ((opt = getopt(argc, argv, "avzdrkp:s:o:R:")) != -1) { +    switch (opt) { +    case 'v': +      verbose++; +      break; +    case 'r': +      load_to_ram++; +      break; +    case 'k': +      ktrace++; +      break; +    case 'z': +      compress = 1; +      break; +    case 'd': +      compress = 2; +      break; +    case 'p': +      pfile = optarg; +      break; +    case 'o': +      ofile = optarg; +      break; +    case 'a': +      use_resolved = 1; +      break; +    case 's': +      stack = atoi(optarg); +      break; +    case 'R': +      rel_file = optarg; +      break; +    default: +      fprintf(stderr, "%s Unknown option\n", argv[0]); +      usage(); +      break; +    } +  } +   +  /* +   * if neither the -r or -p options was given,  default to +   * a RAM load as that is the only option that makes sense. +   */ +  if (!load_to_ram && !pfile) +    load_to_ram = 1; + +  filename = fname = argv[argc-1]; + +  if (pfile) { +    pic_with_got = 1; +    abs_file = pfile; +  } else +    abs_file = fname; + +  if (! rel_file) +    rel_file = fname; + +  if (!(rel_bfd = bfd_openr(rel_file, 0))) { +    fprintf(stderr, "Can't open %s\n", rel_file); +    exit(1); +  } + +  if (bfd_check_format (rel_bfd, bfd_object) == 0) { +    fprintf(stderr, "File is not an object file\n"); +    exit(2); +  } + +  if (abs_file == rel_file) +    abs_bfd = rel_bfd; /* one file does all */ +  else { +    if (!(abs_bfd = bfd_openr(abs_file, 0))) { +      fprintf(stderr, "Can't open %s\n", abs_file); +      exit(1); +    } + +    if (bfd_check_format (abs_bfd, bfd_object) == 0) { +      fprintf(stderr, "File is not an object file\n"); +      exit(2); +    } +  } + +  if (! (bfd_get_file_flags(rel_bfd) & HAS_RELOC)) { +    fprintf (stderr, "%s: Input file contains no relocation info\n", rel_file); +    exit (2); +  } + +  if (use_resolved && !(bfd_get_file_flags(abs_bfd) & EXEC_P)) { +    /* `Absolute' file is not absolute, so neither are address +       contained therein.  */ +    fprintf (stderr, +	     "%s: `-a' option specified with non-fully-resolved input file\n", +	     bfd_get_filename (abs_bfd)); +    exit (2); +  } + +  symbol_table = get_symbols(abs_bfd, &number_of_symbols); + +  /* Group output sections into text, data, and bss, and calc their sizes.  */ +  for (s = abs_bfd->sections; s != NULL; s = s->next) { +    unsigned long *vma, *len; +    bfd_size_type sec_size; +    bfd_vma sec_vma; + +    if (s->flags & SEC_CODE) { +      vma = &text_vma; +      len = &text_len; +    } else if (s->flags & SEC_DATA) { +      vma = &data_vma; +      len = &data_len; +    } else if (s->flags & SEC_ALLOC) { +      vma = &bss_vma; +      len = &bss_len; +    } else +      continue; + +    sec_size = bfd_section_size(abs_bfd, s); +    sec_vma  = bfd_section_vma(abs_bfd, s); + +    if (sec_vma < *vma) { +      if (*len > 0) +	*len += sec_vma - *vma; +      else +	*len = sec_size; +      *vma = sec_vma; +    } else if (sec_vma + sec_size > *vma + *len) +      *len = sec_vma + sec_size - *vma; +  } + +  if (text_len == 0) { +    fprintf (stderr, "%s: no .text section", abs_file); +    exit (2); +  } + +  text = malloc(text_len); + +  if (verbose) +    printf("TEXT -> vma=0x%x len=0x%x\n", text_vma, text_len); + +  /* Read in all text sections.  */ +  for (s = abs_bfd->sections; s != NULL; s = s->next) +    if (s->flags & SEC_CODE)  +      if (!bfd_get_section_contents(abs_bfd, s, +				   text + (s->vma - text_vma), 0, +				   bfd_section_size(abs_bfd, s))) +      { +	fprintf(stderr, "read error section %s\n", s->name); +	exit(2); +      } + +  if (data_len == 0) { +    fprintf (stderr, "%s: no .data section", abs_file); +    exit (2); +  } +  data = malloc(data_len); + +  if (verbose) +    printf("DATA -> vma=0x%x len=0x%x\n", data_vma, data_len); + +  if ((text_vma + text_len) != data_vma) { +    if ((text_vma + text_len) > data_vma) { +      printf("ERROR: text=0x%x overlaps data=0x%x ?\n", text_len, data_vma); +      exit(1); +    } +    if (verbose) +      printf("WARNING: data=0x%x does not directly follow text=0x%x\n", +	  		data_vma, text_len); +    text_len = data_vma - text_vma; +  } + +  /* Read in all data sections.  */ +  for (s = abs_bfd->sections; s != NULL; s = s->next) +    if (s->flags & SEC_DATA)  +      if (!bfd_get_section_contents(abs_bfd, s, +				   data + (s->vma - data_vma), 0, +				   bfd_section_size(abs_bfd, s))) +      { +	fprintf(stderr, "read error section %s\n", s->name); +	exit(2); +      } + +  /* Put common symbols in bss.  */ +  bss_len += add_com_to_bss(symbol_table, number_of_symbols, bss_len); + +  if (verbose) +    printf("BSS  -> vma=0x%x len=0x%x\n", bss_vma, bss_len); + +  if ((data_vma + data_len) != bss_vma) { +    if ((data_vma + data_len) > bss_vma) { +      printf("ERROR: text=0x%x + data=0x%x overlaps bss=0x%x ?\n", text_len, +	  		data_len, bss_vma); +      exit(1); +    } +    if (verbose) +      printf("WARNING: bss=0x%x does not directly follow text=0x%x + data=0x%x(0x%x)\n", +      		bss_vma, text_len, data_len, text_len + data_len); +    data_len = bss_vma - data_vma; +  } + +  reloc = output_relocs(abs_bfd, symbol_table, number_of_symbols, &reloc_len, +			text, text_len, text_vma, data, data_len, data_vma, +			rel_bfd); + +  if (reloc == NULL) +    printf("No relocations in code!\n"); + +  text_offs = real_address_bits(text_vma); + +  /* Fill in the binflt_flat header */ +  memcpy(hdr.magic,"bFLT",4); +  hdr.rev         = htonl(FLAT_VERSION); +  hdr.entry       = htonl(sizeof(hdr) + bfd_get_start_address(abs_bfd)); +  hdr.data_start  = htonl(sizeof(hdr) + text_offs + text_len); +  hdr.data_end    = htonl(sizeof(hdr) + text_offs + text_len +data_len); +  hdr.bss_end     = htonl(sizeof(hdr) + text_offs + text_len +data_len+bss_len); +  hdr.stack_size  = htonl(stack); /* FIXME */ +  hdr.reloc_start = htonl(sizeof(hdr) + text_offs + text_len +data_len); +  hdr.reloc_count = htonl(reloc_len); +  hdr.flags       = htonl(0 +	  | (load_to_ram ? FLAT_FLAG_RAM : 0) +	  | (ktrace ? FLAT_FLAG_KTRACE : 0) +	  | (pic_with_got ? FLAT_FLAG_GOTPIC : 0) +	  | (compress ? (compress == 2 ? FLAT_FLAG_GZDATA : FLAT_FLAG_GZIP) : 0) +	  ); +  hdr.build_date = htonl((unsigned long)time(NULL)); +  bzero(hdr.filler, sizeof(hdr.filler)); + +  for (i=0; i<reloc_len; i++) reloc[i] = htonl(reloc[i]); + +  if (verbose) { +    printf("SIZE: .text=0x%04x, .data=0x%04x, .bss=0x%04x", +	text_len, data_len, bss_len); +    if (reloc) +      printf(", relocs=0x%04x", reloc_len); +    printf("\n"); +  } +   +  if (!ofile) { +    ofile = malloc(strlen(fname) + 5 + 1); /* 5 to add suffix */ +    strcpy(ofile, fname); +    strcat(ofile, ".bflt"); +  } + +  if ((fd = open (ofile, O_WRONLY|O_BINARY|O_CREAT|O_TRUNC, 0744)) < 0) { +    fprintf (stderr, "Can't open output file %s\n", ofile); +    exit(4); +  } + +  write(fd, &hdr, sizeof(hdr)); +  close(fd); + +  /* +   * get the compression command ready +   */ +  sprintf(cmd, "gzip -f -9 >> %s", ofile); + +#define	START_COMPRESSOR do { \ +		if (gf) \ +			if (gf_is_pipe) \ +				pclose(gf); \ +			else \ +				fclose(gf); \ +		if (!(gf = popen(cmd, "wb"))) { \ +			fprintf(stderr, "Can't run cmd %s\n", cmd); \ +			exit(4); \ +		} \ +		gf_is_pipe = 1; \ +	} while (0) + +  gf = fopen(ofile, "ab");	/* Add 'b' to support non-posix (ie windows) */ +  if (!gf) { +  	fprintf(stderr, "Can't open file %s for writing\n", ofile); \ +	exit(4); +  } + +  if (compress == 1) +  	START_COMPRESSOR; + +  /* Fill in any hole at the beginning of the text segment.  */ +  if (verbose) +	  printf("ZERO before text len=0x%x\n", text_offs); +  write_zeroes(text_offs, gf); + +  /* Write the text segment.  */ +  fwrite(text, text_len, 1, gf); + +  if (compress == 2) +  	START_COMPRESSOR; + +  /* Write the data segment.  */ +  fwrite(data, data_len, 1, gf); + +  if (reloc) +    fwrite(reloc, reloc_len * 4, 1, gf); + +  if(gf_is_pipe) +    pclose(gf); +  else +  fclose(gf); + +  exit(0); +} + + +/* + * 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 + */ diff --git a/toolchain/elf2flt/elf2flt/elf2flt.ld b/toolchain/elf2flt/elf2flt/elf2flt.ld new file mode 100644 index 000000000..e0f3f2b98 --- /dev/null +++ b/toolchain/elf2flt/elf2flt/elf2flt.ld @@ -0,0 +1,145 @@ + +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.*) + +		/* 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 + +	.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) } +} diff --git a/toolchain/elf2flt/elf2flt/flat.h b/toolchain/elf2flt/elf2flt/flat.h new file mode 100644 index 000000000..3cc502d7c --- /dev/null +++ b/toolchain/elf2flt/elf2flt/flat.h @@ -0,0 +1,111 @@ +/* + * 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 + */ diff --git a/toolchain/elf2flt/elf2flt/flthdr.c b/toolchain/elf2flt/elf2flt/flthdr.c new file mode 100644 index 000000000..fc83780c4 --- /dev/null +++ b/toolchain/elf2flt/elf2flt/flthdr.c @@ -0,0 +1,380 @@ +/****************************************************************************/ +/* + *	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 */ +#else +#include <winsock2.h> +#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, "rb")) == 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, "wb")) == 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, "wb"); +			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, "wb"); +		if(!tfp) { +			perror("popen"); +			exit(1); +		} +		transferr(ifp, tfp, -1); +		pclose(tfp); + +		fclose(ifp); +		ifp = fopen(tfile2, "rb"); +		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, "wb"); +		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, "wb"); +		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); +} + +/****************************************************************************/ diff --git a/toolchain/elf2flt/elf2flt/install-sh b/toolchain/elf2flt/elf2flt/install-sh new file mode 100755 index 000000000..398a88e14 --- /dev/null +++ b/toolchain/elf2flt/elf2flt/install-sh @@ -0,0 +1,251 @@ +#!/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 diff --git a/toolchain/elf2flt/elf2flt/ld-elf2flt.in b/toolchain/elf2flt/elf2flt/ld-elf2flt.in new file mode 100644 index 000000000..140b4f928 --- /dev/null +++ b/toolchain/elf2flt/elf2flt/ld-elf2flt.in @@ -0,0 +1,174 @@ +#!/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" +TOOLDIR="`dirname $0`"      # let gcc find the tools for us +LDSCRIPTPATH="${TOOLDIR}/../@target_alias@/lib"		# and the scripts +SHARED_ID="" +NEWLDSCRIPT="" + +# check TOOLDIR from prefix/bin/ or prefix/target-alias/bin/ +[ -d "${TOOLDIR}/../@target_alias@/lib" ] || 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" +		if [ "$MOVDAT" ] +		then +			$LINKER -r -d -o "$OFILE.elf2flt" $ARG1  || exit $? +			if [ "`@target_alias@-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)/" +			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 +		 +		# 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 [ "@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 +		if grep _GLOBAL_OFFSET_TABLE_ "$OFILE.gdb" > /dev/null  +		then +			$ELF2FLT $FLTFLAGS -o "$OFILE" -p "$OFILE.gdb" "$OFILE.elf" || exit $? +		else +			$ELF2FLT $FLTFLAGS -o "$OFILE" -r "$OFILE.elf" || exit $? +		fi +		rm -f "$OFILE.elf"  # 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 "$@" diff --git a/toolchain/elf2flt/elf2flt/stubs.c b/toolchain/elf2flt/elf2flt/stubs.c new file mode 100644 index 000000000..fb14d6319 --- /dev/null +++ b/toolchain/elf2flt/elf2flt/stubs.c @@ -0,0 +1,6 @@ +#ifndef HAVE_DCGETTEXT +const char *dcgettext (const char *domain, const char *msg, int category) +{ +  return msg; +} +#endif /* !HAVE_DCGETTEXT */ | 
